]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
FileStore: remove user_only options from getattrs through the ObjectStore stack
authorGreg Farnum <greg@inktank.com>
Tue, 20 May 2014 18:07:45 +0000 (11:07 -0700)
committerGreg Farnum <greg@inktank.com>
Wed, 11 Jun 2014 17:48:59 +0000 (10:48 -0700)
This sort of awareness belongs at a higher level in the stack -- as
evidenced by nobody using the option at this level. Remove it from the
implementations and the interface

Signed-off-by: Greg Farnum <greg@inktank.com>
src/os/FileStore.cc
src/os/FileStore.h
src/os/KeyValueStore.cc
src/os/KeyValueStore.h
src/os/MemStore.cc
src/os/MemStore.h
src/os/ObjectStore.h
src/tools/ceph_filestore_dump.cc

index b8967a8b6609627dd6658ff1dd5694f6f286ef98..6561fe92a6bdf0275c64de428dd96cb93e0172f3 100644 (file)
@@ -3700,7 +3700,7 @@ int FileStore::getattr(coll_t cid, const ghobject_t& oid, const char *name, buff
   }
 }
 
-int FileStore::getattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr>& aset, bool user_only)
+int FileStore::getattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr>& aset)
 {
   set<string> omap_attrs;
   map<string, bufferlist> omap_aset;
@@ -3719,7 +3719,7 @@ int FileStore::getattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr>
   if (r >= 0 && !strncmp(buf, XATTR_NO_SPILL_OUT, sizeof(XATTR_NO_SPILL_OUT)))
     spill_out = false;
 
-  r = _fgetattrs(**fd, aset, user_only);
+  r = _fgetattrs(**fd, aset, false);
   if (r < 0) {
     goto out;
   }
@@ -3752,16 +3752,7 @@ int FileStore::getattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr>
   for (map<string, bufferlist>::iterator i = omap_aset.begin();
         i != omap_aset.end();
         ++i) {
-    string key;
-    if (user_only) {
-       if (i->first[0] != '_')
-         continue;
-       if (i->first == "_")
-         continue;
-       key = i->first.substr(1, i->first.size());
-    } else {
-       key = i->first;
-    }
+    string key(i->first);
     aset.insert(make_pair(key,
                            bufferptr(i->second.c_str(), i->second.length())));
   }
index 941b8d240aeed4818e320266269132f99d5c532e..30d6dc90b93da8741388a260b6d9b12efb42a261 100644 (file)
@@ -494,7 +494,7 @@ public:
 
   // attrs
   int getattr(coll_t cid, const ghobject_t& oid, const char *name, bufferptr &bp);
-  int getattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr>& aset, bool user_only = false);
+  int getattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr>& aset);
 
   int _setattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr>& aset,
                const SequencerPosition &spos);
index 08af6391196d0393892848acfa8f21dada1ec2cb..598556acc3b65256532037fe678419fc45b4d305 100644 (file)
@@ -2019,7 +2019,7 @@ int KeyValueStore::getattr(coll_t cid, const ghobject_t& oid, const char *name,
 }
 
 int KeyValueStore::getattrs(coll_t cid, const ghobject_t& oid,
-                           map<string,bufferptr>& aset, bool user_only)
+                           map<string,bufferptr>& aset)
 {
   int r;
   map<string, bufferlist> attr_aset;
@@ -2036,15 +2036,7 @@ int KeyValueStore::getattrs(coll_t cid, const ghobject_t& oid,
   for (map<string, bufferlist>::iterator i = attr_aset.begin();
        i != attr_aset.end(); ++i) {
     string key;
-    if (user_only) {
-      if (i->first[0] != '_')
-        continue;
-      if (i->first == "_")
-        continue;
-      key = i->first.substr(1, i->first.size());
-    } else {
-      key = i->first;
-    }
+    key = i->first;
     aset.insert(make_pair(key,
                 bufferptr(i->second.c_str(), i->second.length())));
   }
index 02574596954a77bcba5bb300310dd10651058fbc..1c6981501e798792aa6397ac575d98fa83390a43 100644 (file)
@@ -491,8 +491,7 @@ class KeyValueStore : public ObjectStore,
   // attrs
   int getattr(coll_t cid, const ghobject_t& oid, const char *name,
               bufferptr &bp);
-  int getattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr>& aset,
-               bool user_only = false);
+  int getattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr>& aset);
 
   int _setattrs(coll_t cid, const ghobject_t& oid,
                 map<string, bufferptr>& aset, BufferTransaction &t);
