]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PrimayLogPG: update modified range to include the whole object size for write_full op 15021/head
authorrunsisi <runsisi@zte.com.cn>
Thu, 11 May 2017 13:52:49 +0000 (21:52 +0800)
committerrunsisi <runsisi@zte.com.cn>
Thu, 11 May 2017 13:54:30 +0000 (21:54 +0800)
Signed-off-by: runsisi <runsisi@zte.com.cn>
src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h

index b9fdd61c4f625b4e5436815bf3acdc4830fcf63f..53389ebc9ed07d76893463c882bbb3d1ff9fe1e3 100644 (file)
@@ -5491,7 +5491,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
        obs.oi.set_data_digest(osd_op.indata.crc32c(-1));
 
        write_update_size_and_usage(ctx->delta_stats, oi, ctx->modified_ranges,
-           0, op.extent.length, op.extent.length != oi.size ? true : false);
+           0, op.extent.length, true);
       }
       break;
 
@@ -6753,13 +6753,16 @@ void PrimaryLogPG::make_writeable(OpContext *ctx)
 
 void PrimaryLogPG::write_update_size_and_usage(object_stat_sum_t& delta_stats, object_info_t& oi,
                                               interval_set<uint64_t>& modified, uint64_t offset,
-                                              uint64_t length, bool force_changesize)
+                                              uint64_t length, bool write_full)
 {
   interval_set<uint64_t> ch;
-  if (length)
+  if (write_full) {
+    if (oi.size)
+      ch.insert(0, oi.size);
+  } else if (length)
     ch.insert(offset, length);
   modified.union_of(ch);
-  if (force_changesize || offset + length > oi.size) {
+  if (write_full || offset + length > oi.size) {
     uint64_t new_size = offset + length;
     delta_stats.num_bytes -= oi.size;
     delta_stats.num_bytes += new_size;
index 3ea4a80fe3447da73384825fb6f7af6f9d965a47..768ec934ea1128f93e0b388afd6b64e3ea1c1747 100644 (file)
@@ -1099,8 +1099,7 @@ protected:
 
   void write_update_size_and_usage(object_stat_sum_t& stats, object_info_t& oi,
                                   interval_set<uint64_t>& modified, uint64_t offset,
-                                  uint64_t length,
-                                  bool force_changesize=false);
+                                  uint64_t length, bool write_full=false);
   void add_interval_usage(interval_set<uint64_t>& s, object_stat_sum_t& st);