Re: [PATCH v2 3/6] block: make queue_limits_set() optionally return old limits

2025-03-18 Thread Benjamin Marzinski
On Tue, Mar 18, 2025 at 07:56:03AM +0100, Christoph Hellwig wrote: > On Mon, Mar 17, 2025 at 12:45:07AM -0400, Benjamin Marzinski wrote: > > A future device-mapper patch will make use of this new argument. No > > functional changes intended in this patch. > > If you care about the old limits just

Re: [PATC] block: update queue limits atomically

2025-03-18 Thread Mikulas Patocka
On Tue, 18 Mar 2025, Bart Van Assche wrote: > On 3/18/25 7:26 AM, Mikulas Patocka wrote: > > The block limits may be read while they are being modified. The statement > > "q->limits = *lim" is not really atomic. The compiler may turn it into > > memcpy (clang does). > > Which code reads block

Re: [PATC] block: update queue limits atomically

2025-03-18 Thread Ming Lei
On Tue, Mar 18, 2025 at 03:26:10PM +0100, Mikulas Patocka wrote: > The block limits may be read while they are being modified. The statement It is supposed to not be so for IO path, that is why queue is usually down or frozen when updating limit. For other cases, limit lock can be held for sync t

[PATCH xfstests 5/5] fsx: add fallocate write zeroes support

2025-03-18 Thread Zhang Yi
From: Zhang Yi Add fsx to suppoet fallocate FALLOC_FL_WRITE_ZEROES command by introducing OP_WRITE_ZEROES operation. Signed-off-by: Zhang Yi --- ltp/fsx.c | 80 +++ 1 file changed, 80 insertions(+) diff --git a/ltp/fsx.c b/ltp/fsx.c index 41

Re: [PATC] block: update queue limits atomically

2025-03-18 Thread Bart Van Assche
On 3/18/25 7:26 AM, Mikulas Patocka wrote: The block limits may be read while they are being modified. The statement "q->limits = *lim" is not really atomic. The compiler may turn it into memcpy (clang does). Which code reads block limits while these are being updated? This should be mentioned

Re: [PATCH v2 5/6] dm: fix dm_blk_report_zones

2025-03-18 Thread Christoph Hellwig
On Mon, Mar 17, 2025 at 12:45:09AM -0400, Benjamin Marzinski wrote: > __bind(). Otherwise the zone resources could change while accessing > them. Finally, it is possible that md->zone_revalidate_map will change > while calling this function. Only read it once, so that we are always > using the same

[RFC PATCH -next v3 07/10] fs: introduce FALLOC_FL_WRITE_ZEROES to fallocate

2025-03-18 Thread Zhang Yi
From: Zhang Yi With the development of flash-based storage devices, we can quickly write zeros to SSDs using the WRITE_ZERO command if the devices do not actually write physical zeroes to the media. Therefore, we can use this command to quickly preallocate a real all-zero file with written extent

[PATCH xfstests 3/5] generic/766: test fallocate write zeroes on block device

2025-03-18 Thread Zhang Yi
From: Zhang Yi Test the fallocate FALLOC_FL_WRITE_ZEROES command on a block device, including unsupported flags. Signed-off-by: Zhang Yi --- tests/generic/766 | 80 +++ tests/generic/766.out | 23 + 2 files changed, 103 insertions(+) cre

[RFC PATCH -next v3 02/10] nvme: set BLK_FEAT_WRITE_ZEROES_UNMAP if device supports DEAC bit

2025-03-18 Thread Zhang Yi
From: Zhang Yi When the device supports the Write Zeroes command and the DEAC bit, it indicates that the deallocate bit in the Write Zeroes command is supported, and the bytes read from a deallocated logical block are zeroes. This means the device supports unmap Write Zeroes, so set the BLK_FEAT_

[RFC PATCH -next v3 05/10] scsi: sd: set BLK_FEAT_WRITE_ZEROES_UNMAP if device supports unmap zeroing mode

2025-03-18 Thread Zhang Yi
From: Zhang Yi When the device supports the Write Zeroes command and the zeroing mode is set to SD_ZERO_WS16_UNMAP or SD_ZERO_WS10_UNMAP, this means that the device supports unmap Write Zeroes, so set the corresponding BLK_FEAT_WRITE_ZEROES_UNMAP feature to the device's queue limit. Signed-off-b

[RFC PATCH -next v3 06/10] dm: add BLK_FEAT_WRITE_ZEROES_UNMAP support

2025-03-18 Thread Zhang Yi
From: Zhang Yi Set the BLK_FEAT_WRITE_ZEROES_UNMAP feature on stacking queue limits by default. This feature shall be disabled if any underlying device does not support it. Signed-off-by: Zhang Yi --- drivers/md/dm-table.c | 7 +-- drivers/md/dm.c | 1 + 2 files changed, 6 insertions

[RFC PATCH -next v3 10/10] ext4: add FALLOC_FL_WRITE_ZEROES support

