diff mbox series

[v2,4/5] dm bufio: simplify by using PAGE_SECTORS_SHIFT

Message ID 20230526073336.344543-5-mcgrof@kernel.org (mailing list archive)
State Superseded, archived
Headers show
Series block: simplify with PAGE_SECTORS_SHIFT | expand

Commit Message

Luis Chamberlain May 26, 2023, 7:33 a.m. UTC
The PAGE_SHIFT - SECTOR_SHIFT constant be replaced with PAGE_SECTORS_SHIFT
defined in linux/blt_types.h, which is included by linux/blkdev.h.

This produces no functional changes.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 drivers/md/dm-bufio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Johannes Thumshirn May 26, 2023, 9:21 a.m. UTC | #1
On 26.05.23 09:33, Luis Chamberlain wrote:
>  		*data_mode = DATA_MODE_GET_FREE_PAGES;
>  		return (void *)__get_free_pages(gfp_mask,
> -						c->sectors_per_block_bits - (PAGE_SHIFT - SECTOR_SHIFT));
> +						c->sectors_per_block_bits - (PAGE_SECTORS_SHIFT));


>  	case DATA_MODE_GET_FREE_PAGES:
>  		free_pages((unsigned long)data,
> -			   c->sectors_per_block_bits - (PAGE_SHIFT - SECTOR_SHIFT));
> +			   c->sectors_per_block_bits - (PAGE_SECTORS_SHIFT));


The parenthesis are completely unneeded in the new version,
please remove them.
diff mbox series

Patch

diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index eea977662e81..08c4730e1819 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -1152,7 +1152,7 @@  static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask,
 	    gfp_mask & __GFP_NORETRY) {
 		*data_mode = DATA_MODE_GET_FREE_PAGES;
 		return (void *)__get_free_pages(gfp_mask,
-						c->sectors_per_block_bits - (PAGE_SHIFT - SECTOR_SHIFT));
+						c->sectors_per_block_bits - (PAGE_SECTORS_SHIFT));
 	}
 
 	*data_mode = DATA_MODE_VMALLOC;
@@ -1190,7 +1190,7 @@  static void free_buffer_data(struct dm_bufio_client *c,
 
 	case DATA_MODE_GET_FREE_PAGES:
 		free_pages((unsigned long)data,
-			   c->sectors_per_block_bits - (PAGE_SHIFT - SECTOR_SHIFT));
+			   c->sectors_per_block_bits - (PAGE_SECTORS_SHIFT));
 		break;
 
 	case DATA_MODE_VMALLOC: