Re: [PATCH 08/20] ext4: get rid of ppath in ext4_find_extent()

From: Jan Kara
Date: Mon Jul 29 2024 - 07:28:18 EST


On Sat 27-07-24 14:18:33, Baokun Li wrote:
> On 2024/7/25 18:38, Jan Kara wrote:
> > On Wed 10-07-24 12:06:42, libaokun@xxxxxxxxxxxxxxx wrote:
> > > From: Baokun Li <libaokun1@xxxxxxxxxx>
> > >
> > > The use of path and ppath is now very confusing, so to make the code more
> > > readable, pass path between functions uniformly, and get rid of ppath.
> > >
> > > Getting rid of ppath in ext4_find_extent() requires its caller to update
> > > ppath. These ppaths will also be dropped later. No functional changes.
> > >
> > > Signed-off-by: Baokun Li <libaokun1@xxxxxxxxxx>
> > One nit below, otherwise feel free to add:
> >
> > Reviewed-by: Jan Kara <jack@xxxxxxx>
> >
> > > @@ -3260,11 +3257,12 @@ static int ext4_split_extent_at(handle_t *handle,
> > > * WARN_ON may be triggered in ext4_da_update_reserve_space() due to
> > > * an incorrect ee_len causing the i_reserved_data_blocks exception.
> > > */
> > > - path = ext4_find_extent(inode, ee_block, ppath,
> > > + path = ext4_find_extent(inode, ee_block, *ppath,
> > > flags | EXT4_EX_NOFAIL);
> > > if (IS_ERR(path)) {
> > > EXT4_ERROR_INODE(inode, "Failed split extent on %u, err %ld",
> > > split, PTR_ERR(path));
> > > + *ppath = NULL;
> > > return PTR_ERR(path);
> > > }
> > I think here you forgot to update ppath on success case. It will go away by
> > the end of the series but still it's good to keep thing consistent...
> >
> > Honza
>
> Hi Honza,
>
> Thank you for your review!
>
> In patch 5, the ppath is already updated in case of success, so there
> is no need to add it here. This update was not shown when the patch
> was made and it looks like this:
>
> -       path = ext4_find_extent(inode, ee_block, ppath,
> +       path = ext4_find_extent(inode, ee_block, *ppath,
>                                 flags | EXT4_EX_NOFAIL);
>         if (IS_ERR(path)) {
>                 EXT4_ERROR_INODE(inode, "Failed split extent on %u, err
> %ld",
>                                  split, PTR_ERR(path));
> +               *ppath = NULL;
>                 return PTR_ERR(path);
>         }
>         depth = ext_depth(inode);
>         ex = path[depth].p_ext;
>         *ppath = path;

Yes, you are right. I didn't realize the update was already there. So I
withdraw my comment :)

Honza

--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR