]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "os/NewStore: data_map shouldn't be empty when writing all overlays"
authorSage Weil <sage@redhat.com>
Thu, 23 Apr 2015 23:10:32 +0000 (16:10 -0700)
committerSage Weil <sage@redhat.com>
Tue, 1 Sep 2015 17:39:42 +0000 (13:39 -0400)
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

index 75ba0bd93e13888bcd423b2e5dad0b050e6d127f..33c322a2c2360fc62cfab7f51193e420bfbcb7e5 100644 (file)
@@ -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);