]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os: make zero values noops for set_alloc_hint() in FileStore 13647/head
authoryaoning <yaoning@unitedstack.com>
Fri, 24 Jun 2016 01:51:07 +0000 (09:51 +0800)
committerNing Yao <yaoning@unitedstack.com>
Wed, 26 Apr 2017 16:14:01 +0000 (16:14 +0000)
Signed-off-by: yaoning <yaoning@unitedstack.com>
(cherry picked from commit e2ec24f61b55457caccefecd56f9f08b98264802)

src/os/ObjectStore.h
src/os/filestore/FileStore.cc
src/osd/osd_types.cc

index 93ae4bb4a348e8af54b4881ee13e508283b5b262..ae0584da3aac479a9d8564af064840e583f1fc64 100644 (file)
@@ -1718,6 +1718,8 @@ public:
       data.ops++;
     }
 
+    /// Set allocation hint for an object
+    /// make 0 values(expected_object_size, expected_write_size) noops for all implementations
     void set_alloc_hint(
       coll_t cid,
       const ghobject_t &oid,
index ce1cfe262046c382b06823091b8783af37f435f4..9196bfbb172ac242cf3e7aa169c1b740be697b08 100644 (file)
@@ -5494,7 +5494,10 @@ int FileStore::_set_alloc_hint(const coll_t& cid, const ghobject_t& oid,
   dout(15) << "set_alloc_hint " << cid << "/" << oid << " object_size " << expected_object_size << " write_size " << expected_write_size << dendl;
 
   FDRef fd;
-  int ret;
+  int ret = 0;
+
+  if (expected_object_size == 0 || expected_write_size == 0)
+    goto out;
 
   ret = lfn_open(cid, oid, false, &fd);
   if (ret < 0)
index 6035e4217b99067703ee6f1e3109bca07c703031..eeb10dbb8cf8030fa2f662f1ee7889aafc4b7dce 100644 (file)
@@ -4754,6 +4754,7 @@ void object_info_t::encode(bufferlist& bl) const
   ::encode(omap_digest, bl);
   ::encode(expected_object_size, bl);
   ::encode(expected_write_size, bl);
+  ::encode(alloc_hint_flags, bl);
   ENCODE_FINISH(bl);
 }
 
@@ -4836,9 +4837,11 @@ void object_info_t::decode(bufferlist::iterator& bl)
   if (struct_v >= 16) {
     ::decode(expected_object_size, bl);
     ::decode(expected_write_size, bl);
+    ::decode(alloc_hint_flags, bl);
   } else {
     expected_object_size = 0;
     expected_write_size = 0;
+    alloc_hint_flags = 0;
   }
   DECODE_FINISH(bl);
 }