mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
helper for reading ->d_count
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
74b9272bbe
commit
84d08fa888
@ -60,7 +60,7 @@ truncate_complete_page(struct address_space *mapping, struct page *page)
|
|||||||
ll_delete_from_page_cache(page);
|
ll_delete_from_page_cache(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
# define d_refcount(d) ((d)->d_count)
|
# define d_refcount(d) d_count(d)
|
||||||
|
|
||||||
#ifdef ATTR_OPEN
|
#ifdef ATTR_OPEN
|
||||||
# define ATTR_FROM_OPEN ATTR_OPEN
|
# define ATTR_FROM_OPEN ATTR_OPEN
|
||||||
|
@ -109,7 +109,7 @@ cont:
|
|||||||
|
|
||||||
spin_lock_nested(&q->d_lock, DENTRY_D_LOCK_NESTED);
|
spin_lock_nested(&q->d_lock, DENTRY_D_LOCK_NESTED);
|
||||||
/* Already gone or negative dentry (under construction) - try next */
|
/* Already gone or negative dentry (under construction) - try next */
|
||||||
if (q->d_count == 0 || !simple_positive(q)) {
|
if (!d_count(q) || !simple_positive(q)) {
|
||||||
spin_unlock(&q->d_lock);
|
spin_unlock(&q->d_lock);
|
||||||
next = q->d_u.d_child.next;
|
next = q->d_u.d_child.next;
|
||||||
goto cont;
|
goto cont;
|
||||||
@ -267,7 +267,7 @@ static int autofs4_tree_busy(struct vfsmount *mnt,
|
|||||||
else
|
else
|
||||||
ino_count++;
|
ino_count++;
|
||||||
|
|
||||||
if (p->d_count > ino_count) {
|
if (d_count(p) > ino_count) {
|
||||||
top_ino->last_used = jiffies;
|
top_ino->last_used = jiffies;
|
||||||
dput(p);
|
dput(p);
|
||||||
return 1;
|
return 1;
|
||||||
@ -409,7 +409,7 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb,
|
|||||||
if (!exp_leaves) {
|
if (!exp_leaves) {
|
||||||
/* Path walk currently on this dentry? */
|
/* Path walk currently on this dentry? */
|
||||||
ino_count = atomic_read(&ino->count) + 1;
|
ino_count = atomic_read(&ino->count) + 1;
|
||||||
if (dentry->d_count > ino_count)
|
if (d_count(dentry) > ino_count)
|
||||||
goto next;
|
goto next;
|
||||||
|
|
||||||
if (!autofs4_tree_busy(mnt, dentry, timeout, do_now)) {
|
if (!autofs4_tree_busy(mnt, dentry, timeout, do_now)) {
|
||||||
@ -423,7 +423,7 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb,
|
|||||||
} else {
|
} else {
|
||||||
/* Path walk currently on this dentry? */
|
/* Path walk currently on this dentry? */
|
||||||
ino_count = atomic_read(&ino->count) + 1;
|
ino_count = atomic_read(&ino->count) + 1;
|
||||||
if (dentry->d_count > ino_count)
|
if (d_count(dentry) > ino_count)
|
||||||
goto next;
|
goto next;
|
||||||
|
|
||||||
expired = autofs4_check_leaves(mnt, dentry, timeout, do_now);
|
expired = autofs4_check_leaves(mnt, dentry, timeout, do_now);
|
||||||
|
@ -179,7 +179,7 @@ static struct dentry *autofs4_lookup_active(struct dentry *dentry)
|
|||||||
spin_lock(&active->d_lock);
|
spin_lock(&active->d_lock);
|
||||||
|
|
||||||
/* Already gone? */
|
/* Already gone? */
|
||||||
if (active->d_count == 0)
|
if (!d_count(active))
|
||||||
goto next;
|
goto next;
|
||||||
|
|
||||||
qstr = &active->d_name;
|
qstr = &active->d_name;
|
||||||
|
@ -903,8 +903,8 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in,
|
|||||||
} else if (realdn) {
|
} else if (realdn) {
|
||||||
dout("dn %p (%d) spliced with %p (%d) "
|
dout("dn %p (%d) spliced with %p (%d) "
|
||||||
"inode %p ino %llx.%llx\n",
|
"inode %p ino %llx.%llx\n",
|
||||||
dn, dn->d_count,
|
dn, d_count(dn),
|
||||||
realdn, realdn->d_count,
|
realdn, d_count(realdn),
|
||||||
realdn->d_inode, ceph_vinop(realdn->d_inode));
|
realdn->d_inode, ceph_vinop(realdn->d_inode));
|
||||||
dput(dn);
|
dput(dn);
|
||||||
dn = realdn;
|
dn = realdn;
|
||||||
|
@ -1553,7 +1553,7 @@ retry:
|
|||||||
*base = ceph_ino(temp->d_inode);
|
*base = ceph_ino(temp->d_inode);
|
||||||
*plen = len;
|
*plen = len;
|
||||||
dout("build_path on %p %d built %llx '%.*s'\n",
|
dout("build_path on %p %d built %llx '%.*s'\n",
|
||||||
dentry, dentry->d_count, *base, len, path);
|
dentry, d_count(dentry), *base, len, path);
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -526,7 +526,7 @@ static int coda_dentry_revalidate(struct dentry *de, unsigned int flags)
|
|||||||
if (cii->c_flags & C_FLUSH)
|
if (cii->c_flags & C_FLUSH)
|
||||||
coda_flag_inode_children(inode, C_FLUSH);
|
coda_flag_inode_children(inode, C_FLUSH);
|
||||||
|
|
||||||
if (de->d_count > 1)
|
if (d_count(de) > 1)
|
||||||
/* pretend it's valid, but don't change the flags */
|
/* pretend it's valid, but don't change the flags */
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
@ -358,7 +358,7 @@ static int ecryptfs_lookup_interpose(struct dentry *dentry,
|
|||||||
|
|
||||||
lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt(dentry->d_parent));
|
lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt(dentry->d_parent));
|
||||||
fsstack_copy_attr_atime(dir_inode, lower_dentry->d_parent->d_inode);
|
fsstack_copy_attr_atime(dir_inode, lower_dentry->d_parent->d_inode);
|
||||||
BUG_ON(!lower_dentry->d_count);
|
BUG_ON(!d_count(lower_dentry));
|
||||||
|
|
||||||
ecryptfs_set_dentry_private(dentry, dentry_info);
|
ecryptfs_set_dentry_private(dentry, dentry_info);
|
||||||
ecryptfs_set_dentry_lower(dentry, lower_dentry);
|
ecryptfs_set_dentry_lower(dentry, lower_dentry);
|
||||||
|
@ -1454,7 +1454,7 @@ static int generic_add_lease(struct file *filp, long arg, struct file_lock **flp
|
|||||||
if ((arg == F_RDLCK) && (atomic_read(&inode->i_writecount) > 0))
|
if ((arg == F_RDLCK) && (atomic_read(&inode->i_writecount) > 0))
|
||||||
goto out;
|
goto out;
|
||||||
if ((arg == F_WRLCK)
|
if ((arg == F_WRLCK)
|
||||||
&& ((dentry->d_count > 1)
|
&& ((d_count(dentry) > 1)
|
||||||
|| (atomic_read(&inode->i_count) > 1)))
|
|| (atomic_read(&inode->i_count) > 1)))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
@ -1721,7 +1721,7 @@ int nfs_unlink(struct inode *dir, struct dentry *dentry)
|
|||||||
dir->i_ino, dentry->d_name.name);
|
dir->i_ino, dentry->d_name.name);
|
||||||
|
|
||||||
spin_lock(&dentry->d_lock);
|
spin_lock(&dentry->d_lock);
|
||||||
if (dentry->d_count > 1) {
|
if (d_count(dentry) > 1) {
|
||||||
spin_unlock(&dentry->d_lock);
|
spin_unlock(&dentry->d_lock);
|
||||||
/* Start asynchronous writeout of the inode */
|
/* Start asynchronous writeout of the inode */
|
||||||
write_inode_now(dentry->d_inode, 0);
|
write_inode_now(dentry->d_inode, 0);
|
||||||
@ -1866,7 +1866,7 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
|||||||
dfprintk(VFS, "NFS: rename(%s/%s -> %s/%s, ct=%d)\n",
|
dfprintk(VFS, "NFS: rename(%s/%s -> %s/%s, ct=%d)\n",
|
||||||
old_dentry->d_parent->d_name.name, old_dentry->d_name.name,
|
old_dentry->d_parent->d_name.name, old_dentry->d_name.name,
|
||||||
new_dentry->d_parent->d_name.name, new_dentry->d_name.name,
|
new_dentry->d_parent->d_name.name, new_dentry->d_name.name,
|
||||||
new_dentry->d_count);
|
d_count(new_dentry));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For non-directories, check whether the target is busy and if so,
|
* 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,
|
|||||||
rehash = new_dentry;
|
rehash = new_dentry;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_dentry->d_count > 2) {
|
if (d_count(new_dentry) > 2) {
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
/* copy the target dentry's name */
|
/* copy the target dentry's name */
|
||||||
|
@ -479,7 +479,7 @@ nfs_sillyrename(struct inode *dir, struct dentry *dentry)
|
|||||||
|
|
||||||
dfprintk(VFS, "NFS: silly-rename(%s/%s, ct=%d)\n",
|
dfprintk(VFS, "NFS: silly-rename(%s/%s, ct=%d)\n",
|
||||||
dentry->d_parent->d_name.name, dentry->d_name.name,
|
dentry->d_parent->d_name.name, dentry->d_name.name,
|
||||||
dentry->d_count);
|
d_count(dentry));
|
||||||
nfs_inc_stats(dir, NFSIOS_SILLYRENAME);
|
nfs_inc_stats(dir, NFSIOS_SILLYRENAME);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -996,7 +996,7 @@ static int nilfs_attach_snapshot(struct super_block *s, __u64 cno,
|
|||||||
|
|
||||||
static int nilfs_tree_was_touched(struct dentry *root_dentry)
|
static int nilfs_tree_was_touched(struct dentry *root_dentry)
|
||||||
{
|
{
|
||||||
return root_dentry->d_count > 1;
|
return d_count(root_dentry) > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -324,6 +324,11 @@ static inline int __d_rcu_to_refcount(struct dentry *dentry, unsigned seq)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline unsigned d_count(struct dentry *dentry)
|
||||||
|
{
|
||||||
|
return dentry->d_count;
|
||||||
|
}
|
||||||
|
|
||||||
/* validate "insecure" dentry pointer */
|
/* validate "insecure" dentry pointer */
|
||||||
extern int d_validate(struct dentry *, struct dentry *);
|
extern int d_validate(struct dentry *, struct dentry *);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user