]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/FuseStore: improve readdir for omap and attr 7134/head
authorSage Weil <sage@redhat.com>
Fri, 15 Jan 2016 00:24:59 +0000 (19:24 -0500)
committerSage Weil <sage@redhat.com>
Wed, 27 Jan 2016 19:06:15 +0000 (14:06 -0500)
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 <sage@redhat.com>
src/os/FuseStore.cc

index 1895a760d5885e56c3c31f9c1962d09dd774fbb9..4d5d7e42b39fa1909eb714fd19348cbe86479d62 100644 (file)
@@ -470,8 +470,16 @@ static int os_readdir(const char *path,
     {
       set<string> 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<string,bufferptr> 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;