]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/PrimaryLogPG: fix SPARSE_READ stat
authorYan Jun <yan.jun8@zte.com.cn>
Fri, 27 Mar 2020 01:49:05 +0000 (09:49 +0800)
committerYan Jun <yan.jun8@zte.com.cn>
Fri, 27 Mar 2020 01:49:35 +0000 (09:49 +0800)
22960192 use readv to reimplement SPARSE_READ, however it is
still using total_read to accumulate total bytes it reads from
bluestore, which is always zero in code.

Fix by dropping the redundant local total_read counter.
By definition objects_readv_sync should return the correct bytes
it has read. Use that instead.

Signed-off-by: Yan Jun <yan.jun8@zte.com.cn>
src/osd/PrimaryLogPG.cc

index 873dd906e5131779d9dc0dafd6a7920dadab2d7a..9be2e33f0ece17b4212c8604a08125d8e341b7a4 100644 (file)
@@ -5591,7 +5591,6 @@ int PrimaryLogPG::do_sparse_read(OpContext *ctx, OSDOp& osd_op) {
   } else {
     // read into a buffer
     map<uint64_t, uint64_t> m;
-    uint32_t total_read = 0;
     int r = osd->store->fiemap(ch, ghobject_t(soid, ghobject_t::NO_GEN,
                                              info.pgid.shard),
                               op.extent.offset, op.extent.length, m);
@@ -5626,7 +5625,7 @@ int PrimaryLogPG::do_sparse_read(OpContext *ctx, OSDOp& osd_op) {
       }
     }
 
-    op.extent.length = total_read;
+    op.extent.length = r;
 
     encode(m, osd_op.outdata); // re-encode since it might be modified
     ::encode_destructively(data_bl, osd_op.outdata);