Skip to content

Commit 1eadb15

Browse files
johnpgarryaxboe
authored andcommitted
block: Add bdev atomic write limits helpers
Add helpers to get atomic write limits for a bdev, so that we don't access request_queue helpers outside the block layer. We check if the bdev can actually atomic write in these helpers, so we can avoid users missing using this check. Suggested-by: Christoph Hellwig <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: John Garry <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent c3be7eb commit 1eadb15

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

include/linux/blkdev.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,6 +1674,22 @@ static inline bool bdev_can_atomic_write(struct block_device *bdev)
16741674
return true;
16751675
}
16761676

1677+
static inline unsigned int
1678+
bdev_atomic_write_unit_min_bytes(struct block_device *bdev)
1679+
{
1680+
if (!bdev_can_atomic_write(bdev))
1681+
return 0;
1682+
return queue_atomic_write_unit_min_bytes(bdev_get_queue(bdev));
1683+
}
1684+
1685+
static inline unsigned int
1686+
bdev_atomic_write_unit_max_bytes(struct block_device *bdev)
1687+
{
1688+
if (!bdev_can_atomic_write(bdev))
1689+
return 0;
1690+
return queue_atomic_write_unit_max_bytes(bdev_get_queue(bdev));
1691+
}
1692+
16771693
#define DEFINE_IO_COMP_BATCH(name) struct io_comp_batch name = { }
16781694

16791695
#endif /* _LINUX_BLKDEV_H */

0 commit comments

Comments
 (0)