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.
(derived from commit
0514480b16b0a1e76a9ba31cc3ba58a32b7bee18)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
protected:
virtual void add_write_ops(librados::ObjectWriteOperation *wr) {
if (has_parent()) {
+ wr->create(false);
wr->truncate(0);
} else {
wr->remove();
virtual const char* get_write_type() const {
if (has_parent()) {
- return "remove (trunc)";
+ return "remove (create+trunc)";
}
return "remove";
}