All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: "zhangyi (F)" <yi.zhang@huawei.com>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu, jack@suse.cz,
	adilger.kernel@dilger.ca, miaoxie@huawei.com
Subject: Re: [PATCH v3 4/4] ext4: convert ext4_split_extent() to return requested length
Date: Mon, 28 Jan 2019 16:39:49 +0100	[thread overview]
Message-ID: <20190128153949.GG5858@quack2.suse.cz> (raw)
In-Reply-To: <1548419456-4331-5-git-send-email-yi.zhang@huawei.com>

On Fri 25-01-19 20:30:56, zhangyi (F) wrote:
> After we remove clean_bdev_aliases() calls which used to unmap extra
> blocks in ext4_ext_handle_unwritten_extents(), return extra initialized
> region in ext4_ext_convert_to_initialized() is no longer needed, so
> in order to simplify logic, this patch convert to return the requested
> size instead.
> 
> Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>

Looks good to me. You can add:

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

								Honza

> ---
>  fs/ext4/extents.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index ffb72d8..ffe9671 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -3456,9 +3456,8 @@ static int ext4_split_extent(handle_t *handle,
>   *    of the logical span [map->m_lblk, map->m_lblk + map->m_len).
>   *
>   * Post-conditions on success:
> - *  - the returned value is the number of blocks beyond map->l_lblk
> - *    that are allocated and initialized.
> - *    It is guaranteed to be >= map->m_len.
> + *  - The returned value is the minimum number of requested blocks or
> + *    initialized blocks. It is guaranteed to be <= map->m_len.
>   */
>  static int ext4_ext_convert_to_initialized(handle_t *handle,
>  					   struct inode *inode,
> @@ -3700,7 +3699,6 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
>  
>  			split_map.m_len += split_map.m_lblk - ee_block;
>  			split_map.m_lblk = ee_block;
> -			allocated = map->m_len;
>  		}
>  	}
>  
> @@ -3709,6 +3707,9 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
>  	if (err > 0)
>  		err = 0;
>  out:
> +	if (allocated > map->m_len)
> +		allocated = map->m_len;
> +
>  	/* If we have gotten a failure, don't zero out status tree */
>  	if (!err) {
>  		err = ext4_zeroout_es(inode, &zero_ex1);
> @@ -4065,11 +4066,10 @@ ext4_ext_handle_unwritten_extents(handle_t *handle, struct inode *inode,
>  	if (ret <= 0) {
>  		err = ret;
>  		goto out2;
> -	} else
> -		allocated = ret;
> +	}
> +
> +	allocated = ret;
>  	map->m_flags |= EXT4_MAP_NEW;
> -	if (allocated > map->m_len)
> -		allocated = map->m_len;
>  	map->m_len = allocated;
>  
>  map_out:
> -- 
> 2.7.4
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

      reply	other threads:[~2019-01-28 15:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-25 12:30 [PATCH v3 0/4] ext4: fix a data corruption problem zhangyi (F)
2019-01-25 12:30 ` [PATCH v3 1/4] jbd2: make sure dirty flag is cleared while revorking a buffer which belongs to older transaction zhangyi (F)
2019-01-28 15:24   ` Jan Kara
2019-01-25 12:30 ` [PATCH v3 2/4] jbd2: discard dirty data when forgetting an un-journalled buffer zhangyi (F)
2019-01-28 15:26   ` Jan Kara
2019-01-25 12:30 ` [PATCH v3 3/4] ext4: cleanup clean_bdev_aliases() calls zhangyi (F)
2019-01-28 15:26   ` Jan Kara
2019-01-25 12:30 ` [PATCH v3 4/4] ext4: convert ext4_split_extent() to return requested length zhangyi (F)
2019-01-28 15:39   ` Jan Kara [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190128153949.GG5858@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=miaoxie@huawei.com \
    --cc=tytso@mit.edu \
    --cc=yi.zhang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.