2025-03-18 Thread Zhang Yi
From: Zhang Yi Add support for FALLOC_FL_WRITE_ZEROES. This first allocates blocks as unwritten, then issues a zero command outside of the running journal handle, and finally converts them to a written state. Signed-off-by: Zhang Yi --- fs/ext4/extents.c | 59

[RFC PATCH -next v3 08/10] block: add FALLOC_FL_WRITE_ZEROES support

2025-03-18 Thread Zhang Yi
From: Zhang Yi Add support for FALLOC_FL_WRITE_ZEROES. It directly calls blkdev_issue_zeroout() with flags set to 0. The underlying process will attempt to use the fastest method for issuing zeroes. First, the block layer will try to issue a write zeroes command if the storage device supports it;

[RFC PATCH -next v3 09/10] block: factor out common part in blkdev_fallocate()

2025-03-18 Thread Zhang Yi
From: Zhang Yi Only the flags passed to blkdev_issue_zeroout() differ among the three zeroing branches in blkdev_fallocate(). Therefore, do cleanup by factoring them out. Signed-off-by: Zhang Yi --- block/fops.c | 40 +++- 1 file changed, 15 insertions(+), 2

[PATCH xfstests 4/5] fstress: add fallocate write zeroes support

2025-03-18 Thread Zhang Yi
From: Zhang Yi Add fstress to suppoet fallocate FALLOC_FL_WRITE_ZEROES command by introducing OP_WZERO operation. Signed-off-by: Zhang Yi --- ltp/fsstress.c | 12 src/global.h | 4 2 files changed, 16 insertions(+) diff --git a/ltp/fsstress.c b/ltp/fsstress.c index 3d248e

Re: [PATCH] the dm-loop target

2025-03-18 Thread Christoph Hellwig
On Tue, Mar 18, 2025 at 03:27:48PM +1100, Dave Chinner wrote: > Yes, NOWAIT may then add an incremental performance improvement on > top for optimal layout cases, but I'm still not yet convinced that > it is a generally applicable loop device optimisation that everyone > wants to always enable due

[RFC PATCH -next v3 03/10] nvme-multipath: add BLK_FEAT_WRITE_ZEROES_UNMAP support

2025-03-18 Thread Zhang Yi
From: Zhang Yi Set the BLK_FEAT_WRITE_ZEROES_UNMAP feature while creating multipath stacking queue limits by default. This feature shall be disabled if any attached namespace does not support it. Signed-off-by: Zhang Yi --- drivers/nvme/host/multipath.c | 3 ++- 1 file changed, 2 insertions(+)

[RFC PATCH -next v3 01/10] block: introduce BLK_FEAT_WRITE_ZEROES_UNMAP to queue limits features

2025-03-18 Thread Zhang Yi
From: Zhang Yi Currently, disks primarily implement the write zeroes command (aka REQ_OP_WRITE_ZEROES) through two mechanisms: the first involves physically writing zeros to the disk media (e.g., HDDs), while the second performs an unmap operation on the logical blocks, effectively putting them i

[PATCH xfsprogs] xfs_io: add FALLOC_FL_WRITE_ZEROES support

2025-03-18 Thread Zhang Yi
From: Zhang Yi The Linux kernel is planning to support FALLOC_FL_WRITE_ZEROES in fallocate(2). Add FALLOC_FL_ZERO_RANGE support to fallocate utility by introducing a new 'fwzero' command to xfs_io. Signed-off-by: Zhang Yi --- io/prealloc.c | 36 man/man

[PATCH blktests 3/3] nvme/060: add unmap write zeroes tests

2025-03-18 Thread Zhang Yi
From: Zhang Yi Test block device unmap write zeroes sysfs interface with NVMeT devices which are based on various SCSI debug devices. The /sys/block//queue/write_zeroes_unmap interface should return 1 if the NVMeT devices support the unmap write zeroes command, and it should return 0 otherwise.

[PATCH blktests 1/3] scsi/010: add unmap write zeroes tests

2025-03-18 Thread Zhang Yi
From: Zhang Yi Test block device unmap write zeroes sysfs interface with various SCSI debug devices. The /sys/block//queue/write_zeroes_unmap interface should return 1 if the SCSI device enable the WRITE SAME command with unmap functionality, and it should return 0 otherwise. Signed-off-by: Zhan

[PATCH blktests 0/3] blktest: add unmap write zeroes tests

2025-03-18 Thread Zhang Yi
From: Zhang Yi The Linux kernel is planning to support FALLOC_FL_WRITE_ZEROES in fallocate(2). Add tests for the newly added BLK_FEAT_WRITE_ZEROES_UNMAP feature flag on the block device queue limit. These tests test block device unmap write zeroes sysfs interface /sys/block//queue/write_

[PATCH util-linux] fallocate: add FALLOC_FL_WRITE_ZEROES support

