Re: [dm-devel] [PATCH v2 4/4] brd: implement secure erase and write zeroes

2022-09-20 Thread Chaitanya Kulkarni
> /* > @@ -300,23 +303,34 @@ out: > > void brd_do_discard(struct brd_device *brd, struct bio *bio) > { > - sector_t sector, len, front_pad; > + bool zero_padding; > + sector_t sector, len, front_pad, end_pad; > > if (unlikely(!discard)) { >

Re: [dm-devel] [PATCH v2 1/4] brd: make brd_insert_page return bool

2022-09-20 Thread Chaitanya Kulkarni
On 9/20/22 10:53, Mikulas Patocka wrote: > brd_insert_page returns a pointer to struct page, however the pointer is > never used (it is only compared against NULL), so to clean-up the code, we > make it return bool. > > Signed-off-by: Mikulas Patocka > Reviewed-by: Christoph Hellwig > > ---

[dm-devel] [PATCH v2 4/4] brd: implement secure erase and write zeroes

2022-09-20 Thread Mikulas Patocka
This patch implements REQ_OP_SECURE_ERASE and REQ_OP_WRITE_ZEROES on brd. Write zeroes will free the pages just like discard, but the difference is that it writes zeroes to the preceding and following page if the range is not aligned on page boundary. Secure erase is just like write zeroes, except

[dm-devel] [PATCH v2 3/4] brd: enable discard

2022-09-20 Thread Mikulas Patocka
This patch implements discard in the brd driver. We use RCU to free the page, so that if there are any concurrent readers or writes, they won't touch the page after it is freed. Signed-off-by: Mikulas Patocka --- drivers/block/brd.c | 64 +++-

[dm-devel] [PATCH v2 2/4] brd: extend the rcu regions to cover read and write

2022-09-20 Thread Mikulas Patocka
This patch extends the rcu regions, so that lookup followed by a read or write of a page is done inside rcu read lock. This si be needed for the following patch that enables discard. Note that we also replace "BUG_ON(!page);" with "if (page) ..." in copy_to_brd - the page may be NULL if write

[dm-devel] [PATCH v2 1/4] brd: make brd_insert_page return bool

2022-09-20 Thread Mikulas Patocka
brd_insert_page returns a pointer to struct page, however the pointer is never used (it is only compared against NULL), so to clean-up the code, we make it return bool. Signed-off-by: Mikulas Patocka Reviewed-by: Christoph Hellwig --- drivers/block/brd.c | 16 1 file

[dm-devel] [PATCH v2 0/4] brd: implement discard

2022-09-20 Thread Mikulas Patocka
Hi Here I'm sending second version of the brd discard patches. Mikulas -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH 3/4] brd: enable discard

2022-09-20 Thread Mikulas Patocka
On Tue, 20 Sep 2022, Christoph Hellwig wrote: > > @@ -289,6 +308,23 @@ static void brd_submit_bio(struct bio *b > > struct bio_vec bvec; > > struct bvec_iter iter; > > > > + if (bio_op(bio) == REQ_OP_DISCARD) { > > + sector_t len = bio_sectors(bio); > > +

Re: [dm-devel] [PATCH 4/4] brd: implement secure erase and write zeroes

2022-09-20 Thread Mikulas Patocka
On Tue, 20 Sep 2022, Christoph Hellwig wrote: > On Fri, Sep 16, 2022 at 05:00:46AM -0400, Mikulas Patocka wrote: > > This patch implements REQ_OP_SECURE_ERASE and REQ_OP_WRITE_ZEROES on brd. > > Write zeroes will free the pages just like discard, but the difference is > > that it writes zeroes

Re: [dm-devel] [PATCH RFC 0/8] Introduce provisioning primitives for thinly provisioned storage

2022-09-20 Thread Christoph Hellwig
On Tue, Sep 20, 2022 at 08:17:10PM +1000, Daniil Lunev wrote: > to WRITE ZERO command in NVMe, but to WRITE UNAVAILABLE in There is no such thing as WRITE UNAVAILABLE in NVMe. > NVME 2.0 spec, and to UNMAP ANCHORED in SCSI spec. The SCSI anchored LBA state is quite complicated, and in addition

Re: [dm-devel] [PATCH V2 0/6] allowing path checking to be interrupted.

2022-09-20 Thread Wu Guanghao
在 2022/9/16 2:17, Benjamin Marzinski 写道: > On Thu, Sep 15, 2022 at 02:56:36PM +0800, Wu Guanghao wrote: >> Sorry for the late feedback. >> >> The version we are currently testing is 0.8.4, so we only merge the >> first 3 patches in this series of patches. Then after the actual test, >> it was

[dm-devel] [PATCH v14 09/13] dm-zone: use generic helpers to calculate offset from zone start

2022-09-20 Thread Pankaj Raghav
Use the bdev_offset_from_zone_start() helper function to calculate the offset from zone start instead of using power of 2 based calculation. Signed-off-by: Pankaj Raghav Reviewed-by: Luis Chamberlain Reviewed-by: Damien Le Moal Reviewed-by: Bart Van Assche Reviewed-by: Johannes Thumshirn

[dm-devel] [PATCH v14 02/13] block: rearrange bdev_{is_zoned, zone_sectors, get_queue} helper in blkdev.h

2022-09-20 Thread Pankaj Raghav
Define bdev_is_zoned(), bdev_zone_sectors() and bdev_get_queue() earlier in the blkdev.h include file. Simplify bdev_is_zoned() by removing the superfluous NULL check for request queue while we are at it. This commit has no functional change, and it is a prep patch for allowing zoned devices with

[dm-devel] [PATCH v14 12/13] dm: introduce DM_EMULATED_ZONES target feature flag

2022-09-20 Thread Pankaj Raghav
Introduce a new target feature flag: DM_EMULATED_ZONES for targets with a different number of sectors per zone (aka zone size) than the underlying device zone size. This target feature flag is introduced as the existing zoned targets assume that the target and the underlying device have the same

[dm-devel] [PATCH v14 13/13] dm: add power-of-2 target for zoned devices with non power-of-2 zone sizes

2022-09-20 Thread Pankaj Raghav
Only zoned devices with power-of-2(po2) number of sectors per zone(zone size) were supported in linux but now non power-of-2(npo2) zone sizes support has been added to the block layer. Filesystems such as F2FS and btrfs have support for zoned devices with po2 zone size assumption. Before adding

[dm-devel] [PATCH v14 10/13] dm-table: allow zoned devices with non power-of-2 zone sizes

2022-09-20 Thread Pankaj Raghav
Allow dm to support zoned devices with non power-of-2(po2) zone sizes as the block layer now supports it. Signed-off-by: Pankaj Raghav Reviewed-by: Bart Van Assche Reviewed-by: Damien Le Moal Reviewed-by: Johannes Thumshirn Reviewed-by: Mike Snitzer --- drivers/md/dm-table.c | 7 +++ 1

[dm-devel] [PATCH v14 11/13] dm: call dm_zone_endio after the target endio callback for zoned devices

2022-09-20 Thread Pankaj Raghav
dm_zone_endio() updates the bi_sector of orig bio for zoned devices that uses either native append or append emulation, and it is called before the endio of the target. But target endio can still update the clone bio after dm_zone_endio is called, thereby, the orig bio does not contain the updated

[dm-devel] [PATCH v14 04/13] nvmet: Allow ZNS target to support non-power_of_2 zone sizes

2022-09-20 Thread Pankaj Raghav
A generic bdev_zone_no() helper is added to calculate zone number for a given sector in a block device. This helper internally uses disk_zone_no() to find the zone number. Use the helper bdev_zone_no() to calculate nr of zones. This let's us make modifications to the math if needed in one place

[dm-devel] [PATCH v14 07/13] zonefs: allow non power of 2 zoned devices

2022-09-20 Thread Pankaj Raghav
The zone size shift variable is useful only if the zone sizes are known to be power of 2. Remove that variable and use generic helpers from block layer to calculate zone index in zonefs. Acked-by: Damien Le Moal Reviewed-by: Luis Chamberlain Reviewed-by: Johannes Thumshirn Reviewed-by:

[dm-devel] [PATCH v14 08/13] dm-zoned: ensure only power of 2 zone sizes are allowed

2022-09-20 Thread Pankaj Raghav
From: Luis Chamberlain dm-zoned relies on the assumption that the zone size is a power-of-2(po2) and the zone capacity is same as the zone size. Ensure only po2 devices can be used as dm-zoned target until a native support for zoned devices with non-po2 zone size is added. Reviewed-by: Hannes

[dm-devel] [PATCH v14 06/13] null_blk: allow zoned devices with non power-of-2 zone sizes

2022-09-20 Thread Pankaj Raghav
Convert the power-of-2(po2) based calculation with zone size to be generic in null_zone_no with optimization for po2 zone sizes. The nr_zones calculation in null_init_zoned_dev has been replaced with a division without special handling for po2 zone sizes as this function is called only during the

[dm-devel] [PATCH v14 05/13] nvme: zns: Allow ZNS drives that have non-power_of_2 zone size

2022-09-20 Thread Pankaj Raghav
Remove the condition which disallows non-power_of_2 zone size ZNS drive to be updated and use generic method to calculate number of zones instead of relying on log and shift based calculation on zone size. The power_of_2 calculation has been replaced directly with generic calculation without

[dm-devel] [PATCH v14 03/13] block: allow blk-zoned devices to have non-power-of-2 zone size

2022-09-20 Thread Pankaj Raghav
Checking if a given sector is aligned to a zone is a common operation that is performed for zoned devices. Add bdev_is_zone_start helper to check for this instead of opencoding it everywhere. Convert the calculations on zone size to be generic instead of relying on power-of-2(po2) based

[dm-devel] [PATCH v14 00/13] support zoned block devices with non-power-of-2 zone sizes

2022-09-20 Thread Pankaj Raghav
- Background and Motivation: The zone storage implementation in Linux, introduced since v4.10, first targetted SMR drives which have a power of 2 (po2) zone size alignment requirement. The po2 zone size was further imposed implicitly by the block layer's blk_queue_chunk_sectors(), used to prevent

[dm-devel] [PATCH v14 01/13] block: make bdev_nr_zones and disk_zone_no generic for npo2 zone size

2022-09-20 Thread Pankaj Raghav
Adapt bdev_nr_zones and disk_zone_no functions so that they can also work for non-power-of-2 zone sizes. As the existing deployments assume that a device zone size is a power of 2 number of sectors, power-of-2 optimized calculation is used for those devices. There are no direct hot paths

Re: [dm-devel] [PATCH 1/4] brd: make brd_insert_page return bool

2022-09-20 Thread Christoph Hellwig
On Fri, Sep 16, 2022 at 04:59:19AM -0400, Mikulas Patocka wrote: > brd_insert_page returns a pointer to struct page, however the pointer is > never used (it is only compared against NULL), so to clean-up the code, we > make it return bool. Looks good: Reviewed-by: Christoph Hellwig -- dm-devel

Re: [dm-devel] [PATCH RFC 4/8] fs: Introduce FALLOC_FL_PROVISION

2022-09-20 Thread Christoph Hellwig
On Thu, Sep 15, 2022 at 09:48:22AM -0700, Sarthak Kukreti wrote: > From: Sarthak Kukreti > > FALLOC_FL_PROVISION is a new fallocate() allocation mode that > sends a hint to (supported) thinly provisioned block devices to > allocate space for the given range of sectors via REQ_OP_PROVISION. So,

Re: [dm-devel] [PATCH RFC 0/8] Introduce provisioning primitives for thinly provisioned storage

2022-09-20 Thread Christoph Hellwig
On Fri, Sep 16, 2022 at 11:48:34AM -0700, Sarthak Kukreti wrote: > Yes. On ChromiumOS, we regularly deal with storage devices that don't > support WRITE_ZEROES or that need to have it disabled, via a quirk, > due to a bug in the vendor's implementation. So bloody punich the vendors for it.

Re: [dm-devel] [PATCH] blk-lib: fix blkdev_issue_secure_erase

2022-09-20 Thread Christoph Hellwig
On Wed, Sep 14, 2022 at 04:55:51PM -0400, Mikulas Patocka wrote: > + /* make sure that "len << SECTOR_SHIFT" doesn't overflow */ > + if (max_sectors > UINT_MAX >> SECTOR_SHIFT) > + max_sectors = UINT_MAX >> SECTOR_SHIFT; This should use max / max_t: max_sectors =

