[Devel] [PATCH hci-8.1 2/2] dm-zero-rq: drop flushes, discards and write zeroes instead of failing them

Konstantin Khorenko khorenko at virtuozzo.com
Thu Oct 29 20:40:32 MSK 2026


On 10/28/26 13:31, Denis V. Lunev wrote:
> dm-zero-rq: drop flushes, discards and write zeroes instead of failing them

Will commit, with three edits to the message only, the code is fine.

1. Subject: "write zeroes" dropped, so

   dm-zero-rq: complete flushes and discards instead of failing them

   No table in our tree sets num_write_zeroes_bios (ploop, qcow2, error,
   zero-rq), so max_write_zeroes_sectors is 0 everywhere and
   submit_bio_noacct() rejects such a bio before a request exists. The
   case label is harmless, but no write zeroes request can be queued
   against a previous table. The old subject was also 75 characters.

> table swap therefore fail, a flush with an error returned to the
> syncing task and a discard with an I/O error in the log:

2. sync(2) returns void, the error reaches fsync()/syncfs() and the jbd2
   commit, which aborts the journal. And a killed flush leaves an I/O
   error line in the log too, for the PREFLUSH request that waited on it
   (blk_flush_complete_seq() -> blk_mq_end_request()). So: "a flush with
   an error returned to fsync and to the journal commit, and both with
   an I/O error in the log".

> num_discard_bios from the constructor: it only matters to bio-based
> targets and to targets that pass discards through to a device, and
> zero-rq is neither, so "silently drop discards" above it never held.

3. dm_table_supports_discards() also honours a target that sets
   discards_supported without any device, which is what error, ploop,
   qcow2 and mainline dm-zero do. The assignment was dead because zero-rq
   never set discards_supported, not because it is request-based. I will
   say that instead.

Reviewed-by: Konstantin Khorenko <khorenko at virtuozzo.com>

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team



More information about the Devel mailing list