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: <20240429073432.lvv4fll7gmeupxm6@quack3>
Date: Mon, 29 Apr 2024 09:34:32 +0200
From: Jan Kara <jack@...e.cz>
To: Zhang Yi <yi.zhang@...weicloud.com>
Cc: linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org,
	tytso@....edu, adilger.kernel@...ger.ca, jack@...e.cz,
	yi.zhang@...wei.com, chengzhihao1@...wei.com, yukuai3@...wei.com
Subject: Re: [PATCH v2 4/9] ext4: drop iblock parameter

On Wed 10-04-24 11:41:58, Zhang Yi wrote:
> From: Zhang Yi <yi.zhang@...wei.com>
> 
> The start block of the delalloc extent to be inserted is equal to
> map->m_lblk, just drop the duplicate iblock input parameter.
> 
> Signed-off-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 | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index e4043ddb07a5..cccc16506f5f 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -1712,8 +1712,7 @@ static int ext4_insert_delayed_block(struct inode *inode, ext4_lblk_t lblk)
>   * time. This function looks up the requested blocks and sets the
>   * buffer delay bit under the protection of i_data_sem.
>   */
> -static int ext4_da_map_blocks(struct inode *inode, sector_t iblock,
> -			      struct ext4_map_blocks *map,
> +static int ext4_da_map_blocks(struct inode *inode, struct ext4_map_blocks *map,
>  			      struct buffer_head *bh)
>  {
>  	struct extent_status es;
> @@ -1733,8 +1732,8 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock,
>  		  (unsigned long) map->m_lblk);
>  
>  	/* Lookup extent status tree firstly */
> -	if (ext4_es_lookup_extent(inode, iblock, NULL, &es)) {
> -		retval = es.es_len - (iblock - es.es_lblk);
> +	if (ext4_es_lookup_extent(inode, map->m_lblk, NULL, &es)) {
> +		retval = es.es_len - (map->m_lblk - es.es_lblk);
>  		if (retval > map->m_len)
>  			retval = map->m_len;
>  		map->m_len = retval;
> @@ -1754,7 +1753,7 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock,
>  			return 0;
>  		}
>  
> -		map->m_pblk = ext4_es_pblock(&es) + iblock - es.es_lblk;
> +		map->m_pblk = ext4_es_pblock(&es) + map->m_lblk - es.es_lblk;
>  		if (ext4_es_is_written(&es))
>  			map->m_flags |= EXT4_MAP_MAPPED;
>  		else if (ext4_es_is_unwritten(&es))
> @@ -1788,8 +1787,8 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock,
>  	 * inserting delalloc range haven't been delayed or allocated
>  	 * whitout holding i_rwsem and folio lock.
>  	 */
> -	if (ext4_es_lookup_extent(inode, iblock, NULL, &es)) {
> -		retval = es.es_len - (iblock - es.es_lblk);
> +	if (ext4_es_lookup_extent(inode, map->m_lblk, NULL, &es)) {
> +		retval = es.es_len - (map->m_lblk - es.es_lblk);
>  		if (retval > map->m_len)
>  			retval = map->m_len;
>  		map->m_len = retval;
> @@ -1846,7 +1845,7 @@ int ext4_da_get_block_prep(struct inode *inode, sector_t iblock,
>  	 * preallocated blocks are unmapped but should treated
>  	 * the same as allocated blocks.
>  	 */
> -	ret = ext4_da_map_blocks(inode, iblock, &map, bh);
> +	ret = ext4_da_map_blocks(inode, &map, bh);
>  	if (ret <= 0)
>  		return ret;
>  
> -- 
> 2.39.2
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