From bb4e3a9fbc9f5d8fc9280e707927573efea81f98 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Tue, 20 May 2014 11:07:45 -0700 Subject: [PATCH] FileStore: remove user_only options from getattrs through the ObjectStore stack 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 --- src/os/FileStore.cc | 15 +++------------ src/os/FileStore.h | 2 +- src/os/KeyValueStore.cc | 12 ++---------- src/os/KeyValueStore.h | 3 +-- src/os/MemStore.cc | 14 ++------------ src/os/MemStore.h | 2 +- src/os/ObjectStore.h | 8 +++----- src/tools/ceph_filestore_dump.cc | 2 +- 8 files changed, 14 insertions(+), 44 deletions(-) diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index b8967a8b66096..6561fe92a6bdf 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -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& aset, bool user_only) +int FileStore::getattrs(coll_t cid, const ghobject_t& oid, map& aset) { set omap_attrs; map omap_aset; @@ -3719,7 +3719,7 @@ int FileStore::getattrs(coll_t cid, const ghobject_t& oid, map 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 for (map::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()))); } diff --git a/src/os/FileStore.h b/src/os/FileStore.h index 941b8d240aeed..30d6dc90b93da 100644 --- a/src/os/FileStore.h +++ b/src/os/FileStore.h @@ -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& aset, bool user_only = false); + int getattrs(coll_t cid, const ghobject_t& oid, map& aset); int _setattrs(coll_t cid, const ghobject_t& oid, map& aset, const SequencerPosition &spos); diff --git a/src/os/KeyValueStore.cc b/src/os/KeyValueStore.cc index 08af6391196d0..598556acc3b65 100644 --- a/src/os/KeyValueStore.cc +++ b/src/os/KeyValueStore.cc @@ -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& aset, bool user_only) + map& aset) { int r; map attr_aset; @@ -2036,15 +2036,7 @@ int KeyValueStore::getattrs(coll_t cid, const ghobject_t& oid, for (map::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()))); } diff --git a/src/os/KeyValueStore.h b/src/os/KeyValueStore.h index 02574596954a7..1c6981501e798 100644 --- a/src/os/KeyValueStore.h +++ b/src/os/KeyValueStore.h @@ -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& aset, - bool user_only = false); + int getattrs(coll_t cid, const ghobject_t& oid, map& aset); int _setattrs(coll_t cid, const ghobject_t& oid, map& aset, BufferTransaction &t); diff --git a/src/os/MemStore.cc b/src/os/MemStore.cc index fa75542be425f..cdef5b51d9c77 100644 --- a/src/os/MemStore.cc +++ b/src/os/MemStore.cc @@ -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& aset, bool user_only) + map& 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::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; } diff --git a/src/os/MemStore.h b/src/os/MemStore.h index c33dd04ca9353..77170b82f69b5 100644 --- a/src/os/MemStore.h +++ b/src/os/MemStore.h @@ -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& aset, bool user_only = false); + int getattrs(coll_t cid, const ghobject_t& oid, map& aset); int list_collections(vector& ls); bool collection_exists(coll_t c); diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index 6e9a122f58965..1a7645938d6c6 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -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& aset, bool user_only = false) = 0; + virtual int getattrs(coll_t cid, const ghobject_t& oid, map& 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& aset, bool user_only = false) { + int getattrs(coll_t cid, const ghobject_t& oid, map& aset) { map bmap; - int r = getattrs(cid, oid, bmap, user_only); + int r = getattrs(cid, oid, bmap); for (map::iterator i = bmap.begin(); i != bmap.end(); ++i) { diff --git a/src/tools/ceph_filestore_dump.cc b/src/tools/ceph_filestore_dump.cc index 7ea6395b5d8f9..425dd68b39570 100644 --- a/src/tools/ceph_filestore_dump.cc +++ b/src/tools/ceph_filestore_dump.cc @@ -625,7 +625,7 @@ int export_file(ObjectStore *store, coll_t cid, ghobject_t &obj) //Handle attrs for this object map 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); -- 2.39.5