[v4,2/5] erofs: convert to use i_blockmask()

Message ID 20230310054829.4241-2-frank.li@vivo.com
State New
Headers
Series [v4,1/5] fs: add i_blockmask() |

Commit Message

李扬韬 March 10, 2023, 5:48 a.m. UTC
  Use i_blockmask() to simplify code.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/erofs/data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Gao Xiang March 10, 2023, 6:01 a.m. UTC | #1
Hi Yangtao,

On 2023/3/10 13:48, Yangtao Li wrote:
> Use i_blockmask() to simplify code.
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>

Please help drop this one since we'd like to use it until i_blockmask()
lands to upstream.

Thanks,
Gao Xiang

> ---
>   fs/erofs/data.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/erofs/data.c b/fs/erofs/data.c
> index e16545849ea7..d394102ef9de 100644
> --- a/fs/erofs/data.c
> +++ b/fs/erofs/data.c
> @@ -376,7 +376,7 @@ static ssize_t erofs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
>   		if (bdev)
>   			blksize_mask = bdev_logical_block_size(bdev) - 1;
>   		else
> -			blksize_mask = (1 << inode->i_blkbits) - 1;
> +			blksize_mask = i_blockmask(inode);
>   
>   		if ((iocb->ki_pos | iov_iter_count(to) |
>   		     iov_iter_alignment(to)) & blksize_mask)
  
李扬韬 March 10, 2023, 6:15 a.m. UTC | #2
Hi Gao Xiang,

> Please help drop this one since we'd like to use it until i_blockmask() lands to upstream.

I'm OK. Not sure if I need to resend v5?

Thx,
Yangtao
  
Gao Xiang March 10, 2023, 6:20 a.m. UTC | #3
On 2023/3/10 14:15, Yangtao Li wrote:
> Hi Gao Xiang,
> 
>> Please help drop this one since we'd like to use it until i_blockmask() lands to upstream.
> 
> I'm OK. Not sure if I need to resend v5?

Thanks, your patch looks fine to me.  The main reasons are that
  1) active cross tree development on cleanup stuffs;
  2) we'd like to add subpage block support for the next cycle,
     and they seem somewhat convolved...

So I will apply your patch when i_blockmask() is landed upstream
then.

Thanks,
Gao Xiang

> 
> Thx,
> Yangtao
  

Patch

diff --git a/fs/erofs/data.c b/fs/erofs/data.c
index e16545849ea7..d394102ef9de 100644
--- a/fs/erofs/data.c
+++ b/fs/erofs/data.c
@@ -376,7 +376,7 @@  static ssize_t erofs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
 		if (bdev)
 			blksize_mask = bdev_logical_block_size(bdev) - 1;
 		else
-			blksize_mask = (1 << inode->i_blkbits) - 1;
+			blksize_mask = i_blockmask(inode);
 
 		if ((iocb->ki_pos | iov_iter_count(to) |
 		     iov_iter_alignment(to)) & blksize_mask)