index fa75542be425f33e28ab6ca24c86ccecc38fae32..cdef5b51d9c77b4ffc40b99051d169dc1734edad 100644 (file)
@@ -358,7 +358,7 @@ int MemStore::getattr(coll_t cid, const ghobject_t& oid,
 }
 
 int MemStore::getattrs(coll_t cid, const ghobject_t& oid,
-                      map<string,bufferptr>& aset, bool user_only)
+                      map<string,bufferptr>& aset)
 {
   dout(10) << __func__ << " " << cid << " " << oid << dendl;
   CollectionRef c = get_collection(cid);
@@ -369,17 +369,7 @@ int MemStore::getattrs(coll_t cid, const ghobject_t& oid,
   ObjectRef o = c->get_object(oid);
   if (!o)
     return -ENOENT;
-  if (user_only) {
-    for (map<string,bufferptr>::iterator p = o->xattr.begin();
-        p != o->xattr.end();
-        ++p) {
-      if (p->first.length() > 1 && p->first[0] == '_') {
-       aset[p->first.substr(1)] = p->second;
-      }
-    }
-  } else {
-    aset = o->xattr;
-  }
+  aset = o->xattr;
   return 0;
 }
 
index c33dd04ca9353e217c96b987a73be84585a0ac80..77170b82f69b5e9c6e2703bad4cd915bdd27fd05 100644 (file)
@@ -281,7 +281,7 @@ public:
     bool allow_eio = false);
   int fiemap(coll_t cid, const ghobject_t& oid, uint64_t offset, size_t len, bufferlist& bl);
   int getattr(coll_t cid, const ghobject_t& oid, const char *name, bufferptr& value);
-  int getattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr>& aset, bool user_only = false);
+  int getattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr>& aset);
 
   int list_collections(vector<coll_t>& ls);
   bool collection_exists(coll_t c);
index 6e9a122f589651fb5617f3e3942e3bbba2a5d628..1a7645938d6c6b0412a427a5afd366a59886fa46 100644 (file)
@@ -1342,10 +1342,9 @@ public:
    * @param cid collection for object
    * @param oid oid of object
    * @param aset place to put output result.
-   * @param user_only true -> only user attributes are return else all attributes are returned
    * @returns 0 on success, negative error code on failure.
    */
-  virtual int getattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr>& aset, bool user_only = false) = 0;
+  virtual int getattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr>& aset) = 0;
 
   /**
    * getattrs -- get all of the xattrs of an object
@@ -1353,12 +1352,11 @@ public:
    * @param cid collection for object
    * @param oid oid of object
    * @param aset place to put output result.
-   * @param user_only true -> only user attributes are return else all attributes are returned
    * @returns 0 on success, negative error code on failure.
    */
-  int getattrs(coll_t cid, const ghobject_t& oid, map<string,bufferlist>& aset, bool user_only = false) {
+  int getattrs(coll_t cid, const ghobject_t& oid, map<string,bufferlist>& aset) {
     map<string,bufferptr> bmap;
-    int r = getattrs(cid, oid, bmap, user_only);
+    int r = getattrs(cid, oid, bmap);
     for (map<string,bufferptr>::iterator i = bmap.begin();
        i != bmap.end();
        ++i) {
index 7ea6395b5d8f99309e223e8ae84a04b93cec283d..425dd68b39570008fb6ca268087fd9c135e88400 100644 (file)
@@ -625,7 +625,7 @@ int export_file(ObjectStore *store, coll_t cid, ghobject_t &obj)
 
   //Handle attrs for this object
   map<string,bufferptr> aset;
-  ret = store->getattrs(cid, obj, aset, false);
+  ret = store->getattrs(cid, obj, aset);
   if (ret) return ret;
   attr_section as(aset);
   ret = write_section(TYPE_ATTRS, as, file_fd);