From 08f3efb47492baa0dc765080a208cde7d85f972c Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 23 Apr 2015 16:10:32 -0700 Subject: [PATCH] Revert "os/NewStore: data_map shouldn't be empty when writing all overlays" This reverts commit 0d9cce462fec61f754ddcd17cf9a3cf69581d7c5. We may want to write an overlay if hte object is new and the write is small to defer the cost of the fsync. --- src/os/newstore/NewStore.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/os/newstore/NewStore.cc b/src/os/newstore/NewStore.cc index 75ba0bd93e138..33c322a2c2360 100644 --- a/src/os/newstore/NewStore.cc +++ b/src/os/newstore/NewStore.cc @@ -3175,6 +3175,20 @@ int NewStore::_do_write_all_overlays(TransContext *txc, if (o->onode.overlay_map.empty()) return 0; + // overwrite to new fid + if (o->onode.data_map.empty()) { + // create + fragment_t &f = o->onode.data_map[0]; + f.offset = 0; + f.length = o->onode.size; + int fd = _create_fid(txc, &f.fid, O_RDWR); + if (fd < 0) { + return fd; + } + VOID_TEMP_FAILURE_RETRY(::close(fd)); + dout(20) << __func__ << " create " << f.fid << dendl; + } + assert(o->onode.data_map.size() == 1); fragment_t& f = o->onode.data_map.begin()->second; assert(f.offset == 0); -- 2.39.5