From: Sage Weil Date: Thu, 23 Apr 2015 23:10:32 +0000 (-0700) Subject: Revert "os/NewStore: data_map shouldn't be empty when writing all overlays" X-Git-Tag: v9.1.0~242^2~27 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=08f3efb47492baa0dc765080a208cde7d85f972c;p=ceph.git 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. --- diff --git a/src/os/newstore/NewStore.cc b/src/os/newstore/NewStore.cc index 75ba0bd93e1..33c322a2c23 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);