[Devel] [PATCH 3/3] blk-cbt: define NR_PAGES in terms of BITS_PER_PAGE

Nikolay Borisov nikolay.borisov at virtuozzo.com
Tue Jan 31 15:24:01 MSK 2023


No point in having the open-coded PAGE_SIZE*8 when we already have an
aptly named macro.

Signed-off-by: Nikolay Borisov <nikolay.borisov at virtuozzo.com>
---
 block/blk-cbt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/blk-cbt.c b/block/blk-cbt.c
index d49ca7fc2865..32485c793484 100644
--- a/block/blk-cbt.c
+++ b/block/blk-cbt.c
@@ -23,8 +23,8 @@
 #include <asm/uaccess.h>
 
 #define CBT_MAX_EXTENTS	512
-#define NR_PAGES(bits) DIV_ROUND_UP((bits), PAGE_SIZE*8)
-#define BITS_PER_PAGE		(1UL << (PAGE_SHIFT + 3))
+#define BITS_PER_PAGE  (1UL << (PAGE_SHIFT + 3))
+#define NR_PAGES(bits) DIV_ROUND_UP((bits), BITS_PER_PAGE)
 
 #define CBT_PAGE_MISSED (struct page *)(0x1)
 #define CBT_PAGE(cbt, idx) (cbt->map[idx] == CBT_PAGE_MISSED ? \
-- 
2.34.1



More information about the Devel mailing list