]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: PGBackend::write() alters object size now.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 27 Aug 2019 19:32:16 +0000 (21:32 +0200)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Fri, 13 Sep 2019 18:28:09 +0000 (20:28 +0200)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/osd/pg_backend.cc

index 2d28ab9081567cf8b679fae9d47fc9595d52f7ed..1308c2b7415970e9ac4d917b707d7399655af2fc 100644 (file)
@@ -309,7 +309,11 @@ seastar::future<> PGBackend::write(
     // write arrives before trimtrunc
     if (os.exists && !os.oi.is_whiteout()) {
       txn.truncate(coll->get_cid(),
-                  ghobject_t{os.oi.soid}, op.extent.truncate_size);
+                   ghobject_t{os.oi.soid}, op.extent.truncate_size);
+      if (op.extent.truncate_size != os.oi.size) {
+        os.oi.size = length;
+        // TODO: truncate_update_size_and_usage()
+      }
     }
     os.oi.truncate_seq = op.extent.truncate_seq;
     os.oi.truncate_size = op.extent.truncate_size;
@@ -324,6 +328,7 @@ seastar::future<> PGBackend::write(
   } else {
     txn.write(coll->get_cid(), ghobject_t{os.oi.soid},
              offset, length, std::move(buf), op.flags);
+    os.oi.size = std::max(offset + length, os.oi.size);
   }
   return seastar::now();
 }