[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ea3d14cb-00ea-8d7b-4615-9347fdd7aa27@opensource.wdc.com>
Date: Wed, 6 Apr 2022 17:52:34 +0900
From: Damien Le Moal <damien.lemoal@...nsource.wdc.com>
To: Christoph Hellwig <hch@....de>, Jens Axboe <axboe@...nel.dk>
Cc: dm-devel@...hat.com, linux-xfs@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-um@...ts.infradead.org,
linux-block@...r.kernel.org, drbd-dev@...ts.linbit.com,
nbd@...er.debian.org, ceph-devel@...r.kernel.org,
virtualization@...ts.linux-foundation.org,
xen-devel@...ts.xenproject.org, linux-bcache@...r.kernel.org,
linux-raid@...r.kernel.org, linux-mmc@...r.kernel.org,
linux-mtd@...ts.infradead.org, linux-nvme@...ts.infradead.org,
linux-s390@...r.kernel.org, linux-scsi@...r.kernel.org,
target-devel@...r.kernel.org, linux-btrfs@...r.kernel.org,
linux-ext4@...r.kernel.org, linux-f2fs-devel@...ts.sourceforge.net,
cluster-devel@...hat.com, jfs-discussion@...ts.sourceforge.net,
linux-nilfs@...r.kernel.org, ntfs3@...ts.linux.dev,
ocfs2-devel@....oracle.com, linux-mm@...ck.org
Subject: Re: [PATCH 14/27] block: add a bdev_max_zone_append_sectors helper
On 4/6/22 15:05, Christoph Hellwig wrote:
> Add a helper to check the max supported sectors for zone append based on
> the block_device instead of having to poke into the block layer internal
> request_queue.
>
> Signed-off-by: Christoph Hellwig <hch@....de>
> ---
> drivers/nvme/target/zns.c | 3 +--
> fs/zonefs/super.c | 3 +--
> include/linux/blkdev.h | 6 ++++++
> 3 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/nvme/target/zns.c b/drivers/nvme/target/zns.c
> index e34718b095504..82b61acf7a72b 100644
> --- a/drivers/nvme/target/zns.c
> +++ b/drivers/nvme/target/zns.c
> @@ -34,8 +34,7 @@ static int validate_conv_zones_cb(struct blk_zone *z,
>
> bool nvmet_bdev_zns_enable(struct nvmet_ns *ns)
> {
> - struct request_queue *q = ns->bdev->bd_disk->queue;
> - u8 zasl = nvmet_zasl(queue_max_zone_append_sectors(q));
> + u8 zasl = nvmet_zasl(bdev_max_zone_append_sectors(ns->bdev));
> struct gendisk *bd_disk = ns->bdev->bd_disk;
> int ret;
>
> diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c
> index 3614c7834007d..7a63807b736c4 100644
> --- a/fs/zonefs/super.c
> +++ b/fs/zonefs/super.c
> @@ -678,13 +678,12 @@ static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from)
> struct inode *inode = file_inode(iocb->ki_filp);
> struct zonefs_inode_info *zi = ZONEFS_I(inode);
> struct block_device *bdev = inode->i_sb->s_bdev;
> - unsigned int max;
> + unsigned int max = bdev_max_zone_append_sectors(bdev);
> struct bio *bio;
> ssize_t size;
> int nr_pages;
> ssize_t ret;
>
> - max = queue_max_zone_append_sectors(bdev_get_queue(bdev));
> max = ALIGN_DOWN(max << SECTOR_SHIFT, inode->i_sb->s_blocksize);
> iov_iter_truncate(from, max);
>
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index a433798c3343e..f8c50b77543eb 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -1188,6 +1188,12 @@ static inline unsigned int queue_max_zone_append_sectors(const struct request_qu
> return min(l->max_zone_append_sectors, l->max_sectors);
> }
>
> +static inline unsigned int
> +bdev_max_zone_append_sectors(struct block_device *bdev)
> +{
> + return queue_max_zone_append_sectors(bdev_get_queue(bdev));
> +}
> +
> static inline unsigned queue_logical_block_size(const struct request_queue *q)
> {
> int retval = 512;
Looks good.
Acked-by: Damien Le Moal <damien.lemoal@...nsource.wdc.com>
--
Damien Le Moal
Western Digital Research
Powered by blists - more mailing lists