]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
BlueFS: add log after updating prefer_bdev field.
authorxie xingguo <xie.xingguo@zte.com.cn>
Fri, 22 Jan 2016 09:55:21 +0000 (17:55 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Wed, 3 Feb 2016 01:59:17 +0000 (09:59 +0800)
Fixes: #14474
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/bluestore/BlueFS.cc

index dbee7c809ce4e4b044ff2f13b528350af4460334..d10ee677ecc2898339bc2fa3d5bd6e621864c8b7 100644 (file)
@@ -1244,6 +1244,7 @@ int BlueFS::open_for_write(
   }
 
   FileRef file;
+  bool create = false;
   map<string,FileRef>::iterator q = dir->file_map.find(filename);
   if (q == dir->file_map.end()) {
     if (overwrite) {
@@ -1258,8 +1259,7 @@ int BlueFS::open_for_write(
     file_map[ino_last] = file;
     dir->file_map[filename] = file;
     ++file->refs;
-    log_t.op_file_update(file->fnode);
-    log_t.op_dir_link(dirname, filename, file->fnode.ino);
+    create = true;
   } else {
     // overwrite existing file?
     file = q->second;
@@ -1278,7 +1278,6 @@ int BlueFS::open_for_write(
       file->fnode.extents.clear();
     }
     file->fnode.mtime = ceph_clock_now(NULL);
-    log_t.op_file_update(file->fnode);
   }
 
   if (dirname.length() > 5) {
@@ -1299,6 +1298,10 @@ int BlueFS::open_for_write(
     }
   }
 
+  log_t.op_file_update(file->fnode);
+  if (create)
+    log_t.op_dir_link(dirname, filename, file->fnode.ino);
+
   *h = new FileWriter(file, bdev.size());
   dout(10) << __func__ << " h " << *h << " on " << file->fnode << dendl;
   return 0;