]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: start readahead from m_last_pos when the size of the continuing
authorZhiqiang Wang <zhiqiang.wang@intel.com>
Tue, 7 Apr 2015 05:43:36 +0000 (13:43 +0800)
committerZhiqiang Wang <zhiqiang.wang@intel.com>
Tue, 7 Apr 2015 05:43:36 +0000 (13:43 +0800)
triggering request is big enough

If the size of the read triggering the continuing readahead is such big
that exceeding m_readahead_pos, should do the readahead starting from
m_last_pos.

Signed-off-by: Zhiqiang Wang <zhiqiang.wang@intel.com>
src/common/Readahead.cc

index a3f5bfc7e4e74bee381ba005312b19697d8b02f5..77ab92eba4ff1facc0c124474f833cd018dd96f8 100644 (file)
@@ -70,6 +70,9 @@ Readahead::extent_t Readahead::_compute_readahead(uint64_t limit) {
       } else {
        // continuing readahead trigger
        m_readahead_size *= 2;
+       if (m_last_pos > m_readahead_pos) {
+         m_readahead_pos = m_last_pos;
+       }
       }
       m_readahead_size = MAX(m_readahead_size, m_readahead_min_bytes);
       m_readahead_size = MIN(m_readahead_size, m_readahead_max_bytes);