linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: harshad shirwadkar <harshadshirwadkar@gmail.com>
To: Andreas Dilger <adilger@dilger.ca>
Cc: Ext4 Developers List <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH 1/2] ext4: return lblk from ext4_find_entry
Date: Mon, 6 Apr 2020 23:35:32 -0700	[thread overview]
Message-ID: <CAD+ocbwDor6uoQzuP+DrER8XXsoYZWzud5yo74pG=k20-ysOyQ@mail.gmail.com> (raw)
In-Reply-To: <34AB07FF-1872-46EB-B7B6-5CE24EFB39C6@dilger.ca>

On Sat, Mar 28, 2020 at 4:24 PM Andreas Dilger <adilger@dilger.ca> wrote:
>
> On Mar 25, 2020, at 3:37 AM, Harshad Shirwadkar <harshadshirwadkar@gmail.com> wrote:
> >
> > This patch makes ext4_find_entry and related routines to return
> > logical block address of the dirent block. This logical block address
> > is used in the directory shrinking code to perform reverse lookup and
> > verify that the lookup was successful.
> >
> > Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
> > ---
> > fs/ext4/namei.c | 54 +++++++++++++++++++++++++++++--------------------
> > 1 file changed, 32 insertions(+), 22 deletions(-)
>
> Would it make sense to add the "lblk" field to struct ext4_renament,
> rather than adding an extra argument for all of these functions?

ext4_renament is only available in ext4_rename_delete(), for other
callers we still need a way to use lblk. So, I am not sure if adding
lblk to ext4_renament is helpful. Am I missing something here?


>
> Otherwise, the patch looks OK.
>
> Reviewed-by: Andreas Dilger <adilger@dilger.ca>
>
> > static void ext4_rename_delete(handle_t *handle, struct ext4_renament *ent,
> > -                            int force_reread)
> > +                            int force_reread, ext4_lblk_t lblk)
> > {
> >       int retval;
> >       /*
> > @@ -3593,7 +3600,8 @@ static void ext4_rename_delete(handle_t *handle, struct ext4_renament *ent,
> >               retval = ext4_find_delete_entry(handle, ent->dir,
> >                                               &ent->dentry->d_name);
> >       } else {
> > -             retval = ext4_delete_entry(handle, ent->dir, ent->de, ent->bh);
> > +             retval = ext4_delete_entry(handle, ent->dir, ent->de, ent->bh,
> > +                                        lblk);
> >               if (retval == -ENOENT) {
> >                       retval = ext4_find_delete_entry(handle, ent->dir,
> >                                                       &ent->dentry->d_name);
> > @@ -3679,6 +3687,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
> >       struct inode *whiteout = NULL;
> >       int credits;
> >       u8 old_file_type;
> > +     ext4_lblk_t lblk;
> >
> >       if (new.inode && new.inode->i_nlink == 0) {
> >               EXT4_ERROR_INODE(new.inode,
> > @@ -3706,7 +3715,8 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
> >                       return retval;
> >       }
> >
> > -     old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de, NULL);
> > +     old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de, NULL,
> > +                              &lblk);
> >       if (IS_ERR(old.bh))
> >               return PTR_ERR(old.bh);
> >       /*
> > @@ -3720,7 +3730,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
> >               goto end_rename;
> >
> >       new.bh = ext4_find_entry(new.dir, &new.dentry->d_name,
> > -                              &new.de, &new.inlined);
> > +                              &new.de, &new.inlined, NULL);
> >       if (IS_ERR(new.bh)) {
> >               retval = PTR_ERR(new.bh);
> >               new.bh = NULL;
> > @@ -3817,7 +3827,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
> >               /*
> >                * ok, that's it
> >                */
> > -             ext4_rename_delete(handle, &old, force_reread);
> > +             ext4_rename_delete(handle, &old, force_reread, lblk);
> >       }
> >
> >       if (new.inode) {
> > @@ -3900,7 +3910,7 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
> >               return retval;
> >
> >       old.bh = ext4_find_entry(old.dir, &old.dentry->d_name,
> > -                              &old.de, &old.inlined);
> > +                              &old.de, &old.inlined, NULL);
> >       if (IS_ERR(old.bh))
> >               return PTR_ERR(old.bh);
> >       /*
> > @@ -3914,7 +3924,7 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
> >               goto end_rename;
> >
> >       new.bh = ext4_find_entry(new.dir, &new.dentry->d_name,
> > -                              &new.de, &new.inlined);
> > +                              &new.de, &new.inlined, NULL);
> >       if (IS_ERR(new.bh)) {
> >               retval = PTR_ERR(new.bh);
> >               new.bh = NULL;
> > --
> > 2.25.1.696.g5e7596f4ac-goog
> >
>
>
> Cheers, Andreas
>
>
>
>
>

      reply	other threads:[~2020-04-07  6:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-25  9:37 [PATCH 1/2] ext4: return lblk from ext4_find_entry Harshad Shirwadkar
2020-03-25  9:37 ` [PATCH 2/2] ext4: shrink directories on dentry delete Harshad Shirwadkar
2020-03-25 10:06   ` Andreas Dilger
2020-03-26 19:49     ` harshad shirwadkar
2020-03-26 21:07       ` Andreas Dilger
2020-03-29  0:01   ` Andreas Dilger
2020-04-07  6:39     ` harshad shirwadkar
2020-03-28 23:24 ` [PATCH 1/2] ext4: return lblk from ext4_find_entry Andreas Dilger
2020-04-07  6:35   ` harshad shirwadkar [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='CAD+ocbwDor6uoQzuP+DrER8XXsoYZWzud5yo74pG=k20-ysOyQ@mail.gmail.com' \
    --to=harshadshirwadkar@gmail.com \
    --cc=adilger@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).