[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240827171620.jrnp32rcmqu36wp4@quack3>
Date: Tue, 27 Aug 2024 19:16:20 +0200
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, ritesh.list@...il.com, ojaswin@...ux.ibm.com,
linux-kernel@...r.kernel.org, yi.zhang@...wei.com,
yangerkun@...wei.com, Baokun Li <libaokun1@...wei.com>
Subject: Re: [PATCH v2 25/25] ext4: save unnecessary indentation in
ext4_ext_create_new_leaf()
On Thu 22-08-24 10:35:45, libaokun@...weicloud.com wrote:
> From: Baokun Li <libaokun1@...wei.com>
>
> Save an indentation level in ext4_ext_create_new_leaf() by removing
> unnecessary 'else'. Besides, the variable 'ee_block' is declared to
> avoid line breaks. No functional changes.
>
> Suggested-by: Jan Kara <jack@...e.cz>
> Signed-off-by: Baokun Li <libaokun1@...wei.com>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@...e.cz>
Honza
> ---
> fs/ext4/extents.c | 44 +++++++++++++++++++++-----------------------
> 1 file changed, 21 insertions(+), 23 deletions(-)
>
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index ca1f946514dd..45ddc0692673 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -1403,6 +1403,7 @@ ext4_ext_create_new_leaf(handle_t *handle, struct inode *inode,
> {
> struct ext4_ext_path *curp;
> int depth, i, err = 0;
> + ext4_lblk_t ee_block = le32_to_cpu(newext->ee_block);
>
> repeat:
> i = depth = ext_depth(inode);
> @@ -1424,33 +1425,30 @@ ext4_ext_create_new_leaf(handle_t *handle, struct inode *inode,
> goto errout;
>
> /* refill path */
> - path = ext4_find_extent(inode,
> - (ext4_lblk_t)le32_to_cpu(newext->ee_block),
> - path, gb_flags);
> + path = ext4_find_extent(inode, ee_block, path, gb_flags);
> return path;
> - } else {
> - /* tree is full, time to grow in depth */
> - err = ext4_ext_grow_indepth(handle, inode, mb_flags);
> - if (err)
> - goto errout;
> + }
>
> - /* refill path */
> - path = ext4_find_extent(inode,
> - (ext4_lblk_t)le32_to_cpu(newext->ee_block),
> - path, gb_flags);
> - if (IS_ERR(path))
> - return path;
> + /* tree is full, time to grow in depth */
> + err = ext4_ext_grow_indepth(handle, inode, mb_flags);
> + if (err)
> + goto errout;
>
> - /*
> - * only first (depth 0 -> 1) produces free space;
> - * in all other cases we have to split the grown tree
> - */
> - depth = ext_depth(inode);
> - if (path[depth].p_hdr->eh_entries == path[depth].p_hdr->eh_max) {
> - /* now we need to split */
> - goto repeat;
> - }
> + /* refill path */
> + path = ext4_find_extent(inode, ee_block, path, gb_flags);
> + if (IS_ERR(path))
> + return path;
> +
> + /*
> + * only first (depth 0 -> 1) produces free space;
> + * in all other cases we have to split the grown tree
> + */
> + depth = ext_depth(inode);
> + if (path[depth].p_hdr->eh_entries == path[depth].p_hdr->eh_max) {
> + /* now we need to split */
> + goto repeat;
> }
> +
> return path;
>
> errout:
> --
> 2.39.2
>
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists