aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 1d5cf511e1c7..f9693da3efbd 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -398,7 +398,7 @@ repeat:
398 return; 398 return;
399 } 399 }
400 400
401 if (dentry->d_op && dentry->d_op->d_delete) { 401 if (dentry->d_flags & DCACHE_OP_DELETE) {
402 if (dentry->d_op->d_delete(dentry)) 402 if (dentry->d_op->d_delete(dentry))
403 goto kill_it; 403 goto kill_it;
404 } 404 }
@@ -1301,6 +1301,28 @@ struct dentry *d_alloc_name(struct dentry *parent, const char *name)
1301} 1301}
1302EXPORT_SYMBOL(d_alloc_name); 1302EXPORT_SYMBOL(d_alloc_name);
1303 1303
1304void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op)
1305{
1306 BUG_ON(dentry->d_op);
1307 BUG_ON(dentry->d_flags & (DCACHE_OP_HASH |
1308 DCACHE_OP_COMPARE |
1309 DCACHE_OP_REVALIDATE |
1310 DCACHE_OP_DELETE ));
1311 dentry->d_op = op;
1312 if (!op)
1313 return;
1314 if (op->d_hash)
1315 dentry->d_flags |= DCACHE_OP_HASH;
1316 if (op->d_compare)
1317 dentry->d_flags |= DCACHE_OP_COMPARE;
1318 if (op->d_revalidate)
1319 dentry->d_flags |= DCACHE_OP_REVALIDATE;
1320 if (op->d_delete)
1321 dentry->d_flags |= DCACHE_OP_DELETE;
1322
1323}
1324EXPORT_SYMBOL(d_set_d_op);
1325
1304static void __d_instantiate(struct dentry *dentry, struct inode *inode) 1326static void __d_instantiate(struct dentry *dentry, struct inode *inode)
1305{ 1327{
1306 spin_lock(&dentry->d_lock); 1328 spin_lock(&dentry->d_lock);
@@ -1731,7 +1753,7 @@ seqretry:
1731 */ 1753 */
1732 if (read_seqcount_retry(&dentry->d_seq, *seq)) 1754 if (read_seqcount_retry(&dentry->d_seq, *seq))
1733 goto seqretry; 1755 goto seqretry;
1734 if (parent->d_op && parent->d_op->d_compare) { 1756 if (parent->d_flags & DCACHE_OP_COMPARE) {
1735 if (parent->d_op->d_compare(parent, *inode, 1757 if (parent->d_op->d_compare(parent, *inode,
1736 dentry, i, 1758 dentry, i,
1737 tlen, tname, name)) 1759 tlen, tname, name))
@@ -1846,7 +1868,7 @@ struct dentry *__d_lookup(struct dentry *parent, struct qstr *name)
1846 */ 1868 */
1847 tlen = dentry->d_name.len; 1869 tlen = dentry->d_name.len;
1848 tname = dentry->d_name.name; 1870 tname = dentry->d_name.name;
1849 if (parent->d_op && parent->d_op->d_compare) { 1871 if (parent->d_flags & DCACHE_OP_COMPARE) {
1850 if (parent->d_op->d_compare(parent, parent->d_inode, 1872 if (parent->d_op->d_compare(parent, parent->d_inode,
1851 dentry, dentry->d_inode, 1873 dentry, dentry->d_inode,
1852 tlen, tname, name)) 1874 tlen, tname, name))
@@ -1887,7 +1909,7 @@ struct dentry *d_hash_and_lookup(struct dentry *dir, struct qstr *name)
1887 * routine may choose to leave the hash value unchanged. 1909 * routine may choose to leave the hash value unchanged.
1888 */ 1910 */
1889 name->hash = full_name_hash(name->name, name->len); 1911 name->hash = full_name_hash(name->name, name->len);
1890 if (dir->d_op && dir->d_op->d_hash) { 1912 if (dir->d_flags & DCACHE_OP_HASH) {
1891 if (dir->d_op->d_hash(dir, dir->d_inode, name) < 0) 1913 if (dir->d_op->d_hash(dir, dir->d_inode, name) < 0)
1892 goto out; 1914 goto out;
1893 } 1915 }