From: Patrick Donnelly Date: Thu, 26 May 2016 20:32:58 +0000 (-0400) Subject: client: use fh min readahead to enable readahead X-Git-Tag: v10.2.2~7^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1ec2ef876d0e5cfe595ebb4a98fabf4958e9e937;p=ceph.git client: use fh min readahead to enable readahead 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 (cherry picked from commit 01c179bcce2dc8a269d78eb1be8198b12bd161f7) Signed-off-by: Greg Farnum 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 readahead_extent = f->readahead.update(off, len, in->size); if (readahead_extent.second > 0) { ldout(cct, 20) << "readahead " << readahead_extent.first << "~" << readahead_extent.second diff --git a/src/common/Readahead.cc b/src/common/Readahead.cc index 34f37dad8144..9318bbf545eb 100644 --- a/src/common/Readahead.cc +++ b/src/common/Readahead.cc @@ -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; diff --git a/src/common/Readahead.h b/src/common/Readahead.h index 75822c5f9054..26b05b67a382 100644 --- a/src/common/Readahead.h +++ b/src/common/Readahead.h @@ -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. */