block: move some macros to blkdev.h
authorGuoqing Jiang <jiangguoqing@kylinos.cn>
Wed, 21 Jul 2021 02:53:15 +0000 (10:53 +0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 12 Aug 2021 01:40:28 +0000 (19:40 -0600)
Move them (PAGE_SECTORS_SHIFT, PAGE_SECTORS and SECTOR_MASK) to the
generic header file to remove redundancy.

Signed-off-by: Guoqing Jiang <jiangguoqing@kylinos.cn>
Link: https://lore.kernel.org/r/20210721025315.1729118-1-guoqing.jiang@linux.dev
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/brd.c
drivers/block/null_blk/main.c
drivers/md/bcache/util.h
include/linux/blkdev.h
include/linux/device-mapper.h

index 95694113e38eb9ab35cbe14a189fa851219ffd60..58ec167aa01837b825e9280cf06edfdcff893f0c 100644 (file)
@@ -27,9 +27,6 @@
 
 #include <linux/uaccess.h>
 
-#define PAGE_SECTORS_SHIFT     (PAGE_SHIFT - SECTOR_SHIFT)
-#define PAGE_SECTORS           (1 << PAGE_SECTORS_SHIFT)
-
 /*
  * Each block ramdisk device has a radix_tree brd_pages of pages that stores
  * the pages containing the block device's contents. A brd page's ->index is
index d734e9ee1546e6c7046aa31c88caac89adeaf752..f128242d11701b155d365313a769662dc232dfed 100644 (file)
 #include <linux/init.h>
 #include "null_blk.h"
 
-#define PAGE_SECTORS_SHIFT     (PAGE_SHIFT - SECTOR_SHIFT)
-#define PAGE_SECTORS           (1 << PAGE_SECTORS_SHIFT)
-#define SECTOR_MASK            (PAGE_SECTORS - 1)
-
 #define FREE_BATCH             16
 
 #define TICKS_PER_SEC          50ULL
index bca4a7c97da7c0b0ba8a274b4092784721d98844..b64460a7626771c68b983b1d4dcaf7219f73e50a 100644 (file)
@@ -15,8 +15,6 @@
 
 #include "closure.h"
 
-#define PAGE_SECTORS           (PAGE_SIZE / 512)
-
 struct closure;
 
 #ifdef CONFIG_BCACHE_DEBUG
index 07eef02325b4f62e61187a6a52eee8fb3269e050..df404c1fb087a29e89d337050ac96841616ccdf5 100644 (file)
@@ -939,6 +939,10 @@ static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
 #define SECTOR_SIZE (1 << SECTOR_SHIFT)
 #endif
 
+#define PAGE_SECTORS_SHIFT     (PAGE_SHIFT - SECTOR_SHIFT)
+#define PAGE_SECTORS           (1 << PAGE_SECTORS_SHIFT)
+#define SECTOR_MASK            (PAGE_SECTORS - 1)
+
 /*
  * blk_rq_pos()                        : the current sector
  * blk_rq_bytes()              : bytes left in the entire request
index 7457d49acf9a5703d0c3fc4480a8981c22fb6003..94f2cd6a8e8384f5c08fe367d6a6fec78a069ba0 100644 (file)
@@ -151,7 +151,6 @@ typedef size_t (*dm_dax_copy_iter_fn)(struct dm_target *ti, pgoff_t pgoff,
                void *addr, size_t bytes, struct iov_iter *i);
 typedef int (*dm_dax_zero_page_range_fn)(struct dm_target *ti, pgoff_t pgoff,
                size_t nr_pages);
-#define PAGE_SECTORS (PAGE_SIZE / 512)
 
 void dm_error(const char *message);