Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ext4: split __ext4_add_entry() out of ext4_add_entry()

__ext4_add_entry() is not given a dentry - just inodes and name.
This will help the next patch which simplifies __ex4_link().

Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: NeilBrown <neil@brown.name>
Link: https://patch.msgid.link/20260320000838.3797494-2-neilb@ownmail.net
Signed-off-by: Theodore Ts'o <tytso@mit.edu>

authored by

NeilBrown and committed by
Theodore Ts'o
28793746 1d749e11

+14 -7
+14 -7
fs/ext4/namei.c
··· 2353 2353 * may not sleep between calling this and putting something into 2354 2354 * the entry, as someone else might have used it while you slept. 2355 2355 */ 2356 - static int ext4_add_entry(handle_t *handle, struct dentry *dentry, 2356 + static int __ext4_add_entry(handle_t *handle, struct inode *dir, 2357 + const struct qstr *d_name, 2357 2358 struct inode *inode) 2358 2359 { 2359 - struct inode *dir = d_inode(dentry->d_parent); 2360 2360 struct buffer_head *bh = NULL; 2361 2361 struct ext4_dir_entry_2 *de; 2362 2362 struct super_block *sb; ··· 2373 2373 sb = dir->i_sb; 2374 2374 blocksize = sb->s_blocksize; 2375 2375 2376 - if (fscrypt_is_nokey_name(dentry)) 2377 - return -ENOKEY; 2378 - 2379 - if (!generic_ci_validate_strict_name(dir, &dentry->d_name)) 2376 + if (!generic_ci_validate_strict_name(dir, d_name)) 2380 2377 return -EINVAL; 2381 2378 2382 - retval = ext4_fname_setup_filename(dir, &dentry->d_name, 0, &fname); 2379 + retval = ext4_fname_setup_filename(dir, d_name, 0, &fname); 2383 2380 if (retval) 2384 2381 return retval; 2385 2382 ··· 2455 2458 if (retval == 0) 2456 2459 ext4_set_inode_state(inode, EXT4_STATE_NEWENTRY); 2457 2460 return retval; 2461 + } 2462 + 2463 + static int ext4_add_entry(handle_t *handle, struct dentry *dentry, 2464 + struct inode *inode) 2465 + { 2466 + struct inode *dir = d_inode(dentry->d_parent); 2467 + 2468 + if (fscrypt_is_nokey_name(dentry)) 2469 + return -ENOKEY; 2470 + return __ext4_add_entry(handle, dir, &dentry->d_name, inode); 2458 2471 } 2459 2472 2460 2473 /*