summaryrefslogtreecommitdiffstats
path: root/Documentation/filesystems/porting
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-10-10 16:52:37 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2018-10-10 16:52:37 -0400
commit1a16dbaf798c5b68ac767444eb045e6f3adaa16d (patch)
treea3e9365becacb65cd1fc6236170665f65196324b /Documentation/filesystems/porting
parent3837d208d8fe7437475c4a1c53fa5e517b16ceb0 (diff)
downloadblackbird-obmc-linux-1a16dbaf798c5b68ac767444eb045e6f3adaa16d.tar.gz
blackbird-obmc-linux-1a16dbaf798c5b68ac767444eb045e6f3adaa16d.zip
Document d_splice_alias() calling conventions for ->lookup() users.
Short version: it does the right thing when given NULL or ERR_PTR(...) and its calling conventions are chosen to have minimal PITA when used in ->lookup() instances. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'Documentation/filesystems/porting')
-rw-r--r--Documentation/filesystems/porting11
1 files changed, 11 insertions, 0 deletions
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting
index 7b7b845c490a..321d74b73937 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -622,3 +622,14 @@ in your dentry operations instead.
alloc_file_clone(file, flags, ops) does not affect any caller's references.
On success you get a new struct file sharing the mount/dentry with the
original, on failure - ERR_PTR().
+--
+[recommended]
+ ->lookup() instances doing an equivalent of
+ if (IS_ERR(inode))
+ return ERR_CAST(inode);
+ return d_splice_alias(inode, dentry);
+ don't need to bother with the check - d_splice_alias() will do the
+ right thing when given ERR_PTR(...) as inode. Moreover, passing NULL
+ inode to d_splice_alias() will also do the right thing (equivalent of
+ d_add(dentry, NULL); return NULL;), so that kind of special cases
+ also doesn't need a separate treatment.
OpenPOWER on IntegriCloud