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

switch d_materialise_unique() users to d_splice_alias()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 41d28bca b5ae6b15

+19 -29
+5 -18
Documentation/filesystems/nfs/Exporting
··· 72 72 DCACHE_DISCONNECTED) dentry is allocated and attached. 73 73 In the case of a directory, care is taken that only one dentry 74 74 can ever be attached. 75 - d_splice_alias(inode, dentry) or d_materialise_unique(dentry, inode) 76 - will introduce a new dentry into the tree; either the passed-in 77 - dentry or a preexisting alias for the given inode (such as an 78 - anonymous one created by d_obtain_alias), if appropriate. The two 79 - functions differ in their handling of directories with preexisting 80 - aliases: 81 - d_splice_alias will use any existing IS_ROOT dentry, but it will 82 - return -EIO rather than try to move a dentry with a different 83 - parent. This is appropriate for local filesystems, which 84 - should never see such an alias unless the filesystem is 85 - corrupted somehow (for example, if two on-disk directory 86 - entries refer to the same directory.) 87 - d_materialise_unique will attempt to move any dentry. This is 88 - appropriate for distributed filesystems, where finding a 89 - directory other than where we last cached it may be a normal 90 - consequence of concurrent operations on other hosts. 91 - Both functions return NULL when the passed-in dentry is used, 92 - following the calling convention of ->lookup. 75 + d_splice_alias(inode, dentry) will introduce a new dentry into the tree; 76 + either the passed-in dentry or a preexisting alias for the given inode 77 + (such as an anonymous one created by d_obtain_alias), if appropriate. 78 + It returns NULL when the passed-in dentry is used, following the calling 79 + convention of ->lookup. 93 80 94 81 95 82 Filesystem Issues
+4
Documentation/filesystems/porting
··· 463 463 of the in-tree instances did). inode_hash_lock is still held, 464 464 of course, so they are still serialized wrt removal from inode hash, 465 465 as well as wrt set() callback of iget5_locked(). 466 + -- 467 + [mandatory] 468 + d_materialise_unique() is gone; d_splice_alias() does everything you 469 + need now. Remember that they have opposite orders of arguments ;-/
+1 -1
fs/9p/vfs_inode.c
··· 832 832 * moved b under k and client parallely did a lookup for 833 833 * k/b. 834 834 */ 835 - res = d_materialise_unique(dentry, inode); 835 + res = d_splice_alias(inode, dentry); 836 836 if (!res) 837 837 v9fs_fid_add(dentry, fid); 838 838 else if (!IS_ERR(res))
+1 -1
fs/btrfs/inode.c
··· 5303 5303 return ERR_CAST(inode); 5304 5304 } 5305 5305 5306 - return d_materialise_unique(dentry, inode); 5306 + return d_splice_alias(inode, dentry); 5307 5307 } 5308 5308 5309 5309 unsigned char btrfs_filetype_table[] = {
+1 -1
fs/ceph/inode.c
··· 967 967 /* dn must be unhashed */ 968 968 if (!d_unhashed(dn)) 969 969 d_drop(dn); 970 - realdn = d_materialise_unique(dn, in); 970 + realdn = d_splice_alias(in, dn); 971 971 if (IS_ERR(realdn)) { 972 972 pr_err("splice_dentry error %ld %p inode %p ino %llx.%llx\n", 973 973 PTR_ERR(realdn), dn, in, ceph_vinop(in));
+1 -1
fs/cifs/readdir.c
··· 123 123 if (!inode) 124 124 goto out; 125 125 126 - alias = d_materialise_unique(dentry, inode); 126 + alias = d_splice_alias(inode, dentry); 127 127 if (alias && !IS_ERR(alias)) 128 128 dput(alias); 129 129 out:
+2 -2
fs/fuse/dir.c
··· 372 372 if (inode && get_node_id(inode) == FUSE_ROOT_ID) 373 373 goto out_iput; 374 374 375 - newent = d_materialise_unique(entry, inode); 375 + newent = d_splice_alias(inode, entry); 376 376 err = PTR_ERR(newent); 377 377 if (IS_ERR(newent)) 378 378 goto out_err; ··· 1320 1320 if (!inode) 1321 1321 goto out; 1322 1322 1323 - alias = d_materialise_unique(dentry, inode); 1323 + alias = d_splice_alias(inode, dentry); 1324 1324 err = PTR_ERR(alias); 1325 1325 if (IS_ERR(alias)) 1326 1326 goto out;
+1 -1
fs/kernfs/dir.c
··· 807 807 } 808 808 809 809 /* instantiate and hash dentry */ 810 - ret = d_materialise_unique(dentry, inode); 810 + ret = d_splice_alias(inode, dentry); 811 811 out_unlock: 812 812 mutex_unlock(&kernfs_mutex); 813 813 return ret;
+2 -2
fs/nfs/dir.c
··· 499 499 if (IS_ERR(inode)) 500 500 goto out; 501 501 502 - alias = d_materialise_unique(dentry, inode); 502 + alias = d_splice_alias(inode, dentry); 503 503 if (IS_ERR(alias)) 504 504 goto out; 505 505 else if (alias) { ··· 1393 1393 nfs_advise_use_readdirplus(dir); 1394 1394 1395 1395 no_entry: 1396 - res = d_materialise_unique(dentry, inode); 1396 + res = d_splice_alias(inode, dentry); 1397 1397 if (res != NULL) { 1398 1398 if (IS_ERR(res)) 1399 1399 goto out_unblock_sillyrename;
+1 -1
fs/nfs/getroot.c
··· 51 51 /* 52 52 * Ensure that this dentry is invisible to d_find_alias(). 53 53 * Otherwise, it may be spliced into the tree by 54 - * d_materialise_unique if a parent directory from the same 54 + * d_splice_alias if a parent directory from the same 55 55 * filesystem gets mounted at a later time. 56 56 * This again causes shrink_dcache_for_umount_subtree() to 57 57 * Oops, since the test for IS_ROOT() will fail.
-1
include/linux/dcache.h
··· 230 230 */ 231 231 extern void d_instantiate(struct dentry *, struct inode *); 232 232 extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); 233 - #define d_materialise_unique(d, i) d_splice_alias(i, d) 234 233 extern int d_instantiate_no_diralias(struct dentry *, struct inode *); 235 234 extern void __d_drop(struct dentry *dentry); 236 235 extern void d_drop(struct dentry *dentry);