block: add a bdev_max_zone_append_sectors helper
commit 2aba0d19f4d8c8929b4b3b94a9cfde2aa20e6ee2 upstream 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@lst.de> Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Link: https://lore.kernel.org/r/20220415045258.199825-16-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
a50d9fde46
commit
dd2ee2fd1f
@@ -34,8 +34,7 @@ static int validate_conv_zones_cb(struct blk_zone *z,
|
|||||||
|
|
||||||
bool nvmet_bdev_zns_enable(struct nvmet_ns *ns)
|
bool nvmet_bdev_zns_enable(struct nvmet_ns *ns)
|
||||||
{
|
{
|
||||||
struct request_queue *q = ns->bdev->bd_disk->queue;
|
u8 zasl = nvmet_zasl(bdev_max_zone_append_sectors(ns->bdev));
|
||||||
u8 zasl = nvmet_zasl(queue_max_zone_append_sectors(q));
|
|
||||||
struct gendisk *bd_disk = ns->bdev->bd_disk;
|
struct gendisk *bd_disk = ns->bdev->bd_disk;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|||||||
@@ -723,13 +723,12 @@ static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from)
|
|||||||
struct inode *inode = file_inode(iocb->ki_filp);
|
struct inode *inode = file_inode(iocb->ki_filp);
|
||||||
struct zonefs_inode_info *zi = ZONEFS_I(inode);
|
struct zonefs_inode_info *zi = ZONEFS_I(inode);
|
||||||
struct block_device *bdev = inode->i_sb->s_bdev;
|
struct block_device *bdev = inode->i_sb->s_bdev;
|
||||||
unsigned int max;
|
unsigned int max = bdev_max_zone_append_sectors(bdev);
|
||||||
struct bio *bio;
|
struct bio *bio;
|
||||||
ssize_t size;
|
ssize_t size;
|
||||||
int nr_pages;
|
int nr_pages;
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|
||||||
max = queue_max_zone_append_sectors(bdev_get_queue(bdev));
|
|
||||||
max = ALIGN_DOWN(max << SECTOR_SHIFT, inode->i_sb->s_blocksize);
|
max = ALIGN_DOWN(max << SECTOR_SHIFT, inode->i_sb->s_blocksize);
|
||||||
iov_iter_truncate(from, max);
|
iov_iter_truncate(from, max);
|
||||||
|
|
||||||
|
|||||||
@@ -1387,6 +1387,12 @@ static inline unsigned int queue_max_zone_append_sectors(const struct request_qu
|
|||||||
return min(l->max_zone_append_sectors, l->max_sectors);
|
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)
|
static inline unsigned queue_logical_block_size(const struct request_queue *q)
|
||||||
{
|
{
|
||||||
int retval = 512;
|
int retval = 512;
|
||||||
|
|||||||
Reference in New Issue
Block a user