]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
librbd: create+truncate for whole-object layered discards
authorIlya Dryomov <idryomov@gmail.com>
Thu, 8 Mar 2018 16:26:27 +0000 (17:26 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Fri, 9 Mar 2018 09:18:04 +0000 (10:18 +0100)
commit0514480b16b0a1e76a9ba31cc3ba58a32b7bee18
tree8d56aa292012e19841b32bdbabae0c1b9f14a32d
parent9d6ee9a649861f1981981e41c82af8cd2914721b
librbd: create+truncate for whole-object layered discards

A whole-object layered discard is implemented as a truncate rather
than a delete: a dummy object is needed to prevent the CoW machinery
from kicking in.  However, a truncate on a non-existent object is
a no-op.  If the object doesn't exist in HEAD, a discard request is
effectively ignored -- parent blocks are still seen afterwards.

A non-exclusive create on an existing object is also a no-op, so the
fix is to do a compound create+truncate instead.

Fixes: http://tracker.ceph.com/issues/23285
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
src/librbd/io/ObjectRequest.h
src/test/librbd/io/test_mock_ObjectRequest.cc