]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: _do_write: only use append case for aligned eof
authorSage Weil <sage@redhat.com>
Mon, 28 Mar 2016 19:35:43 +0000 (15:35 -0400)
committerSage Weil <sage@redhat.com>
Wed, 30 Mar 2016 15:23:15 +0000 (11:23 -0400)
The append case here only works if the EOF was aligned
and there is thus no partial-block zeroing we need to
do.  If the condition fails, we fall through to the
generic WAL path below.

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc

index e9b6b0f780bdfcaeca53cf18f67e60ca48dc0197..f2ac814f2feb94ae1a2c628b082ed9e778c04854 100644 (file)
@@ -5475,11 +5475,11 @@ int BlueStore::_do_write(
     assert(offset >= bp->first);
     assert(offset + length <= bp->first + bp->second.length);
 
-    // (pad and) overwrite unused portion of extent for an append?
+    // overwrite unused portion of extent for an append?
     if (offset > bp->first &&
-       offset >= o->onode.size &&                                  // past eof +
-       (offset / block_size != (o->onode.size - 1) / block_size)) {// diff block
-      dout(20) << __func__ << " append" << dendl;
+       offset >= o->onode.size &&                  // past eof +
+       (o->onode.size & ~block_mask) == 0) {       // eof was aligned
+      dout(20) << __func__ << " append after aligned eof" << dendl;
       _pad_zeros(txc, o, &bl, &offset, &length, block_size);
       assert(offset % block_size == 0);
       assert(length % block_size == 0);