@@ -1551,7 +1551,7 @@ static void __zram_make_request(struct zram *zram, struct bio *bio)
index = bio->bi_iter.bi_sector >> SECTORS_PER_PAGE_SHIFT;
offset = (bio->bi_iter.bi_sector &
- (SECTORS_PER_PAGE - 1)) << SECTOR_SHIFT;
+ (PAGE_SECTORS - 1)) << SECTOR_SHIFT;
switch (bio_op(bio)) {
case REQ_OP_DISCARD:
@@ -1645,7 +1645,7 @@ static int zram_rw_page(struct block_device *bdev, sector_t sector,
}
index = sector >> SECTORS_PER_PAGE_SHIFT;
- offset = (sector & (SECTORS_PER_PAGE - 1)) << SECTOR_SHIFT;
+ offset = (sector & (PAGE_SECTORS - 1)) << SECTOR_SHIFT;
bv.bv_page = page;
bv.bv_len = PAGE_SIZE;
@@ -22,7 +22,6 @@
#include "zcomp.h"
#define SECTORS_PER_PAGE_SHIFT (PAGE_SHIFT - SECTOR_SHIFT)
-#define SECTORS_PER_PAGE (1 << SECTORS_PER_PAGE_SHIFT)
#define ZRAM_LOGICAL_BLOCK_SHIFT 12
#define ZRAM_LOGICAL_BLOCK_SIZE (1 << ZRAM_LOGICAL_BLOCK_SHIFT)
#define ZRAM_SECTOR_PER_LOGICAL_BLOCK \
SECTORS_PER_PAGE is equivalent to PAGE_SECTORS. Although I prefer SECTORS_PER_PAGE better than PAGE_SECTORS, the former is more clearer, I think. But the latter was defined in <linux/device-mapper.h> before, rename it may impact users. Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> --- drivers/block/zram/zram_drv.c | 4 ++-- drivers/block/zram/zram_drv.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)