]> www.infradead.org Git - users/hch/xfstests-dev.git/commit
logwrites: warn if we don't think read after discard returns zeroes
authorDarrick J. Wong <djwong@kernel.org>
Thu, 21 Nov 2024 17:59:39 +0000 (09:59 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 23 Jan 2025 21:19:53 +0000 (13:19 -0800)
commit5e13040bc4557c3a6a82615ed972943f9b642a9d
treebacccb9e4393d64dc0d8585825c7ffd85372be4a
parent5d06784664f0c391d74ff11af207131b67f635eb
logwrites: warn if we don't think read after discard returns zeroes

The logwrites replay program expects that it can issue a DISCARD against
the block device passed to _log_writes_init and that will cause all
subsequent reads to return zeroes.  This is required for correct log
recovery on filesystems such as XFS that skip recovering buffers if
newer ones are found on disk.

Unfortunately, there's no way to discover if a device's discard
implementation actually guarantees zeroes.  There used to be a sysfs
knob keyed to an allowlist, but it is now hardwired to return 0.  So
either we need a magic device that does discard-and-zero, or we need to
do the zeroing ourselves.  The logwrites program does its own zeroing if
there is no discard support, and some tests do their own zeroing.

The only devices we know to work reliably are the software defined ones
that are provided by the kernel itself -- which means dm-thinp.  Warn if
we have a device that supports discard that isn't thinp and the test
fails.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
common/dmlogwrites