linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] block: add queue_logical_block_mask() and bdev_logical_block_mask()
@ 2023-06-28  9:34 Yangtao Li
  2023-06-28  9:34 ` [PATCH 2/7] block: Convert to bdev_logical_block_mask() Yangtao Li
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Yangtao Li @ 2023-06-28  9:34 UTC (permalink / raw)
  To: axboe, song, viro, brauner, xiang, chao, huyue2, jefflexu, hch,
	djwong
  Cc: linux-block, linux-kernel, linux-raid, linux-fsdevel, linux-erofs,
	linux-xfs, Yangtao Li

Introduce queue_logical_block_mask() and bdev_logical_block_mask()
to simplify code, which replace (queue_logical_block_size(q) - 1)
and (bdev_logical_block_size(bdev) - 1).

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 include/linux/blkdev.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index ed44a997f629..0cc0d1694ef6 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1150,11 +1150,21 @@ static inline unsigned queue_logical_block_size(const struct request_queue *q)
 	return retval;
 }
 
+static inline unsigned int queue_logical_block_mask(const struct request_queue *q)
+{
+	return queue_logical_block_size(q) - 1;
+}
+
 static inline unsigned int bdev_logical_block_size(struct block_device *bdev)
 {
 	return queue_logical_block_size(bdev_get_queue(bdev));
 }
 
+static inline unsigned int bdev_logical_block_mask(struct block_device *bdev)
+{
+	return bdev_logical_block_size(bdev) - 1;
+}
+
 static inline unsigned int queue_physical_block_size(const struct request_queue *q)
 {
 	return q->limits.physical_block_size;
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-06-29  5:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-28  9:34 [PATCH 1/7] block: add queue_logical_block_mask() and bdev_logical_block_mask() Yangtao Li
2023-06-28  9:34 ` [PATCH 2/7] block: Convert to bdev_logical_block_mask() Yangtao Li
2023-06-28  9:34 ` [PATCH 3/7] md: Convert to queue_logical_block_mask() Yangtao Li
2023-06-28  9:34 ` [PATCH 4/7] buffer: Convert to bdev_logical_block_mask() Yangtao Li
2023-06-28  9:34 ` [PATCH 5/7] iomap: " Yangtao Li
2023-06-28  9:34 ` [PATCH 6/7] xfs: " Yangtao Li
2023-06-28 16:41   ` Bill O'Donnell
2023-06-28  9:35 ` [PATCH 7/7] erofs: " Yangtao Li
2023-06-28 16:45 ` [PATCH 1/7] block: add queue_logical_block_mask() and bdev_logical_block_mask() Bill O'Donnell
2023-06-28 16:46 ` Matthew Wilcox
2023-06-29  3:44   ` Yangtao Li
2023-06-29  4:34     ` Darrick J. Wong
2023-06-29  5:44 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).