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: <aCxccnStpSuJ5ZhU@li-dc0c254c-257c-11b2-a85c-98b6c1322444.ibm.com>
Date: Tue, 20 May 2025 16:11:54 +0530
From: Ojaswin Mujoo <ojaswin@...ux.ibm.com>
To: Zhang Yi <yi.zhang@...weicloud.com>
Cc: linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org, willy@...radead.org, tytso@....edu,
        adilger.kernel@...ger.ca, jack@...e.cz, yi.zhang@...wei.com,
        libaokun1@...wei.com, yukuai3@...wei.com, yangerkun@...wei.com
Subject: Re: [PATCH v2 3/8] ext4: make __ext4_block_zero_page_range() support
 large folio

On Mon, May 12, 2025 at 02:33:14PM +0800, Zhang Yi wrote:
> From: Zhang Yi <yi.zhang@...wei.com>
> 
> The partial block zero range helper __ext4_block_zero_page_range()
> currently only supports folios of PAGE_SIZE in size. The calculations
> for the start block and the offset within a folio for the given range
> are incorrect. Modify the implementation to use offset_in_folio()
> instead of directly masking PAGE_SIZE - 1, which will be able to support
> for large folios.

Looks good, feel free to add:

Reviewed-by: Ojaswin Mujoo <ojaswin@...ux.ibm.com>

> 
> Signed-off-by: Zhang Yi <yi.zhang@...wei.com>
> ---
>  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 4d8187f3814e..573ae0b3be1d 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3701,9 +3701,7 @@ void ext4_set_aops(struct inode *inode)
>  static int __ext4_block_zero_page_range(handle_t *handle,
>  		struct address_space *mapping, loff_t from, loff_t length)
>  {
> -	ext4_fsblk_t index = from >> PAGE_SHIFT;
> -	unsigned offset = from & (PAGE_SIZE-1);
> -	unsigned blocksize, pos;
> +	unsigned int offset, blocksize, pos;
>  	ext4_lblk_t iblock;
>  	struct inode *inode = mapping->host;
>  	struct buffer_head *bh;
> @@ -3718,13 +3716,14 @@ static int __ext4_block_zero_page_range(handle_t *handle,
>  
>  	blocksize = inode->i_sb->s_blocksize;
>  
> -	iblock = index << (PAGE_SHIFT - inode->i_sb->s_blocksize_bits);
> +	iblock = folio->index << (PAGE_SHIFT - inode->i_sb->s_blocksize_bits);
>  
>  	bh = folio_buffers(folio);
>  	if (!bh)
>  		bh = create_empty_buffers(folio, blocksize, 0);
>  
>  	/* Find the buffer that contains "offset" */
> +	offset = offset_in_folio(folio, from);
>  	pos = blocksize;
>  	while (offset >= pos) {
>  		bh = bh->b_this_page;
> -- 
> 2.46.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