diff options
author | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 01:49:23 -0500 |
---|---|---|
committer | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 01:50:18 -0500 |
commit | fe15ce446beb3a33583af81ffe6c9d01a75314ed (patch) | |
tree | bc8af66b6dd2d0f21a2a3f48a19975ae2cdbae4e /Documentation/filesystems/vfs.txt | |
parent | 5eef7fa905c814826f518aca2d414ca77508ce30 (diff) |
fs: change d_delete semantics
Change d_delete from a dentry deletion notification to a dentry caching
advise, more like ->drop_inode. Require it to be constant and idempotent,
and not take d_lock. This is how all existing filesystems use the callback
anyway.
This makes fine grained dentry locking of dput and dentry lru scanning
much simpler.
Signed-off-by: Nick Piggin <npiggin@kernel.dk>
Diffstat (limited to 'Documentation/filesystems/vfs.txt')
-rw-r--r-- | Documentation/filesystems/vfs.txt | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index 20899e095e7e..95c0a93f056c 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt | |||
@@ -847,9 +847,9 @@ defined: | |||
847 | 847 | ||
848 | struct dentry_operations { | 848 | struct 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)(struct dentry *, struct qstr *, struct qstr *); |
852 | int (*d_delete)(struct dentry *); | 852 | int (*d_delete)(const struct dentry *); |
853 | void (*d_release)(struct dentry *); | 853 | void (*d_release)(struct dentry *); |
854 | void (*d_iput)(struct dentry *, struct inode *); | 854 | void (*d_iput)(struct dentry *, struct inode *); |
855 | char *(*d_dname)(struct dentry *, char *, int); | 855 | char *(*d_dname)(struct dentry *, char *, int); |
@@ -864,9 +864,11 @@ struct dentry_operations { | |||
864 | 864 | ||
865 | d_compare: called when a dentry should be compared with another | 865 | d_compare: called when a dentry should be compared with another |
866 | 866 | ||
867 | d_delete: called when the last reference to a dentry is | 867 | d_delete: called when the last reference to a dentry is dropped and the |
868 | deleted. This means no-one is using the dentry, however it is | 868 | dcache is deciding whether or not to cache it. Return 1 to delete |
869 | still valid and in the dcache | 869 | immediately, or 0 to cache the dentry. Default is NULL which means to |
870 | always cache a reachable dentry. d_delete must be constant and | ||
871 | idempotent. | ||
870 | 872 | ||
871 | d_release: called when a dentry is really deallocated | 873 | d_release: called when a dentry is really deallocated |
872 | 874 | ||
@@ -910,14 +912,11 @@ manipulate dentries: | |||
910 | the usage count) | 912 | the usage count) |
911 | 913 | ||
912 | dput: close a handle for a dentry (decrements the usage count). If | 914 | dput: close a handle for a dentry (decrements the usage count). If |
913 | the usage count drops to 0, the "d_delete" method is called | 915 | the usage count drops to 0, and the dentry is still in its |
914 | and the dentry is placed on the unused list if the dentry is | 916 | parent's hash, the "d_delete" method is called to check whether |
915 | still in its parents hash list. Putting the dentry on the | 917 | it should be cached. If it should not be cached, or if the dentry |
916 | unused list just means that if the system needs some RAM, it | 918 | is not hashed, it is deleted. Otherwise cached dentries are put |
917 | goes through the unused list of dentries and deallocates them. | 919 | into an LRU list to be reclaimed on memory shortage. |
918 | If the dentry has already been unhashed and the usage count | ||
919 | drops to 0, in this case the dentry is deallocated after the | ||
920 | "d_delete" method is called | ||
921 | 920 | ||
922 | d_drop: this unhashes a dentry from its parents hash list. A | 921 | d_drop: this unhashes a dentry from its parents hash list. A |
923 | subsequent call to dput() will deallocate the dentry if its | 922 | subsequent call to dput() will deallocate the dentry if its |