diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-07-05 10:59:33 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-07-05 10:59:33 -0400 |
commit | 84d08fa888e7c2d53b5bbc764db2ef02968b499c (patch) | |
tree | fa891009d778586eefdf3be8a11671ab9aefb13a | |
parent | 74b9272bbedf45cb01a048217830d64d59aaa73b (diff) |
helper for reading ->d_count
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h | 2 | ||||
-rw-r--r-- | fs/autofs4/expire.c | 8 | ||||
-rw-r--r-- | fs/autofs4/root.c | 2 | ||||
-rw-r--r-- | fs/ceph/inode.c | 4 | ||||
-rw-r--r-- | fs/ceph/mds_client.c | 2 | ||||
-rw-r--r-- | fs/coda/dir.c | 2 | ||||
-rw-r--r-- | fs/ecryptfs/inode.c | 2 | ||||
-rw-r--r-- | fs/locks.c | 2 | ||||
-rw-r--r-- | fs/nfs/dir.c | 6 | ||||
-rw-r--r-- | fs/nfs/unlink.c | 2 | ||||
-rw-r--r-- | fs/nilfs2/super.c | 2 | ||||
-rw-r--r-- | include/linux/dcache.h | 5 |
12 files changed, 22 insertions, 17 deletions
diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h b/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h index f0508084e8c5..6367f4cc7361 100644 --- a/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h +++ b/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h | |||
@@ -60,7 +60,7 @@ truncate_complete_page(struct address_space *mapping, struct page *page) | |||
60 | ll_delete_from_page_cache(page); | 60 | ll_delete_from_page_cache(page); |
61 | } | 61 | } |
62 | 62 | ||
63 | # define d_refcount(d) ((d)->d_count) | 63 | # define d_refcount(d) d_count(d) |
64 | 64 | ||
65 | #ifdef ATTR_OPEN | 65 | #ifdef ATTR_OPEN |
66 | # define ATTR_FROM_OPEN ATTR_OPEN | 66 | # define ATTR_FROM_OPEN ATTR_OPEN |
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c index 13ddec92341c..3d9d3f5d5dda 100644 --- a/fs/autofs4/expire.c +++ b/fs/autofs4/expire.c | |||
@@ -109,7 +109,7 @@ cont: | |||
109 | 109 | ||
110 | spin_lock_nested(&q->d_lock, DENTRY_D_LOCK_NESTED); | 110 | spin_lock_nested(&q->d_lock, DENTRY_D_LOCK_NESTED); |
111 | /* Already gone or negative dentry (under construction) - try next */ | 111 | /* Already gone or negative dentry (under construction) - try next */ |
112 | if (q->d_count == 0 || !simple_positive(q)) { | 112 | if (!d_count(q) || !simple_positive(q)) { |
113 | spin_unlock(&q->d_lock); | 113 | spin_unlock(&q->d_lock); |
114 | next = q->d_u.d_child.next; | 114 | next = q->d_u.d_child.next; |
115 | goto cont; | 115 | goto cont; |
@@ -267,7 +267,7 @@ static int autofs4_tree_busy(struct vfsmount *mnt, | |||
267 | else | 267 | else |
268 | ino_count++; | 268 | ino_count++; |
269 | 269 | ||
270 | if (p->d_count > ino_count) { | 270 | if (d_count(p) > ino_count) { |
271 | top_ino->last_used = jiffies; | 271 | top_ino->last_used = jiffies; |
272 | dput(p); | 272 | dput(p); |
273 | return 1; | 273 | return 1; |
@@ -409,7 +409,7 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb, | |||
409 | if (!exp_leaves) { | 409 | if (!exp_leaves) { |
410 | /* Path walk currently on this dentry? */ | 410 | /* Path walk currently on this dentry? */ |
411 | ino_count = atomic_read(&ino->count) + 1; | 411 | ino_count = atomic_read(&ino->count) + 1; |
412 | if (dentry->d_count > ino_count) | 412 | if (d_count(dentry) > ino_count) |
413 | goto next; | 413 | goto next; |
414 | 414 | ||
415 | if (!autofs4_tree_busy(mnt, dentry, timeout, do_now)) { | 415 | if (!autofs4_tree_busy(mnt, dentry, timeout, do_now)) { |
@@ -423,7 +423,7 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb, | |||
423 | } else { | 423 | } else { |
424 | /* Path walk currently on this dentry? */ | 424 | /* Path walk currently on this dentry? */ |
425 | ino_count = atomic_read(&ino->count) + 1; | 425 | ino_count = atomic_read(&ino->count) + 1; |
426 | if (dentry->d_count > ino_count) | 426 | if (d_count(dentry) > ino_count) |
427 | goto next; | 427 | goto next; |
428 | 428 | ||
429 | expired = autofs4_check_leaves(mnt, dentry, timeout, do_now); | 429 | expired = autofs4_check_leaves(mnt, dentry, timeout, do_now); |
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index ca8e55548d98..92ef341ba0cf 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -179,7 +179,7 @@ static struct dentry *autofs4_lookup_active(struct dentry *dentry) | |||
179 | spin_lock(&active->d_lock); | 179 | spin_lock(&active->d_lock); |
180 | 180 | ||
181 | /* Already gone? */ | 181 | /* Already gone? */ |
182 | if (active->d_count == 0) | 182 | if (!d_count(active)) |
183 | goto next; | 183 | goto next; |
184 | 184 | ||
185 | qstr = &active->d_name; | 185 | qstr = &active->d_name; |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index be0f7e20d62e..bd2289a4f40d 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -903,8 +903,8 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in, | |||
903 | } else if (realdn) { | 903 | } else if (realdn) { |
904 | dout("dn %p (%d) spliced with %p (%d) " | 904 | dout("dn %p (%d) spliced with %p (%d) " |
905 | "inode %p ino %llx.%llx\n", | 905 | "inode %p ino %llx.%llx\n", |
906 | dn, dn->d_count, | 906 | dn, d_count(dn), |
907 | realdn, realdn->d_count, | 907 | realdn, d_count(realdn), |
908 | realdn->d_inode, ceph_vinop(realdn->d_inode)); | 908 | realdn->d_inode, ceph_vinop(realdn->d_inode)); |
909 | dput(dn); | 909 | dput(dn); |
910 | dn = realdn; | 910 | dn = realdn; |
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 74fd2898b2ab..99890b02a10b 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -1553,7 +1553,7 @@ retry: | |||
1553 | *base = ceph_ino(temp->d_inode); | 1553 | *base = ceph_ino(temp->d_inode); |
1554 | *plen = len; | 1554 | *plen = len; |
1555 | dout("build_path on %p %d built %llx '%.*s'\n", | 1555 | dout("build_path on %p %d built %llx '%.*s'\n", |
1556 | dentry, dentry->d_count, *base, len, path); | 1556 | dentry, d_count(dentry), *base, len, path); |
1557 | return path; | 1557 | return path; |
1558 | } | 1558 | } |
1559 | 1559 | ||
diff --git a/fs/coda/dir.c b/fs/coda/dir.c index 14a14808320c..190effc6a6fa 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c | |||
@@ -526,7 +526,7 @@ static int coda_dentry_revalidate(struct dentry *de, unsigned int flags) | |||
526 | if (cii->c_flags & C_FLUSH) | 526 | if (cii->c_flags & C_FLUSH) |
527 | coda_flag_inode_children(inode, C_FLUSH); | 527 | coda_flag_inode_children(inode, C_FLUSH); |
528 | 528 | ||
529 | if (de->d_count > 1) | 529 | if (d_count(de) > 1) |
530 | /* pretend it's valid, but don't change the flags */ | 530 | /* pretend it's valid, but don't change the flags */ |
531 | goto out; | 531 | goto out; |
532 | 532 | ||
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index a2f2bb2c256d..67e9b6339691 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -358,7 +358,7 @@ static int ecryptfs_lookup_interpose(struct dentry *dentry, | |||
358 | 358 | ||
359 | lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt(dentry->d_parent)); | 359 | lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt(dentry->d_parent)); |
360 | fsstack_copy_attr_atime(dir_inode, lower_dentry->d_parent->d_inode); | 360 | fsstack_copy_attr_atime(dir_inode, lower_dentry->d_parent->d_inode); |
361 | BUG_ON(!lower_dentry->d_count); | 361 | BUG_ON(!d_count(lower_dentry)); |
362 | 362 | ||
363 | ecryptfs_set_dentry_private(dentry, dentry_info); | 363 | ecryptfs_set_dentry_private(dentry, dentry_info); |
364 | ecryptfs_set_dentry_lower(dentry, lower_dentry); | 364 | ecryptfs_set_dentry_lower(dentry, lower_dentry); |
diff --git a/fs/locks.c b/fs/locks.c index 04e2c1fdb157..c98e1a1431ea 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -1454,7 +1454,7 @@ static int generic_add_lease(struct file *filp, long arg, struct file_lock **flp | |||
1454 | if ((arg == F_RDLCK) && (atomic_read(&inode->i_writecount) > 0)) | 1454 | if ((arg == F_RDLCK) && (atomic_read(&inode->i_writecount) > 0)) |
1455 | goto out; | 1455 | goto out; |
1456 | if ((arg == F_WRLCK) | 1456 | if ((arg == F_WRLCK) |
1457 | && ((dentry->d_count > 1) | 1457 | && ((d_count(dentry) > 1) |
1458 | || (atomic_read(&inode->i_count) > 1))) | 1458 | || (atomic_read(&inode->i_count) > 1))) |
1459 | goto out; | 1459 | goto out; |
1460 | 1460 | ||
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index d7ed697133f0..c933bdfbcb1f 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -1721,7 +1721,7 @@ int nfs_unlink(struct inode *dir, struct dentry *dentry) | |||
1721 | dir->i_ino, dentry->d_name.name); | 1721 | dir->i_ino, dentry->d_name.name); |
1722 | 1722 | ||
1723 | spin_lock(&dentry->d_lock); | 1723 | spin_lock(&dentry->d_lock); |
1724 | if (dentry->d_count > 1) { | 1724 | if (d_count(dentry) > 1) { |
1725 | spin_unlock(&dentry->d_lock); | 1725 | spin_unlock(&dentry->d_lock); |
1726 | /* Start asynchronous writeout of the inode */ | 1726 | /* Start asynchronous writeout of the inode */ |
1727 | write_inode_now(dentry->d_inode, 0); | 1727 | write_inode_now(dentry->d_inode, 0); |
@@ -1866,7 +1866,7 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1866 | dfprintk(VFS, "NFS: rename(%s/%s -> %s/%s, ct=%d)\n", | 1866 | dfprintk(VFS, "NFS: rename(%s/%s -> %s/%s, ct=%d)\n", |
1867 | old_dentry->d_parent->d_name.name, old_dentry->d_name.name, | 1867 | old_dentry->d_parent->d_name.name, old_dentry->d_name.name, |
1868 | new_dentry->d_parent->d_name.name, new_dentry->d_name.name, | 1868 | new_dentry->d_parent->d_name.name, new_dentry->d_name.name, |
1869 | new_dentry->d_count); | 1869 | d_count(new_dentry)); |
1870 | 1870 | ||
1871 | /* | 1871 | /* |
1872 | * For non-directories, check whether the target is busy and if so, | 1872 | * For non-directories, check whether the target is busy and if so, |
@@ -1884,7 +1884,7 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1884 | rehash = new_dentry; | 1884 | rehash = new_dentry; |
1885 | } | 1885 | } |
1886 | 1886 | ||
1887 | if (new_dentry->d_count > 2) { | 1887 | if (d_count(new_dentry) > 2) { |
1888 | int err; | 1888 | int err; |
1889 | 1889 | ||
1890 | /* copy the target dentry's name */ | 1890 | /* copy the target dentry's name */ |
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c index 1f1f38f0c5d5..60395ad3a2e4 100644 --- a/fs/nfs/unlink.c +++ b/fs/nfs/unlink.c | |||
@@ -479,7 +479,7 @@ nfs_sillyrename(struct inode *dir, struct dentry *dentry) | |||
479 | 479 | ||
480 | dfprintk(VFS, "NFS: silly-rename(%s/%s, ct=%d)\n", | 480 | dfprintk(VFS, "NFS: silly-rename(%s/%s, ct=%d)\n", |
481 | dentry->d_parent->d_name.name, dentry->d_name.name, | 481 | dentry->d_parent->d_name.name, dentry->d_name.name, |
482 | dentry->d_count); | 482 | d_count(dentry)); |
483 | nfs_inc_stats(dir, NFSIOS_SILLYRENAME); | 483 | nfs_inc_stats(dir, NFSIOS_SILLYRENAME); |
484 | 484 | ||
485 | /* | 485 | /* |
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 1427de5ebf4d..af3ba0478cdf 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -996,7 +996,7 @@ static int nilfs_attach_snapshot(struct super_block *s, __u64 cno, | |||
996 | 996 | ||
997 | static int nilfs_tree_was_touched(struct dentry *root_dentry) | 997 | static int nilfs_tree_was_touched(struct dentry *root_dentry) |
998 | { | 998 | { |
999 | return root_dentry->d_count > 1; | 999 | return d_count(root_dentry) > 1; |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | /** | 1002 | /** |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index f42dbe145479..3092df3614ae 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -324,6 +324,11 @@ static inline int __d_rcu_to_refcount(struct dentry *dentry, unsigned seq) | |||
324 | return ret; | 324 | return ret; |
325 | } | 325 | } |
326 | 326 | ||
327 | static inline unsigned d_count(struct dentry *dentry) | ||
328 | { | ||
329 | return dentry->d_count; | ||
330 | } | ||
331 | |||
327 | /* validate "insecure" dentry pointer */ | 332 | /* validate "insecure" dentry pointer */ |
328 | extern int d_validate(struct dentry *, struct dentry *); | 333 | extern int d_validate(struct dentry *, struct dentry *); |
329 | 334 | ||