lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cyxlv42ng4cetw55mzxywfmzoqo7uzeemswnwn3ztfuphdpdiv@bjlhohw3gdzs>
Date: Wed, 5 Nov 2025 10:30:57 +0100
From: Jan Kara <jack@...e.cz>
To: libaokun@...weicloud.com
Cc: linux-ext4@...r.kernel.org, tytso@....edu, adilger.kernel@...ger.ca, 
	jack@...e.cz, linux-kernel@...r.kernel.org, kernel@...kajraghav.com, 
	mcgrof@...nel.org, linux-fsdevel@...r.kernel.org, linux-mm@...ck.org, 
	yi.zhang@...wei.com, yangerkun@...wei.com, chengzhihao1@...wei.com, 
	libaokun1@...wei.com
Subject: Re: [PATCH 18/25] ext4: support large block size in
 mpage_map_and_submit_buffers()

On Sat 25-10-25 11:22:14, libaokun@...weicloud.com wrote:
> From: Baokun Li <libaokun1@...wei.com>
> 
> Use the EXT4_P_TO_LBLK/EXT4_LBLK_TO_P macros to complete the conversion
> between folio indexes and blocks to avoid negative left/right shifts after
> supporting blocksize greater than PAGE_SIZE.
> 
> Signed-off-by: Baokun Li <libaokun1@...wei.com>
> Reviewed-by: Zhang Yi <yi.zhang@...wei.com>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@...e.cz>

								Honza

> ---
>  fs/ext4/inode.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index d97ce88d6e0a..cbf04b473ae7 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -2289,15 +2289,14 @@ static int mpage_map_and_submit_buffers(struct mpage_da_data *mpd)
>  	struct folio_batch fbatch;
>  	unsigned nr, i;
>  	struct inode *inode = mpd->inode;
> -	int bpp_bits = PAGE_SHIFT - inode->i_blkbits;
>  	pgoff_t start, end;
>  	ext4_lblk_t lblk;
>  	ext4_fsblk_t pblock;
>  	int err;
>  	bool map_bh = false;
>  
> -	start = mpd->map.m_lblk >> bpp_bits;
> -	end = (mpd->map.m_lblk + mpd->map.m_len - 1) >> bpp_bits;
> +	start = EXT4_LBLK_TO_P(inode, mpd->map.m_lblk);
> +	end = EXT4_LBLK_TO_P(inode, mpd->map.m_lblk + mpd->map.m_len - 1);
>  	pblock = mpd->map.m_pblk;
>  
>  	folio_batch_init(&fbatch);
> @@ -2308,7 +2307,7 @@ static int mpage_map_and_submit_buffers(struct mpage_da_data *mpd)
>  		for (i = 0; i < nr; i++) {
>  			struct folio *folio = fbatch.folios[i];
>  
> -			lblk = folio->index << bpp_bits;
> +			lblk = EXT4_P_TO_LBLK(inode, folio->index);
>  			err = mpage_process_folio(mpd, folio, &lblk, &pblock,
>  						 &map_bh);
>  			/*
> -- 
> 2.46.1
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