linux-bcache.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: move some macros to blkdev.h
@ 2021-07-21  2:53 Guoqing Jiang
  2021-08-12  0:43 ` Guoqing Jiang
  2021-08-12  1:40 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Guoqing Jiang @ 2021-07-21  2:53 UTC (permalink / raw)
  To: axboe, colyli, kent.overstreet, agk, snitzer
  Cc: dm-devel, linux-block, linux-bcache

From: Guoqing Jiang <jiangguoqing@kylinos.cn>

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>
---
 drivers/block/brd.c           | 3 ---
 drivers/block/null_blk/main.c | 4 ----
 drivers/md/bcache/util.h      | 2 --
 include/linux/blkdev.h        | 4 ++++
 include/linux/device-mapper.h | 1 -
 5 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 95694113e38e..58ec167aa018 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -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
diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index d734e9ee1546..f128242d1170 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -11,10 +11,6 @@
 #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
diff --git a/drivers/md/bcache/util.h b/drivers/md/bcache/util.h
index bca4a7c97da7..b64460a76267 100644
--- a/drivers/md/bcache/util.h
+++ b/drivers/md/bcache/util.h
@@ -15,8 +15,6 @@
 
 #include "closure.h"
 
-#define PAGE_SECTORS		(PAGE_SIZE / 512)
-
 struct closure;
 
 #ifdef CONFIG_BCACHE_DEBUG
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 3177181c4326..0d0b6967c954 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -941,6 +941,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
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 7457d49acf9a..94f2cd6a8e83 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -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);
 
-- 
2.25.1


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

* Re: [PATCH] block: move some macros to blkdev.h
  2021-07-21  2:53 [PATCH] block: move some macros to blkdev.h Guoqing Jiang
@ 2021-08-12  0:43 ` Guoqing Jiang
  2021-08-12  1:40 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Guoqing Jiang @ 2021-08-12  0:43 UTC (permalink / raw)
  To: axboe, colyli, kent.overstreet, agk, snitzer
  Cc: dm-devel, linux-block, linux-bcache

Gentle ping ...

On 7/21/21 10:53 AM, Guoqing Jiang wrote:
> From: Guoqing Jiang <jiangguoqing@kylinos.cn>
>
> 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>
> ---
>   drivers/block/brd.c           | 3 ---
>   drivers/block/null_blk/main.c | 4 ----
>   drivers/md/bcache/util.h      | 2 --
>   include/linux/blkdev.h        | 4 ++++
>   include/linux/device-mapper.h | 1 -
>   5 files changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/block/brd.c b/drivers/block/brd.c
> index 95694113e38e..58ec167aa018 100644
> --- a/drivers/block/brd.c
> +++ b/drivers/block/brd.c
> @@ -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
> diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
> index d734e9ee1546..f128242d1170 100644
> --- a/drivers/block/null_blk/main.c
> +++ b/drivers/block/null_blk/main.c
> @@ -11,10 +11,6 @@
>   #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
> diff --git a/drivers/md/bcache/util.h b/drivers/md/bcache/util.h
> index bca4a7c97da7..b64460a76267 100644
> --- a/drivers/md/bcache/util.h
> +++ b/drivers/md/bcache/util.h
> @@ -15,8 +15,6 @@
>   
>   #include "closure.h"
>   
> -#define PAGE_SECTORS		(PAGE_SIZE / 512)
> -
>   struct closure;
>   
>   #ifdef CONFIG_BCACHE_DEBUG
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index 3177181c4326..0d0b6967c954 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -941,6 +941,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
> diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
> index 7457d49acf9a..94f2cd6a8e83 100644
> --- a/include/linux/device-mapper.h
> +++ b/include/linux/device-mapper.h
> @@ -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);
>   


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

* Re: [PATCH] block: move some macros to blkdev.h
  2021-07-21  2:53 [PATCH] block: move some macros to blkdev.h Guoqing Jiang
  2021-08-12  0:43 ` Guoqing Jiang
@ 2021-08-12  1:40 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2021-08-12  1:40 UTC (permalink / raw)
  To: Guoqing Jiang, colyli, kent.overstreet, agk, snitzer
  Cc: dm-devel, linux-block, linux-bcache

On 7/20/21 8:53 PM, Guoqing Jiang wrote:
> From: Guoqing Jiang <jiangguoqing@kylinos.cn>
> 
> Move them (PAGE_SECTORS_SHIFT, PAGE_SECTORS and SECTOR_MASK) to the
> generic header file to remove redundancy.

Applied for 5.15, thanks.

-- 
Jens Axboe


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

end of thread, other threads:[~2021-08-12  1:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21  2:53 [PATCH] block: move some macros to blkdev.h Guoqing Jiang
2021-08-12  0:43 ` Guoqing Jiang
2021-08-12  1:40 ` Jens Axboe

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).