2025-03-18 Thread Zhang Yi
From: Zhang Yi The Linux kernel is planning to supports FALLOC_FL_WRITE_ZEROES in fallocate(2). Add FALLOC_FL_ZERO_RANGE support to fallocate utility by introducing a new option -w|--write-zeroes. Signed-off-by: Zhang Yi --- sys-utils/fallocate.1.adoc | 11 +-- sys-utils/fallocate.c

Re: [PATCH v2 5/6] dm: fix dm_blk_report_zones

2025-03-18 Thread Damien Le Moal
On 3/19/25 7:10 AM, Benjamin Marzinski wrote: > On Tue, Mar 18, 2025 at 07:57:21AM +0100, Christoph Hellwig wrote: >> On Mon, Mar 17, 2025 at 12:45:09AM -0400, Benjamin Marzinski wrote: >>> __bind(). Otherwise the zone resources could change while accessing >>> them. Finally, it is possible that md

Re: [PATC] block: update queue limits atomically

2025-03-18 Thread Mikulas Patocka
On Tue, 18 Mar 2025, Ming Lei wrote: > On Tue, Mar 18, 2025 at 03:26:10PM +0100, Mikulas Patocka wrote: > > The block limits may be read while they are being modified. The statement > > It is supposed to not be so for IO path, that is why queue is usually down > or frozen when updating limit.

[PATC] block: update queue limits atomically

2025-03-18 Thread Mikulas Patocka
The block limits may be read while they are being modified. The statement "q->limits = *lim" is not really atomic. The compiler may turn it into memcpy (clang does). On x86-64, the kernel uses the "rep movsb" instruction for memcpy - it is optimized on modern CPUs, but it is not atomic, it may be

Re: [PATCH RFC] multipath-tools: add Generic SCSI in hwtable

2025-03-18 Thread Benjamin Marzinski
On Tue, Mar 18, 2025 at 12:08:32PM +0100, Martin Wilck wrote: > On Mon, 2025-03-17 at 16:00 -0400, Benjamin Marzinski wrote: > > On Mon, Mar 17, 2025 at 06:33:51PM +0100, Xose Vazquez Perez wrote: > > > Cc: Martin Wilck > > > Cc: Benjamin Marzinski > > > Cc: Christophe Varoqui > > > Cc: DM-DEVEL

Re: [PATC] block: update queue limits atomically

2025-03-18 Thread Ming Lei
On Tue, Mar 18, 2025 at 04:31:35PM +0100, Mikulas Patocka wrote: > > > On Tue, 18 Mar 2025, Ming Lei wrote: > > > On Tue, Mar 18, 2025 at 03:26:10PM +0100, Mikulas Patocka wrote: > > > The block limits may be read while they are being modified. The statement > > > > It is supposed to not be so

Re: [PATC] block: update queue limits atomically

2025-03-18 Thread Jens Axboe
On 3/18/25 7:22 PM, Ming Lei wrote: > On Tue, Mar 18, 2025 at 04:31:35PM +0100, Mikulas Patocka wrote: >> >> >> On Tue, 18 Mar 2025, Ming Lei wrote: >> >>> On Tue, Mar 18, 2025 at 03:26:10PM +0100, Mikulas Patocka wrote: The block limits may be read while they are being modified. The statement

Re: [PATCH v2 5/6] dm: fix dm_blk_report_zones

2025-03-18 Thread Benjamin Marzinski
On Tue, Mar 18, 2025 at 07:57:21AM +0100, Christoph Hellwig wrote: > On Mon, Mar 17, 2025 at 12:45:09AM -0400, Benjamin Marzinski wrote: > > __bind(). Otherwise the zone resources could change while accessing > > them. Finally, it is possible that md->zone_revalidate_map will change > > while calli

Re: [PATCH] multipath-tools: identify more arrays under IBM/2145 ID

2025-03-18 Thread Martin Wilck
On Thu, 2025-03-13 at 08:17 +0100, Xose Vazquez Perez wrote: > Add IBM Storage FlashSystem C200: > https://www.ibm.com/docs/en/flashsystem-c200/8.7.x_cd?topic=system-settings-linux-hosts > > Cc: Martin Wilck > Cc: Benjamin Marzinski > Cc: Christophe Varoqui > Cc: DM-DEVEL ML > Signed-off-by: X

[PATCH xfstests 2/5] generic/765: add generic tests for fallocate write zeroes

2025-03-18 Thread Zhang Yi
From: Zhang Yi Add generic tests for the fallocate FALLOC_FL_WRITE_ZEROES command. Signed-off-by: Zhang Yi --- tests/generic/765 | 40 +++ tests/generic/765.out | 269 ++ 2 files changed, 309 insertions(+) create mode 100755 tests/generic/765

Re: [PATCH v2 3/6] block: make queue_limits_set() optionally return old limits

2025-03-18 Thread Christoph Hellwig
On Mon, Mar 17, 2025 at 12:45:07AM -0400, Benjamin Marzinski wrote: > A future device-mapper patch will make use of this new argument. No > functional changes intended in this patch. If you care about the old limits just use a queue_limits_start_update + queue_limits_commit_update{,frozen} pair.