]> git-server-git.apps.pok.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)
committerPatrick Donnelly <pdonnell@redhat.com>
Fri, 10 Jun 2016 21:33:13 +0000 (17:33 -0400)
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>
src/client/Client.cc
src/common/Readahead.cc
src/common/Readahead.h

index 37fcf235f058c1533fc58611761b2810fe2975f1..3e5822d59e586fa574ebf1326aa55d9261c91569 100644 (file)
@@ -8165,8 +8165,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;
@@ -8191,7 +8192,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.
    */