From: NeilBrown <neilb@ownmail.net>
To: "Theodore Ts'o" <tytso@mit.edu>,
Andreas Dilger <adilger.kernel@dilger.ca>,
Jan Kara <jack@suse.cz>
Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH 1/3] ext4: split __ext4_add_entry() out of ext4_add_entry()
Date: Wed, 18 Mar 2026 09:39:49 +1100 [thread overview]
Message-ID: <20260317224638.3809014-2-neilb@ownmail.net> (raw)
In-Reply-To: <20260317224638.3809014-1-neilb@ownmail.net>
From: NeilBrown <neil@brown.name>
__ext4_add_entry() is not given a dentry - just inodes and name.
This will help the next patch which simplifies __ex4_link().
Signed-off-by: NeilBrown <neil@brown.name>
---
fs/ext4/namei.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index c4b5e252af0e..768036a109d7 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2353,10 +2353,10 @@ static int make_indexed_dir(handle_t *handle, struct ext4_filename *fname,
* may not sleep between calling this and putting something into
* the entry, as someone else might have used it while you slept.
*/
-static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
+static int __ext4_add_entry(handle_t *handle, struct inode *dir,
+ const struct qstr *d_name,
struct inode *inode)
{
- struct inode *dir = d_inode(dentry->d_parent);
struct buffer_head *bh = NULL;
struct ext4_dir_entry_2 *de;
struct super_block *sb;
@@ -2373,13 +2373,10 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
sb = dir->i_sb;
blocksize = sb->s_blocksize;
- if (fscrypt_is_nokey_name(dentry))
- return -ENOKEY;
-
- if (!generic_ci_validate_strict_name(dir, &dentry->d_name))
+ if (!generic_ci_validate_strict_name(dir, d_name))
return -EINVAL;
- retval = ext4_fname_setup_filename(dir, &dentry->d_name, 0, &fname);
+ retval = ext4_fname_setup_filename(dir, d_name, 0, &fname);
if (retval)
return retval;
@@ -2460,6 +2457,16 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
return retval;
}
+static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
+ struct inode *inode)
+{
+ struct inode *dir = d_inode(dentry->d_parent);
+
+ if (fscrypt_is_nokey_name(dentry))
+ return -ENOKEY;
+ return __ext4_add_entry(handle, dir, &dentry->d_name, inode);
+}
+
/*
* Returns 0 for success, or a negative error value
*/
--
2.50.0.107.gf914562f5916.dirty
next prev parent reply other threads:[~2026-03-17 22:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-17 22:39 [PATCH 0/3] ext4: remove use of d_alloc() NeilBrown
2026-03-17 22:39 ` NeilBrown [this message]
2026-03-18 0:20 ` [PATCH 1/3] ext4: split __ext4_add_entry() out of ext4_add_entry() Andreas Dilger
2026-03-18 17:56 ` Jan Kara
2026-03-17 22:39 ` [PATCH 2/3] ext4: add ext4_fc_eligible() NeilBrown
2026-03-18 0:27 ` Andreas Dilger
2026-03-18 17:57 ` Jan Kara
2026-03-19 23:31 ` NeilBrown
2026-03-20 5:12 ` Andreas Dilger
2026-03-20 10:24 ` Jan Kara
2026-03-17 22:39 ` [PATCH 3/3] ext4: move dcache manipulation out of __ext4_link() NeilBrown
2026-03-18 18:03 ` Jan Kara
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=20260317224638.3809014-2-neilb@ownmail.net \
--to=neilb@ownmail.net \
--cc=adilger.kernel@dilger.ca \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=neil@brown.name \
--cc=tytso@mit.edu \
/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