diff options
author | Adam C. Emerson <aemerson@linuxbox.com> | 2013-05-23 19:17:43 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-09-04 17:49:36 -0700 |
commit | 298117a9bf06b3d4263e1267b6be547f1dc847c4 (patch) | |
tree | 307082720d5e24d22fd47a4cd14fe19d3e8c3300 | |
parent | 7792907a8118f414d45b6c4e4763a5057dea656e (diff) | |
download | ceph-298117a9bf06b3d4263e1267b6be547f1dc847c4.tar.gz |
client/Client: return 1 from readdir cb on full
This appears to save us a bit of extra work trying to fill up the buffer
further than it can be filled.
Signed-off-by: Matt Benjamin <matt@linuxbox.com>
-rw-r--r-- | src/client/Client.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/client/Client.cc b/src/client/Client.cc index b35830b8594..c7f21914911 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -5034,6 +5034,8 @@ int Client::_readdir_cache_cb(dir_result_t *dirp, add_dirent_cb_t cb, void *p) prev_name = dn->name; dirp->offset = next_off; + if (r > 0) + return r; } ldout(cct, 10) << "_readdir_cache_cb " << dirp << " on " << dirp->inode->ino << " at end" << dendl; @@ -5082,6 +5084,8 @@ int Client::readdir_r_cb(dir_result_t *d, add_dirent_cb_t cb, void *p) dirp->offset = next_off; off = next_off; + if (r > 0) + return r; } if (dirp->offset == 1) { ldout(cct, 15) << " including .." << dendl; @@ -5104,6 +5108,8 @@ int Client::readdir_r_cb(dir_result_t *d, add_dirent_cb_t cb, void *p) dirp->offset = 2; off = 2; + if (r > 0) + return r; } // can we read from our cache? @@ -5156,6 +5162,8 @@ int Client::readdir_r_cb(dir_result_t *d, add_dirent_cb_t cb, void *p) off++; dirp->offset = pos + 1; + if (r > 0) + return r; } if (dirp->last_name.length()) { @@ -5225,7 +5233,7 @@ static int _readdir_single_dirent_cb(void *p, struct dirent *de, struct stat *st if (c->stmask) *c->stmask = stmask; c->full = true; - return 0; + return 1; } struct dirent *Client::readdir(dir_result_t *d) |