Files
Haoqian He 5689c59055 block/mirror: inherit the source node discard flag in mirror_top
mirror_start_job() inserts a mirror_top filter above the source node
for both mirror and active commit jobs. Previously, the filter was
opened with BDRV_O_RDWR only, even when the source had BDRV_O_UNMAP
enabled.

The block layer checks BDRV_O_UNMAP before invoking a node's discard
callback. Without this flag on mirror_top, discard requests return
success without reaching bdrv_mirror_top_pdiscard(). Consequently,
starting a job can silently suppress guest UNMAP/TRIM requests that
would otherwise reach the discard-enabled source.

Initialize the filter's open flags with BDRV_O_RDWR and conditionally
add BDRV_O_UNMAP from bs->open_flags. Pass the resulting flags to
bdrv_new_open_driver() so that mirror_top follows the source node's
discard setting.

This allows discard requests to reach the existing filter callback,
which forwards them to the source and either tracks the affected
range in the dirty bitmap or synchronously propagates the discard
to the target, depending on the copy mode.

Signed-off-by: Haoqian He <haoqian.he@smartx.com>
Message-ID: <20261013060549.3008438-1-haoqian.he@smartx.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
2026-10-16 09:46:54 +03:00
..
2026-05-19 17:25:48 +02:00
2025-11-11 22:06:09 +01:00
2025-03-06 14:21:25 +01:00
2026-07-23 18:03:24 +03:00
2026-03-10 14:33:55 +01:00
2025-11-18 18:01:57 +01:00
2025-12-15 09:50:41 -05:00
2023-11-08 17:56:18 +01:00
2023-11-08 17:56:18 +01:00