Skip to content

Commit 84d08fa

Browse files
author
Al Viro
committed
helper for reading ->d_count
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 74b9272 commit 84d08fa

12 files changed

Lines changed: 22 additions & 17 deletions

File tree

‎drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ truncate_complete_page(struct address_space *mapping, struct page *page)
6060
ll_delete_from_page_cache(page);
6161
}
6262

63-
# define d_refcount(d) ((d)->d_count)
63+
# define d_refcount(d) d_count(d)
6464

6565
#ifdef ATTR_OPEN
6666
# define ATTR_FROM_OPEN ATTR_OPEN

‎fs/autofs4/expire.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static struct dentry *get_next_positive_subdir(struct dentry *prev,
109109

110110
spin_lock_nested(&q->d_lock, DENTRY_D_LOCK_NESTED);
111111
/* 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)) {
113113
spin_unlock(&q->d_lock);
114114
next = q->d_u.d_child.next;
115115
goto cont;
@@ -267,7 +267,7 @@ static int autofs4_tree_busy(struct vfsmount *mnt,
267267
else
268268
ino_count++;
269269

270-
if (p->d_count > ino_count) {
270+
if (d_count(p) > ino_count) {
271271
top_ino->last_used = jiffies;
272272
dput(p);
273273
return 1;
@@ -409,7 +409,7 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb,
409409
if (!exp_leaves) {
410410
/* Path walk currently on this dentry? */
411411
ino_count = atomic_read(&ino->count) + 1;
412-
if (dentry->d_count > ino_count)
412+
if (d_count(dentry) > ino_count)
413413
goto next;
414414

415415
if (!autofs4_tree_busy(mnt, dentry, timeout, do_now)) {
@@ -423,7 +423,7 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb,
423423
} else {
424424
/* Path walk currently on this dentry? */
425425
ino_count = atomic_read(&ino->count) + 1;
426-
if (dentry->d_count > ino_count)
426+
if (d_count(dentry) > ino_count)
427427
goto next;
428428

429429
expired = autofs4_check_leaves(mnt, dentry, timeout, do_now);

‎fs/autofs4/root.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ static struct dentry *autofs4_lookup_active(struct dentry *dentry)
179179
spin_lock(&active->d_lock);
180180

181181
/* Already gone? */
182-
if (active->d_count == 0)
182+
if (!d_count(active))
183183
goto next;
184184

185185
qstr = &active->d_name;

‎fs/ceph/inode.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -903,8 +903,8 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in,
903903
} else if (realdn) {
904904
dout("dn %p (%d) spliced with %p (%d) "
905905
"inode %p ino %llx.%llx\n",
906-
dn, dn->d_count,
907-
realdn, realdn->d_count,
906+
dn, d_count(dn),
907+
realdn, d_count(realdn),
908908
realdn->d_inode, ceph_vinop(realdn->d_inode));
909909
dput(dn);
910910
dn = realdn;

‎fs/ceph/mds_client.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,7 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *base,
15531553
*base = ceph_ino(temp->d_inode);
15541554
*plen = len;
15551555
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);
15571557
return path;
15581558
}
15591559

‎fs/coda/dir.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ static int coda_dentry_revalidate(struct dentry *de, unsigned int flags)
526526
if (cii->c_flags & C_FLUSH)
527527
coda_flag_inode_children(inode, C_FLUSH);
528528

529-
if (de->d_count > 1)
529+
if (d_count(de) > 1)
530530
/* pretend it's valid, but don't change the flags */
531531
goto out;
532532

‎fs/ecryptfs/inode.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ static int ecryptfs_lookup_interpose(struct dentry *dentry,
358358

359359
lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt(dentry->d_parent));
360360
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));
362362

363363
ecryptfs_set_dentry_private(dentry, dentry_info);
364364
ecryptfs_set_dentry_lower(dentry, lower_dentry);

‎fs/locks.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1454,7 +1454,7 @@ static int generic_add_lease(struct file *filp, long arg, struct file_lock **flp
14541454
if ((arg == F_RDLCK) && (atomic_read(&inode->i_writecount) > 0))
14551455
goto out;
14561456
if ((arg == F_WRLCK)
1457-
&& ((dentry->d_count > 1)
1457+
&& ((d_count(dentry) > 1)
14581458
|| (atomic_read(&inode->i_count) > 1)))
14591459
goto out;
14601460

‎fs/nfs/dir.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,7 +1721,7 @@ int nfs_unlink(struct inode *dir, struct dentry *dentry)
17211721
dir->i_ino, dentry->d_name.name);
17221722

17231723
spin_lock(&dentry->d_lock);
1724-
if (dentry->d_count > 1) {
1724+
if (d_count(dentry) > 1) {
17251725
spin_unlock(&dentry->d_lock);
17261726
/* Start asynchronous writeout of the inode */
17271727
write_inode_now(dentry->d_inode, 0);
@@ -1866,7 +1866,7 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
18661866
dfprintk(VFS, "NFS: rename(%s/%s -> %s/%s, ct=%d)\n",
18671867
old_dentry->d_parent->d_name.name, old_dentry->d_name.name,
18681868
new_dentry->d_parent->d_name.name, new_dentry->d_name.name,
1869-
new_dentry->d_count);
1869+
d_count(new_dentry));
18701870

18711871
/*
18721872
* 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,
18841884
rehash = new_dentry;
18851885
}
18861886

1887-
if (new_dentry->d_count > 2) {
1887+
if (d_count(new_dentry) > 2) {
18881888
int err;
18891889

18901890
/* copy the target dentry's name */

‎fs/nfs/unlink.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ nfs_sillyrename(struct inode *dir, struct dentry *dentry)
479479

480480
dfprintk(VFS, "NFS: silly-rename(%s/%s, ct=%d)\n",
481481
dentry->d_parent->d_name.name, dentry->d_name.name,
482-
dentry->d_count);
482+
d_count(dentry));
483483
nfs_inc_stats(dir, NFSIOS_SILLYRENAME);
484484

485485
/*

0 commit comments

Comments
 (0)