Re: [dm-devel] [PATCH 3/4] brd: enable discard

2022-09-20 Thread Christoph Hellwig
> @@ -289,6 +308,23 @@ static void brd_submit_bio(struct bio *b > struct bio_vec bvec; > struct bvec_iter iter; > > + if (bio_op(bio) == REQ_OP_DISCARD) { > + sector_t len = bio_sectors(bio); > + sector_t front_pad = -sector & (PAGE_SECTORS - 1); > +

Re: [dm-devel] [PATCH 2/4] brd: extend the rcu regions to cover read and write

2022-09-20 Thread Christoph Hellwig
> * Look up and return a brd's page for a given sector. > + * This must be called with the rcu lock held. Please ad a rcu_read_lock_held() check then. > - rcu_read_lock(); > idx = sector >> PAGE_SECTORS_SHIFT; /* sector to page index */ > page = radix_tree_lookup(>brd_pages,

Re: [dm-devel] [PATCH 4/4] brd: implement secure erase and write zeroes

2022-09-20 Thread Christoph Hellwig
On Fri, Sep 16, 2022 at 05:00:46AM -0400, Mikulas Patocka wrote: > This patch implements REQ_OP_SECURE_ERASE and REQ_OP_WRITE_ZEROES on brd. > Write zeroes will free the pages just like discard, but the difference is > that it writes zeroes to the preceding and following page if the range is > not

Re: [dm-devel] [PATCH V2 0/6] allowing path checking to be interrupted.

2022-09-20 Thread Martin Wilck
On Thu, 2022-09-15 at 14:56 +0800, Wu Guanghao wrote: > Sorry for the late feedback. > > The version we are currently testing is 0.8.4, so we only merge the > first 3 patches in this series of patches. Then after the actual > test, > it was found that the effect improvement is not very obvious. >