return 0;
}
+template <typename I>
+uint64_t ImageRequest<I>::get_total_length() const {
+ uint64_t total_bytes = 0;
+ for (auto& image_extent : this->m_image_extents) {
+ total_bytes += image_extent.second;
+ }
+ return total_bytes;
+}
+
template <typename I>
void ImageRequest<I>::update_timestamp() {
bool modify = (get_aio_type() != AIO_TYPE_READ);
return 0;
}
+template <typename I>
+bool ImageReadRequest<I>::finish_request_early() {
+ auto total_bytes = this->get_total_length();
+ if (total_bytes == 0) {
+ auto *aio_comp = this->m_aio_comp;
+ aio_comp->set_request_count(0);
+ return true;
+ }
+ return false;
+}
+
template <typename I>
void ImageReadRequest<I>::send_request() {
I &image_ctx = this->m_image_ctx;
return true;
}
}
- uint64_t total_bytes = 0;
- for (auto& image_extent : this->m_image_extents) {
- total_bytes += image_extent.second;
- }
+ auto total_bytes = this->get_total_length();
if (total_bytes == 0) {
aio_comp->set_request_count(0);
return true;
m_trace.event("start");
}
+ uint64_t get_total_length() const;
+
virtual bool finish_request_early() {
return false;
}
protected:
int clip_request() override;
+ bool finish_request_early() override;
void send_request() override;
void send_image_cache_request() override;