linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@dilger.ca>
To: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/2] ext4: return lblk from ext4_find_entry
Date: Sat, 28 Mar 2020 17:24:10 -0600	[thread overview]
Message-ID: <34AB07FF-1872-46EB-B7B6-5CE24EFB39C6@dilger.ca> (raw)
In-Reply-To: <20200325093728.204211-1-harshadshirwadkar@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3422 bytes --]

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?

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






[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]

  parent reply	other threads:[~2020-03-28 23:24 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 ` Andreas Dilger [this message]
2020-04-07  6:35   ` [PATCH 1/2] ext4: return lblk from ext4_find_entry harshad shirwadkar

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=34AB07FF-1872-46EB-B7B6-5CE24EFB39C6@dilger.ca \
    --to=adilger@dilger.ca \
    --cc=harshadshirwadkar@gmail.com \
    --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).