From e2ec24f61b55457caccefecd56f9f08b98264802 Mon Sep 17 00:00:00 2001 From: yaoning Date: Fri, 24 Jun 2016 09:51:07 +0800 Subject: [PATCH] os: make zero values noops for set_alloc_hint() in FileStore Signed-off-by: yaoning --- src/os/ObjectStore.h | 2 ++ src/os/filestore/FileStore.cc | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index d48c9cca39de..0176714deee9 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -1658,6 +1658,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, diff --git a/src/os/filestore/FileStore.cc b/src/os/filestore/FileStore.cc index 7939dfc195f9..861bfbd122a9 100644 --- a/src/os/filestore/FileStore.cc +++ b/src/os/filestore/FileStore.cc @@ -5423,7 +5423,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) -- 2.47.3