Re: [PATCH] md: only calculate blocksize once and use i_blocksize()

2020-08-19 Thread Song Liu
On Mon, Aug 17, 2020 at 10:49 PM Xianting Tian  wrote:
>
> We alreday has the interface i_blocksize(), which can be used
> to get blocksize, so use it.
> Only calculate blocksize once and use it within read_page().
>
> Signed-off-by: Xianting Tian 

Thanks for the patch. Applied to md-next.


[PATCH] md: only calculate blocksize once and use i_blocksize()

2020-08-17 Thread Xianting Tian
We alreday has the interface i_blocksize(), which can be used
to get blocksize, so use it.
Only calculate blocksize once and use it within read_page().

Signed-off-by: Xianting Tian 
---
 drivers/md/md-bitmap.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index 95a5f3757..0d5544868 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -357,11 +357,12 @@ static int read_page(struct file *file, unsigned long 
index,
struct inode *inode = file_inode(file);
struct buffer_head *bh;
sector_t block, blk_cur;
+   unsigned long blocksize = i_blocksize(inode);
 
pr_debug("read bitmap file (%dB @ %llu)\n", (int)PAGE_SIZE,
 (unsigned long long)index << PAGE_SHIFT);
 
-   bh = alloc_page_buffers(page, 1b_blocknr = block;
bh->b_bdev = inode->i_sb->s_bdev;
-   if (count < (1b_end_io = end_bitmap_write;
bh->b_private = bitmap;
-- 
2.17.1