diff options
author | J. Bruce Fields <bfields@redhat.com> | 2014-02-18 12:31:31 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-08-07 14:40:10 -0400 |
commit | 9635389534a765c8357d988e53d323bf033dcdd0 (patch) | |
tree | 3e294b124ec27aa7b09cbc7710db0dc715486310 /Documentation | |
parent | 8d80d7dabe9668965574669afbd31733f7b0fe9b (diff) |
exportfs: update Exporting documentation
Minor documentation updates:
- refer to d_obtain_alias rather than d_alloc_anon
- explain when to use d_splice_alias and when
d_materialise_unique.
- cut some details of d_splice_alias/d_materialise_unique
implementation.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/filesystems/nfs/Exporting | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/Documentation/filesystems/nfs/Exporting b/Documentation/filesystems/nfs/Exporting index e543b1a619cc..c8f036a9b13f 100644 --- a/Documentation/filesystems/nfs/Exporting +++ b/Documentation/filesystems/nfs/Exporting | |||
@@ -66,23 +66,31 @@ b/ A per-superblock list "s_anon" of dentries which are the roots of | |||
66 | 66 | ||
67 | c/ Helper routines to allocate anonymous dentries, and to help attach | 67 | c/ Helper routines to allocate anonymous dentries, and to help attach |
68 | loose directory dentries at lookup time. They are: | 68 | loose directory dentries at lookup time. They are: |
69 | d_alloc_anon(inode) will return a dentry for the given inode. | 69 | d_obtain_alias(inode) will return a dentry for the given inode. |
70 | If the inode already has a dentry, one of those is returned. | 70 | If the inode already has a dentry, one of those is returned. |
71 | If it doesn't, a new anonymous (IS_ROOT and | 71 | If it doesn't, a new anonymous (IS_ROOT and |
72 | DCACHE_DISCONNECTED) dentry is allocated and attached. | 72 | DCACHE_DISCONNECTED) dentry is allocated and attached. |
73 | In the case of a directory, care is taken that only one dentry | 73 | In the case of a directory, care is taken that only one dentry |
74 | can ever be attached. | 74 | can ever be attached. |
75 | d_splice_alias(inode, dentry) will make sure that there is a | 75 | d_splice_alias(inode, dentry) or d_materialise_unique(dentry, inode) |
76 | dentry with the same name and parent as the given dentry, and | 76 | will introduce a new dentry into the tree; either the passed-in |
77 | which refers to the given inode. | 77 | dentry or a preexisting alias for the given inode (such as an |
78 | If the inode is a directory and already has a dentry, then that | 78 | anonymous one created by d_obtain_alias), if appropriate. The two |
79 | dentry is d_moved over the given dentry. | 79 | functions differ in their handling of directories with preexisting |
80 | If the passed dentry gets attached, care is taken that this is | 80 | aliases: |
81 | mutually exclusive to a d_alloc_anon operation. | 81 | d_splice_alias will use any existing IS_ROOT dentry, but it will |
82 | If the passed dentry is used, NULL is returned, else the used | 82 | return -EIO rather than try to move a dentry with a different |
83 | dentry is returned. This corresponds to the calling pattern of | 83 | parent. This is appropriate for local filesystems, which |
84 | ->lookup. | 84 | should never see such an alias unless the filesystem is |
85 | 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. | ||
93 | |||
86 | 94 | ||
87 | Filesystem Issues | 95 | Filesystem Issues |
88 | ----------------- | 96 | ----------------- |
@@ -120,12 +128,12 @@ struct which has the following members: | |||
120 | 128 | ||
121 | fh_to_dentry (mandatory) | 129 | fh_to_dentry (mandatory) |
122 | Given a filehandle fragment, this should find the implied object and | 130 | Given a filehandle fragment, this should find the implied object and |
123 | create a dentry for it (possibly with d_alloc_anon). | 131 | create a dentry for it (possibly with d_obtain_alias). |
124 | 132 | ||
125 | fh_to_parent (optional but strongly recommended) | 133 | fh_to_parent (optional but strongly recommended) |
126 | Given a filehandle fragment, this should find the parent of the | 134 | Given a filehandle fragment, this should find the parent of the |
127 | implied object and create a dentry for it (possibly with d_alloc_anon). | 135 | implied object and create a dentry for it (possibly with |
128 | May fail if the filehandle fragment is too small. | 136 | d_obtain_alias). May fail if the filehandle fragment is too small. |
129 | 137 | ||
130 | get_parent (optional but strongly recommended) | 138 | get_parent (optional but strongly recommended) |
131 | When given a dentry for a directory, this should return a dentry for | 139 | When given a dentry for a directory, this should return a dentry for |