Commit 052e545c authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

block: simplify blk_check_zone_append

Use the bdev based helpers instead of open coding them.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20220706070350.1703384-6-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 6deacb3b
...@@ -565,7 +565,6 @@ static int blk_partition_remap(struct bio *bio) ...@@ -565,7 +565,6 @@ static int blk_partition_remap(struct bio *bio)
static inline blk_status_t blk_check_zone_append(struct request_queue *q, static inline blk_status_t blk_check_zone_append(struct request_queue *q,
struct bio *bio) struct bio *bio)
{ {
sector_t pos = bio->bi_iter.bi_sector;
int nr_sectors = bio_sectors(bio); int nr_sectors = bio_sectors(bio);
/* Only applicable to zoned block devices */ /* Only applicable to zoned block devices */
...@@ -573,8 +572,8 @@ static inline blk_status_t blk_check_zone_append(struct request_queue *q, ...@@ -573,8 +572,8 @@ static inline blk_status_t blk_check_zone_append(struct request_queue *q,
return BLK_STS_NOTSUPP; return BLK_STS_NOTSUPP;
/* The bio sector must point to the start of a sequential zone */ /* The bio sector must point to the start of a sequential zone */
if (pos & (blk_queue_zone_sectors(q) - 1) || if (bio->bi_iter.bi_sector & (bdev_zone_sectors(bio->bi_bdev) - 1) ||
!blk_queue_zone_is_seq(q, pos)) !bio_zone_is_seq(bio))
return BLK_STS_IOERR; return BLK_STS_IOERR;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment