mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-17 13:58:46 +00:00
block: Introduce op_needs_zoned_write_locking()
Introduce a helper function for checking whether write serialization is required if the operation will be sent to a zoned device. A second caller for op_needs_zoned_write_locking() will be introduced in the next patch in this series. Suggested-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: Damien Le Moal <dlemoal@kernel.org> Cc: Ming Lei <ming.lei@redhat.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Link: https://lore.kernel.org/r/20230517174230.897144-5-bvanassche@acm.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
3ddbe2a7e0
commit
a370798201
@ -1281,13 +1281,16 @@ static inline unsigned int bdev_zone_no(struct block_device *bdev, sector_t sec)
|
||||
return disk_zone_no(bdev->bd_disk, sec);
|
||||
}
|
||||
|
||||
/* Whether write serialization is required for @op on zoned devices. */
|
||||
static inline bool op_needs_zoned_write_locking(enum req_op op)
|
||||
{
|
||||
return op == REQ_OP_WRITE || op == REQ_OP_WRITE_ZEROES;
|
||||
}
|
||||
|
||||
static inline bool bdev_op_is_zoned_write(struct block_device *bdev,
|
||||
enum req_op op)
|
||||
{
|
||||
if (!bdev_is_zoned(bdev))
|
||||
return false;
|
||||
|
||||
return op == REQ_OP_WRITE || op == REQ_OP_WRITE_ZEROES;
|
||||
return bdev_is_zoned(bdev) && op_needs_zoned_write_locking(op);
|
||||
}
|
||||
|
||||
static inline sector_t bdev_zone_sectors(struct block_device *bdev)
|
||||
|
Loading…
x
Reference in New Issue
Block a user