From: Sage Weil Date: Fri, 15 Jan 2016 00:24:59 +0000 (-0500) Subject: os/FuseStore: improve readdir for omap and attr X-Git-Tag: v10.0.4~154^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F7134%2Fhead;p=ceph.git os/FuseStore: improve readdir for omap and attr Use new-style fuse readdir interface for omap and attr. We aren't particularly efficient, but we won't completely break if there are a lot of attrs or omap entries. Signed-off-by: Sage Weil --- diff --git a/src/os/FuseStore.cc b/src/os/FuseStore.cc index 1895a760d588..4d5d7e42b39f 100644 --- a/src/os/FuseStore.cc +++ b/src/os/FuseStore.cc @@ -470,8 +470,16 @@ static int os_readdir(const char *path, { set keys; fs->store->omap_get_keys(cid, oid, &keys); + unsigned skip = offset; for (auto k : keys) { - filler(buf, k.c_str(), NULL, 0); + if (skip) { + --skip; + continue; + } + ++offset; + int r = filler(buf, k.c_str(), NULL, offset); + if (r) + break; } } break; @@ -480,8 +488,16 @@ static int os_readdir(const char *path, { map aset; fs->store->getattrs(cid, oid, aset); + unsigned skip = offset; for (auto a : aset) { - filler(buf, a.first.c_str(), NULL, 0); + if (skip) { + --skip; + continue; + } + ++offset; + int r = filler(buf, a.first.c_str(), NULL, offset); + if (r) + break; } } break;