From: Damien Le Moal via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: Pankaj Raghav <p.raghav@samsung.com>,
jaegeuk@kernel.org, axboe@kernel.dk, snitzer@kernel.org,
hch@lst.de, mcgrof@kernel.org, naohiro.aota@wdc.com,
sagi@grimberg.me, dsterba@suse.com, johannes.thumshirn@wdc.com
Cc: jiangbo.365@bytedance.com, kch@nvidia.com, bvanassche@acm.org,
matias.bjorling@wdc.com, gost.dev@samsung.com,
linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org,
linux-f2fs-devel@lists.sourceforge.net,
linux-block@vger.kernel.org, clm@fb.com, dm-devel@redhat.com,
agk@redhat.com, jonathan.derrick@linux.dev, kbusch@kernel.org,
linux-fsdevel@vger.kernel.org, josef@toxicpanda.com,
linux-btrfs@vger.kernel.org
Subject: Re: [f2fs-dev] [PATCH 04/16] block: allow blk-zoned devices to have non-power-of-2 zone size
Date: Thu, 28 Apr 2022 08:37:27 +0900 [thread overview]
Message-ID: <eeb86052-399c-a79b-32ab-1ed1b2d05e07@opensource.wdc.com> (raw)
In-Reply-To: <20220427160255.300418-5-p.raghav@samsung.com>
On 4/28/22 01:02, Pankaj Raghav wrote:
> Convert the calculations on zone size to be generic instead of relying on
> power_of_2 based logic in the block layer using the helpers wherever
> possible.
>
> The only hot path affected by this change for power_of_2 zoned devices
> is in blk_check_zone_append() but the effects should be negligible as the
> helper blk_queue_zone_aligned() optimizes the calculation for those
> devices. Note that the append path cannot be accessed by direct raw access
> to the block device but only through a filesystem abstraction.
>
> Finally, remove the check for power_of_2 zone size requirement in
> blk-zoned.c
>
> Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
> ---
> block/blk-core.c | 3 +--
> block/blk-zoned.c | 12 ++++++------
> 2 files changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 937bb6b86331..850caf311064 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -634,8 +634,7 @@ static inline blk_status_t blk_check_zone_append(struct request_queue *q,
> return BLK_STS_NOTSUPP;
>
> /* The bio sector must point to the start of a sequential zone */
> - if (pos & (blk_queue_zone_sectors(q) - 1) ||
> - !blk_queue_zone_is_seq(q, pos))
> + if (!blk_queue_zone_aligned(q, pos) || !blk_queue_zone_is_seq(q, pos))
blk_queue_zone_aligned() is a little confusing since "aligned" is also
used for write-pointer aligned. I would rename this helper
blk_queue_is_zone_start()
or something like that.
> return BLK_STS_IOERR;
>
> /*
> diff --git a/block/blk-zoned.c b/block/blk-zoned.c
> index 1dff4a8bd51d..f7c7c3bd148d 100644
> --- a/block/blk-zoned.c
> +++ b/block/blk-zoned.c
> @@ -288,10 +288,10 @@ int blkdev_zone_mgmt(struct block_device *bdev, enum req_opf op,
> return -EINVAL;
>
> /* Check alignment (handle eventual smaller last zone) */
> - if (sector & (zone_sectors - 1))
> + if (!blk_queue_zone_aligned(q, sector))
> return -EINVAL;
>
> - if ((nr_sectors & (zone_sectors - 1)) && end_sector != capacity)
> + if (!blk_queue_zone_aligned(q, nr_sectors) && end_sector != capacity)
> return -EINVAL;
>
> /*
> @@ -489,14 +489,14 @@ static int blk_revalidate_zone_cb(struct blk_zone *zone, unsigned int idx,
> * smaller last zone.
> */
> if (zone->start == 0) {
> - if (zone->len == 0 || !is_power_of_2(zone->len)) {
> - pr_warn("%s: Invalid zoned device with non power of two zone size (%llu)\n",
> - disk->disk_name, zone->len);
> + if (zone->len == 0) {
> + pr_warn("%s: Invalid zoned device size",
> + disk->disk_name);
The message is weird now. Please change it to "Invalid zone size".
Also, the entire premise of this patch series is that it is hard for
people to support the unusable sectors between zone capacity and zone end
for drives with a zone capacity smaller than the zone size.
Yet, here you do not check that zone capacity == zone size for drives that
do not have a zone size equal to a power of 2 number of sectors. This
means that we can still have drives with ZC < ZS AND ZS not equal to a
power of 2. So from the point of view of your arguments, no gains at all.
Any thoughts on this ?
> return -ENODEV;
> }
>
> args->zone_sectors = zone->len;
> - args->nr_zones = (capacity + zone->len - 1) >> ilog2(zone->len);
> + args->nr_zones = div64_u64(capacity + zone->len - 1, zone->len);
> } else if (zone->start + args->zone_sectors < capacity) {
> if (zone->len != args->zone_sectors) {
> pr_warn("%s: Invalid zoned device with non constant zone size\n",
--
Damien Le Moal
Western Digital Research
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2022-04-27 23:45 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20220427160256eucas1p2db2b58792ffc93026d870c260767da14@eucas1p2.samsung.com>
2022-04-27 16:02 ` [f2fs-dev] [PATCH 00/16] support non power of 2 zoned devices Pankaj Raghav
[not found] ` <CGME20220427160257eucas1p21fb58d0129376a135fdf0b9c2fe88895@eucas1p2.samsung.com>
2022-04-27 16:02 ` [f2fs-dev] [PATCH 01/16] block: make blkdev_nr_zones and blk_queue_zone_no generic for npo2 zsze Pankaj Raghav
2022-04-29 17:16 ` Adam Manzanares
2022-05-03 16:37 ` Bart Van Assche
2022-05-03 16:43 ` Damien Le Moal via Linux-f2fs-devel
2022-05-04 8:35 ` Pankaj Raghav
[not found] ` <CGME20220427160258eucas1p19548a7094f67b4c9f340add776f60082@eucas1p1.samsung.com>
2022-04-27 16:02 ` [f2fs-dev] [PATCH 02/16] block: add blk_queue_zone_aligned and bdev_zone_aligned helper Pankaj Raghav
2022-04-27 23:52 ` Bart Van Assche
[not found] ` <CGME20220427160259eucas1p25aab0637fec229cd1140e6aa08678f38@eucas1p2.samsung.com>
2022-04-27 16:02 ` [f2fs-dev] [PATCH 03/16] block: add bdev_zone_no helper Pankaj Raghav
2022-04-27 23:31 ` Damien Le Moal via Linux-f2fs-devel
2022-04-27 23:53 ` Bart Van Assche
[not found] ` <CGME20220427160300eucas1p1470fe30535849de6204bb78d7083cb3a@eucas1p1.samsung.com>
2022-04-27 16:02 ` [f2fs-dev] [PATCH 04/16] block: allow blk-zoned devices to have non-power-of-2 zone size Pankaj Raghav
2022-04-27 23:37 ` Damien Le Moal via Linux-f2fs-devel [this message]
2022-04-28 17:29 ` Luis Chamberlain
[not found] ` <CGME20220427160301eucas1p147d0dced70946e20dd2dd046b94b8224@eucas1p1.samsung.com>
2022-04-27 16:02 ` [f2fs-dev] [PATCH 05/16] nvme: zns: Allow ZNS drives that have non-power_of_2 " Pankaj Raghav
2022-04-29 17:23 ` Adam Manzanares
2022-05-03 16:50 ` Bart Van Assche
2022-05-04 8:38 ` Pankaj Raghav
[not found] ` <CGME20220427160302eucas1p1aaba7a309778d3440c3315ad899e4035@eucas1p1.samsung.com>
2022-04-27 16:02 ` [f2fs-dev] [PATCH 06/16] nvmet: use blk_queue_zone_no() Pankaj Raghav
2022-04-29 17:27 ` Adam Manzanares
2022-05-03 16:54 ` Bart Van Assche
[not found] ` <CGME20220427160303eucas1p1c7d1b743e9ecf77b4f203bdeccbe382e@eucas1p1.samsung.com>
2022-04-27 16:02 ` [f2fs-dev] [PATCH 07/16] btrfs: zoned: Cache superblock location in btrfs_zoned_device_info Pankaj Raghav
[not found] ` <CGME20220427160304eucas1p1a0080df82f76c39882c4298c3c3d99fd@eucas1p1.samsung.com>
2022-04-27 16:02 ` [f2fs-dev] [PATCH 08/16] btrfs: zoned: add generic btrfs helpers for zoned devices Pankaj Raghav
[not found] ` <CGME20220427160305eucas1p26831c19df0b2097e42209edcf73526b7@eucas1p2.samsung.com>
2022-04-27 16:02 ` [f2fs-dev] [PATCH 09/16] btrfs: zoned: Make sb_zone_number function non power of 2 compatible Pankaj Raghav
[not found] ` <CGME20220427160306eucas1p10514a8597007ed9d5e269d659df58d35@eucas1p1.samsung.com>
2022-04-27 16:02 ` [f2fs-dev] [PATCH 10/16] btrfs: zoned: use btrfs zone helpers to support non po2 zoned devices Pankaj Raghav
[not found] ` <CGME20220427160307eucas1p229f9ebae38fcca9974909799e5e63ccf@eucas1p2.samsung.com>
2022-04-27 16:02 ` [f2fs-dev] [PATCH 11/16] btrfs: zoned: relax the alignment constraint for " Pankaj Raghav
[not found] ` <CGME20220427160309eucas1p2f677c8db581616f994473f17c4a5bd44@eucas1p2.samsung.com>
2022-04-27 16:02 ` [f2fs-dev] [PATCH 12/16] zonefs: allow non power of 2 " Pankaj Raghav
2022-04-27 23:39 ` Damien Le Moal via Linux-f2fs-devel
[not found] ` <CGME20220427160310eucas1p28cd3c5ff4fb7a04bc77c4c0b9d96bb74@eucas1p2.samsung.com>
2022-04-27 16:02 ` [f2fs-dev] [PATCH 13/16] null_blk: " Pankaj Raghav
2022-04-29 17:30 ` Adam Manzanares
2022-05-03 17:01 ` Bart Van Assche
[not found] ` <CGME20220427160311eucas1p151141fc73adc590b40ad6f935b1ac214@eucas1p1.samsung.com>
2022-04-27 16:02 ` [f2fs-dev] [PATCH 14/16] f2fs: call bdev_zone_sectors() only once on init_blkz_info() Pankaj Raghav
2022-05-03 20:04 ` Jaegeuk Kim
[not found] ` <CGME20220427160312eucas1p279bcffd97ef83bd3617a38b80d979746@eucas1p2.samsung.com>
2022-04-27 16:02 ` [f2fs-dev] [PATCH 15/16] f2fs: ensure only power of 2 zone sizes are allowed Pankaj Raghav
2022-05-03 20:05 ` Jaegeuk Kim
2022-05-04 8:53 ` Pankaj Raghav
[not found] ` <CGME20220427160313eucas1p1feecf74ec15c8c3d9250444710fd1676@eucas1p1.samsung.com>
2022-04-27 16:02 ` [f2fs-dev] [PATCH 16/16] dm-zoned: " Pankaj Raghav
2022-04-27 23:42 ` Damien Le Moal via Linux-f2fs-devel
2022-04-28 17:34 ` Luis Chamberlain
2022-04-28 21:43 ` Damien Le Moal via Linux-f2fs-devel
2022-04-28 22:06 ` Luis Chamberlain
2022-05-02 22:07 ` [f2fs-dev] [PATCH 00/16] support non power of 2 zoned devices Johannes Thumshirn via Linux-f2fs-devel
2022-05-03 9:12 ` Pankaj Raghav
2022-05-04 21:14 ` David Sterba
2022-05-05 7:28 ` Pankaj Raghav
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=eeb86052-399c-a79b-32ab-1ed1b2d05e07@opensource.wdc.com \
--to=linux-f2fs-devel@lists.sourceforge.net \
--cc=agk@redhat.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=clm@fb.com \
--cc=damien.lemoal@opensource.wdc.com \
--cc=dm-devel@redhat.com \
--cc=dsterba@suse.com \
--cc=gost.dev@samsung.com \
--cc=hch@lst.de \
--cc=jaegeuk@kernel.org \
--cc=jiangbo.365@bytedance.com \
--cc=johannes.thumshirn@wdc.com \
--cc=jonathan.derrick@linux.dev \
--cc=josef@toxicpanda.com \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=matias.bjorling@wdc.com \
--cc=mcgrof@kernel.org \
--cc=naohiro.aota@wdc.com \
--cc=p.raghav@samsung.com \
--cc=sagi@grimberg.me \
--cc=snitzer@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).