]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: use fh min readahead to enable readahead
authorPatrick Donnelly <pdonnell@redhat.com>
Thu, 26 May 2016 20:32:58 +0000 (16:32 -0400)
committerGreg Farnum <gfarnum@redhat.com>
Sun, 12 Jun 2016 21:07:20 +0000 (14:07 -0700)
The client was using the configured maximum readahead of 0 which was changed in
95ee69989129750fddce6a3b5644238c4b88ed74. This prevented readahead from ever
running (without setting a different default from 0).

Fixes: http://tracker.ceph.com/issues/16024
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 01c179bcce2dc8a269d78eb1be8198b12bd161f7)

Signed-off-by: Greg Farnum <gfarnum@redhat.com
src/client/Client.cc
src/common/Readahead.cc
src/common/Readahead.h

index 5d866bcb2638c34e467ef8646c57833f1f67c514..7ac0b09307f705a1e2ff792a0d6ef0eefc087c95 100644 (file)
@@ -8080,8 +8080,9 @@ int Client::_read_async(Fh *f, uint64_t off, uint64_t len, bufferlist *bl)
     len = in->size - off;    
   }
 
-  ldout(cct, 10) << " max_bytes=" << conf->client_readahead_max_bytes
-                << " max_periods=" << conf->client_readahead_max_periods << dendl;
+  ldout(cct, 10) << " min_bytes=" << f->readahead.get_min_readahead_size()
+                 << " max_bytes=" << f->readahead.get_max_readahead_size()
+                 << " max_periods=" << conf->client_readahead_max_periods << dendl;
 
   // read (and possibly block)
   int r, rvalue = 0;
@@ -8106,7 +8107,7 @@ int Client::_read_async(Fh *f, uint64_t off, uint64_t len, bufferlist *bl)
     delete onfinish;
   }
 
-  if(conf->client_readahead_max_bytes > 0) {
+  if(f->readahead.get_min_readahead_size() > 0) {
     pair<uint64_t, uint64_t> readahead_extent = f->readahead.update(off, len, in->size);
     if (readahead_extent.second > 0) {
       ldout(cct, 20) << "readahead " << readahead_extent.first << "~" << readahead_extent.second
index 34f37dad8144a4df7f5386413424f1d3d168d4e8..9318bbf545ebd2171a4a17313221f05a8ec5f2d3 100644 (file)
@@ -168,6 +168,16 @@ void Readahead::set_trigger_requests(int trigger_requests) {
   m_lock.Unlock();
 }
 
+uint64_t Readahead::get_min_readahead_size(void) {
+  Mutex::Locker lock(m_lock);
+  return m_readahead_min_bytes;
+}
+
+uint64_t Readahead::get_max_readahead_size(void) {
+  Mutex::Locker lock(m_lock);
+  return m_readahead_max_bytes;
+}
+
 void Readahead::set_min_readahead_size(uint64_t min_readahead_size) {
   m_lock.Lock();
   m_readahead_min_bytes = min_readahead_size;
index 75822c5f905441472afe7854fb3aea5cf9a75416..26b05b67a3823a2c679412c6143d1b5b5f069007 100644 (file)
@@ -78,6 +78,16 @@ public:
    */
   void set_trigger_requests(int trigger_requests);
 
+  /**
+     Gets the minimum size of a readahead request, in bytes.
+   */
+  uint64_t get_min_readahead_size(void);
+
+  /**
+     Gets the maximum size of a readahead request, in bytes.
+   */
+  uint64_t get_max_readahead_size(void);
+
   /**
      Sets the minimum size of a readahead request, in bytes.
    */