Loading Documentation/filesystems/nfs/Exporting +5 −18 Original line number Original line Diff line number Diff line Loading @@ -72,24 +72,11 @@ c/ Helper routines to allocate anonymous dentries, and to help attach DCACHE_DISCONNECTED) dentry is allocated and attached. DCACHE_DISCONNECTED) dentry is allocated and attached. In the case of a directory, care is taken that only one dentry In the case of a directory, care is taken that only one dentry can ever be attached. can ever be attached. d_splice_alias(inode, dentry) or d_materialise_unique(dentry, inode) d_splice_alias(inode, dentry) will introduce a new dentry into the tree; will introduce a new dentry into the tree; either the passed-in either the passed-in dentry or a preexisting alias for the given inode dentry or a preexisting alias for the given inode (such as an (such as an anonymous one created by d_obtain_alias), if appropriate. anonymous one created by d_obtain_alias), if appropriate. The two It returns NULL when the passed-in dentry is used, following the calling functions differ in their handling of directories with preexisting convention of ->lookup. aliases: d_splice_alias will use any existing IS_ROOT dentry, but it will return -EIO rather than try to move a dentry with a different parent. This is appropriate for local filesystems, which should never see such an alias unless the filesystem is corrupted somehow (for example, if two on-disk directory entries refer to the same directory.) d_materialise_unique will attempt to move any dentry. This is appropriate for distributed filesystems, where finding a directory other than where we last cached it may be a normal consequence of concurrent operations on other hosts. Both functions return NULL when the passed-in dentry is used, following the calling convention of ->lookup. Filesystem Issues Filesystem Issues Loading Documentation/filesystems/porting +4 −0 Original line number Original line Diff line number Diff line Loading @@ -463,3 +463,7 @@ in your dentry operations instead. of the in-tree instances did). inode_hash_lock is still held, of the in-tree instances did). inode_hash_lock is still held, of course, so they are still serialized wrt removal from inode hash, of course, so they are still serialized wrt removal from inode hash, as well as wrt set() callback of iget5_locked(). as well as wrt set() callback of iget5_locked(). -- [mandatory] d_materialise_unique() is gone; d_splice_alias() does everything you need now. Remember that they have opposite orders of arguments ;-/ fs/9p/vfs_inode.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -832,7 +832,7 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, * moved b under k and client parallely did a lookup for * moved b under k and client parallely did a lookup for * k/b. * k/b. */ */ res = d_materialise_unique(dentry, inode); res = d_splice_alias(inode, dentry); if (!res) if (!res) v9fs_fid_add(dentry, fid); v9fs_fid_add(dentry, fid); else if (!IS_ERR(res)) else if (!IS_ERR(res)) Loading fs/btrfs/inode.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -5303,7 +5303,7 @@ static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry, return ERR_CAST(inode); return ERR_CAST(inode); } } return d_materialise_unique(dentry, inode); return d_splice_alias(inode, dentry); } } unsigned char btrfs_filetype_table[] = { unsigned char btrfs_filetype_table[] = { Loading fs/ceph/inode.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -967,7 +967,7 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in, /* dn must be unhashed */ /* dn must be unhashed */ if (!d_unhashed(dn)) if (!d_unhashed(dn)) d_drop(dn); d_drop(dn); realdn = d_materialise_unique(dn, in); realdn = d_splice_alias(in, dn); if (IS_ERR(realdn)) { if (IS_ERR(realdn)) { pr_err("splice_dentry error %ld %p inode %p ino %llx.%llx\n", pr_err("splice_dentry error %ld %p inode %p ino %llx.%llx\n", PTR_ERR(realdn), dn, in, ceph_vinop(in)); PTR_ERR(realdn), dn, in, ceph_vinop(in)); Loading Loading
Documentation/filesystems/nfs/Exporting +5 −18 Original line number Original line Diff line number Diff line Loading @@ -72,24 +72,11 @@ c/ Helper routines to allocate anonymous dentries, and to help attach DCACHE_DISCONNECTED) dentry is allocated and attached. DCACHE_DISCONNECTED) dentry is allocated and attached. In the case of a directory, care is taken that only one dentry In the case of a directory, care is taken that only one dentry can ever be attached. can ever be attached. d_splice_alias(inode, dentry) or d_materialise_unique(dentry, inode) d_splice_alias(inode, dentry) will introduce a new dentry into the tree; will introduce a new dentry into the tree; either the passed-in either the passed-in dentry or a preexisting alias for the given inode dentry or a preexisting alias for the given inode (such as an (such as an anonymous one created by d_obtain_alias), if appropriate. anonymous one created by d_obtain_alias), if appropriate. The two It returns NULL when the passed-in dentry is used, following the calling functions differ in their handling of directories with preexisting convention of ->lookup. aliases: d_splice_alias will use any existing IS_ROOT dentry, but it will return -EIO rather than try to move a dentry with a different parent. This is appropriate for local filesystems, which should never see such an alias unless the filesystem is corrupted somehow (for example, if two on-disk directory entries refer to the same directory.) d_materialise_unique will attempt to move any dentry. This is appropriate for distributed filesystems, where finding a directory other than where we last cached it may be a normal consequence of concurrent operations on other hosts. Both functions return NULL when the passed-in dentry is used, following the calling convention of ->lookup. Filesystem Issues Filesystem Issues Loading
Documentation/filesystems/porting +4 −0 Original line number Original line Diff line number Diff line Loading @@ -463,3 +463,7 @@ in your dentry operations instead. of the in-tree instances did). inode_hash_lock is still held, of the in-tree instances did). inode_hash_lock is still held, of course, so they are still serialized wrt removal from inode hash, of course, so they are still serialized wrt removal from inode hash, as well as wrt set() callback of iget5_locked(). as well as wrt set() callback of iget5_locked(). -- [mandatory] d_materialise_unique() is gone; d_splice_alias() does everything you need now. Remember that they have opposite orders of arguments ;-/
fs/9p/vfs_inode.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -832,7 +832,7 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, * moved b under k and client parallely did a lookup for * moved b under k and client parallely did a lookup for * k/b. * k/b. */ */ res = d_materialise_unique(dentry, inode); res = d_splice_alias(inode, dentry); if (!res) if (!res) v9fs_fid_add(dentry, fid); v9fs_fid_add(dentry, fid); else if (!IS_ERR(res)) else if (!IS_ERR(res)) Loading
fs/btrfs/inode.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -5303,7 +5303,7 @@ static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry, return ERR_CAST(inode); return ERR_CAST(inode); } } return d_materialise_unique(dentry, inode); return d_splice_alias(inode, dentry); } } unsigned char btrfs_filetype_table[] = { unsigned char btrfs_filetype_table[] = { Loading
fs/ceph/inode.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -967,7 +967,7 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in, /* dn must be unhashed */ /* dn must be unhashed */ if (!d_unhashed(dn)) if (!d_unhashed(dn)) d_drop(dn); d_drop(dn); realdn = d_materialise_unique(dn, in); realdn = d_splice_alias(in, dn); if (IS_ERR(realdn)) { if (IS_ERR(realdn)) { pr_err("splice_dentry error %ld %p inode %p ino %llx.%llx\n", pr_err("splice_dentry error %ld %p inode %p ino %llx.%llx\n", PTR_ERR(realdn), dn, in, ceph_vinop(in)); PTR_ERR(realdn), dn, in, ceph_vinop(in)); Loading