aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/filesystems/vfs.txt
diff options
context:
space:
mode:
authorNick Piggin <npiggin@kernel.dk>2011-01-07 01:49:27 -0500
committerNick Piggin <npiggin@kernel.dk>2011-01-07 01:50:19 -0500
commit621e155a3591962420eacdd39f6f0aa29ceb221e (patch)
tree387a9fb396f1bf24514b712c294182e36ba51076 /Documentation/filesystems/vfs.txt
parentfb2d5b86aff355a27ebfc132d3c99f4a940cc3fe (diff)
fs: change d_compare for rcu-walk
Change d_compare so it may be called from lock-free RCU lookups. This does put significant restrictions on what may be done from the callback, however there don't seem to have been any problems with in-tree fses. If some strange use case pops up that _really_ cannot cope with the rcu-walk rules, we can just add new rcu-unaware callbacks, which would cause name lookup to drop out of rcu-walk mode. For in-tree filesystems, this is just a mechanical change. Signed-off-by: Nick Piggin <npiggin@kernel.dk>
Diffstat (limited to 'Documentation/filesystems/vfs.txt')
-rw-r--r--Documentation/filesystems/vfs.txt26
1 files changed, 23 insertions, 3 deletions
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index 95c0a93f056c..250681b8c7cc 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -848,7 +848,9 @@ defined:
848struct dentry_operations { 848struct dentry_operations {
849 int (*d_revalidate)(struct dentry *, struct nameidata *); 849 int (*d_revalidate)(struct dentry *, struct nameidata *);
850 int (*d_hash)(struct dentry *, struct qstr *); 850 int (*d_hash)(struct dentry *, struct qstr *);
851 int (*d_compare)(struct dentry *, struct qstr *, struct qstr *); 851 int (*d_compare)(const struct dentry *, const struct inode *,
852 const struct dentry *, const struct inode *,
853 unsigned int, const char *, const struct qstr *);
852 int (*d_delete)(const struct dentry *); 854 int (*d_delete)(const struct dentry *);
853 void (*d_release)(struct dentry *); 855 void (*d_release)(struct dentry *);
854 void (*d_iput)(struct dentry *, struct inode *); 856 void (*d_iput)(struct dentry *, struct inode *);
@@ -860,9 +862,27 @@ struct dentry_operations {
860 dcache. Most filesystems leave this as NULL, because all their 862 dcache. Most filesystems leave this as NULL, because all their
861 dentries in the dcache are valid 863 dentries in the dcache are valid
862 864
863 d_hash: called when the VFS adds a dentry to the hash table 865 d_hash: called when the VFS adds a dentry to the hash table. The first
866 dentry passed to d_hash is the parent directory that the name is
867 to be hashed into.
864 868
865 d_compare: called when a dentry should be compared with another 869 d_compare: called to compare a dentry name with a given name. The first
870 dentry is the parent of the dentry to be compared, the second is
871 the parent's inode, then the dentry and inode (may be NULL) of the
872 child dentry. len and name string are properties of the dentry to be
873 compared. qstr is the name to compare it with.
874
875 Must be constant and idempotent, and should not take locks if
876 possible, and should not or store into the dentry or inodes.
877 Should not dereference pointers outside the dentry or inodes without
878 lots of care (eg. d_parent, d_inode, d_name should not be used).
879
880 However, our vfsmount is pinned, and RCU held, so the dentries and
881 inodes won't disappear, neither will our sb or filesystem module.
882 ->i_sb and ->d_sb may be used.
883
884 It is a tricky calling convention because it needs to be called under
885 "rcu-walk", ie. without any locks or references on things.
866 886
867 d_delete: called when the last reference to a dentry is dropped and the 887 d_delete: called when the last reference to a dentry is dropped and the
868 dcache is deciding whether or not to cache it. Return 1 to delete 888 dcache is deciding whether or not to cache it. Return 1 to delete