Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/viro/vfs

Pull third set of VFS updates from Al Viro:
 "Misc stuff all over the place.  There will be one more pile in a
  couple of days"

This is an "evil merge" that also uses the new d_count helper in
fs/configfs/dir.c, missed by commit 84d08fa ("helper for reading
->d_count")

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  ncpfs: fix error return code in ncp_parse_options()
  locks: move file_lock_list to a set of percpu hlist_heads and convert file_lock_lock to an lglock
  seq_file: add seq_list_*_percpu helpers
  f2fs: fix readdir incorrectness
  mode_t whack-a-mole...
  lustre: kill the pointless wrapper
  helper for reading ->d_count
  • Loading branch information
Linus Torvalds committed Jul 9, 2013
2 parents d2b4a64 + 4fbeb19 commit c75e247
Show file tree
Hide file tree
Showing 26 changed files with 169 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ truncate_complete_page(struct address_space *mapping, struct page *page)
ll_delete_from_page_cache(page);
}

# define d_refcount(d) ((d)->d_count)

#ifdef ATTR_OPEN
# define ATTR_FROM_OPEN ATTR_OPEN
#else
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/lustre/lustre/include/linux/lvfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static inline void l_dput(struct dentry *de)
if (!de || IS_ERR(de))
return;
//shrink_dcache_parent(de);
LASSERT(d_refcount(de) > 0);
LASSERT(d_count(de) > 0);
dput(de);
}

Expand Down
6 changes: 3 additions & 3 deletions drivers/staging/lustre/lustre/include/lprocfs_status.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct lprocfs_vars {
/**
* /proc file mode.
*/
mode_t proc_mode;
umode_t proc_mode;
};

struct lprocfs_static_vars {
Expand Down Expand Up @@ -600,11 +600,11 @@ extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list);
extern int lprocfs_obd_cleanup(struct obd_device *obd);

extern int lprocfs_seq_create(proc_dir_entry_t *parent, const char *name,
mode_t mode,
umode_t mode,
const struct file_operations *seq_fops,
void *data);
extern int lprocfs_obd_seq_create(struct obd_device *dev, const char *name,
mode_t mode,
umode_t mode,
const struct file_operations *seq_fops,
void *data);

Expand Down
8 changes: 4 additions & 4 deletions drivers/staging/lustre/lustre/llite/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ int ll_dcompare(const struct dentry *parent, const struct inode *pinode,

CDEBUG(D_DENTRY, "found name %.*s(%p) flags %#x refc %d\n",
name->len, name->name, dentry, dentry->d_flags,
d_refcount(dentry));
d_count(dentry));

/* mountpoint is always valid */
if (d_mountpoint((struct dentry *)dentry))
Expand Down Expand Up @@ -165,7 +165,7 @@ static int ll_ddelete(const struct dentry *de)
list_empty(&de->d_subdirs) ? "" : "subdirs");

/* kernel >= 2.6.38 last refcount is decreased after this function. */
LASSERT(d_refcount(de) == 1);
LASSERT(d_count(de) == 1);

/* Disable this piece of code temproarily because this is called
* inside dcache_lock so it's not appropriate to do lots of work
Expand All @@ -190,7 +190,7 @@ static int ll_set_dd(struct dentry *de)

CDEBUG(D_DENTRY, "ldd on dentry %.*s (%p) parent %p inode %p refc %d\n",
de->d_name.len, de->d_name.name, de, de->d_parent, de->d_inode,
d_refcount(de));
d_count(de));

if (de->d_fsdata == NULL) {
struct ll_dentry_data *lld;
Expand Down Expand Up @@ -540,7 +540,7 @@ int ll_revalidate_it(struct dentry *de, int lookup_flags,
CDEBUG(D_DENTRY, "revalidated dentry %.*s (%p) parent %p "
"inode %p refc %d\n", de->d_name.len,
de->d_name.name, de, de->d_parent, de->d_inode,
d_refcount(de));
d_count(de));

ll_set_lock_data(exp, de->d_inode, it, &bits);

Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/lustre/lustre/llite/llite_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -1529,12 +1529,12 @@ static inline void d_lustre_invalidate(struct dentry *dentry, int nested)
{
CDEBUG(D_DENTRY, "invalidate dentry %.*s (%p) parent %p inode %p "
"refc %d\n", dentry->d_name.len, dentry->d_name.name, dentry,
dentry->d_parent, dentry->d_inode, d_refcount(dentry));
dentry->d_parent, dentry->d_inode, d_count(dentry));

spin_lock_nested(&dentry->d_lock,
nested ? DENTRY_D_LOCK_NESTED : DENTRY_D_LOCK_NORMAL);
__d_lustre_invalidate(dentry);
if (d_refcount(dentry) == 0)
if (d_count(dentry) == 0)
__d_drop(dentry);
spin_unlock(&dentry->d_lock);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/lustre/lustre/llite/llite_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ void lustre_dump_dentry(struct dentry *dentry, int recur)
" flags=0x%x, fsdata=%p, %d subdirs\n", dentry,
dentry->d_name.len, dentry->d_name.name,
dentry->d_parent->d_name.len, dentry->d_parent->d_name.name,
dentry->d_parent, dentry->d_inode, d_refcount(dentry),
dentry->d_parent, dentry->d_inode, d_count(dentry),
dentry->d_flags, dentry->d_fsdata, subdirs);
if (dentry->d_inode != NULL)
ll_dump_inode(dentry->d_inode);
Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/lustre/lustre/llite/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,15 +409,15 @@ struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de)
iput(inode);
CDEBUG(D_DENTRY,
"Reuse dentry %p inode %p refc %d flags %#x\n",
new, new->d_inode, d_refcount(new), new->d_flags);
new, new->d_inode, d_count(new), new->d_flags);
return new;
}
}
ll_dops_init(de, 1, 1);
__d_lustre_invalidate(de);
d_add(de, inode);
CDEBUG(D_DENTRY, "Add dentry %p inode %p refc %d flags %#x\n",
de, de->d_inode, d_refcount(de), de->d_flags);
de, de->d_inode, d_count(de), de->d_flags);
return de;
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/lustre/lustre/lvfs/lvfs_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx,
OBD_SET_CTXT_MAGIC(save);

save->fs = get_fs();
LASSERT(d_refcount(cfs_fs_pwd(current->fs)));
LASSERT(d_refcount(new_ctx->pwd));
LASSERT(d_count(cfs_fs_pwd(current->fs)));
LASSERT(d_count(new_ctx->pwd));
save->pwd = dget(cfs_fs_pwd(current->fs));
save->pwdmnt = mntget(cfs_fs_mnt(current->fs));
save->luc.luc_umask = current_umask();
Expand Down
8 changes: 4 additions & 4 deletions drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ proc_dir_entry_t *lprocfs_add_simple(struct proc_dir_entry *root,
struct file_operations *fops)
{
proc_dir_entry_t *proc;
mode_t mode = 0;
umode_t mode = 0;

if (root == NULL || name == NULL || fops == NULL)
return ERR_PTR(-EINVAL);
Expand Down Expand Up @@ -140,7 +140,7 @@ int lprocfs_add_vars(struct proc_dir_entry *root, struct lprocfs_vars *list,

while (list->name != NULL) {
struct proc_dir_entry *proc;
mode_t mode = 0;
umode_t mode = 0;

if (list->proc_mode != 0000) {
mode = list->proc_mode;
Expand Down Expand Up @@ -1899,7 +1899,7 @@ EXPORT_SYMBOL(lprocfs_find_named_value);

int lprocfs_seq_create(proc_dir_entry_t *parent,
const char *name,
mode_t mode,
umode_t mode,
const struct file_operations *seq_fops,
void *data)
{
Expand All @@ -1919,7 +1919,7 @@ EXPORT_SYMBOL(lprocfs_seq_create);

int lprocfs_obd_seq_create(struct obd_device *dev,
const char *name,
mode_t mode,
umode_t mode,
const struct file_operations *seq_fops,
void *data)
{
Expand Down
8 changes: 4 additions & 4 deletions fs/autofs4/expire.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static struct dentry *get_next_positive_subdir(struct dentry *prev,

spin_lock_nested(&q->d_lock, DENTRY_D_LOCK_NESTED);
/* 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);
next = q->d_u.d_child.next;
goto cont;
Expand Down Expand Up @@ -267,7 +267,7 @@ static int autofs4_tree_busy(struct vfsmount *mnt,
else
ino_count++;

if (p->d_count > ino_count) {
if (d_count(p) > ino_count) {
top_ino->last_used = jiffies;
dput(p);
return 1;
Expand Down Expand Up @@ -409,7 +409,7 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb,
if (!exp_leaves) {
/* Path walk currently on this dentry? */
ino_count = atomic_read(&ino->count) + 1;
if (dentry->d_count > ino_count)
if (d_count(dentry) > ino_count)
goto next;

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

expired = autofs4_check_leaves(mnt, dentry, timeout, do_now);
Expand Down
2 changes: 1 addition & 1 deletion fs/autofs4/root.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ static struct dentry *autofs4_lookup_active(struct dentry *dentry)
spin_lock(&active->d_lock);

/* Already gone? */
if (active->d_count == 0)
if (!d_count(active))
goto next;

qstr = &active->d_name;
Expand Down
4 changes: 2 additions & 2 deletions fs/ceph/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -903,8 +903,8 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in,
} else if (realdn) {
dout("dn %p (%d) spliced with %p (%d) "
"inode %p ino %llx.%llx\n",
dn, dn->d_count,
realdn, realdn->d_count,
dn, d_count(dn),
realdn, d_count(realdn),
realdn->d_inode, ceph_vinop(realdn->d_inode));
dput(dn);
dn = realdn;
Expand Down
2 changes: 1 addition & 1 deletion fs/ceph/mds_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,7 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *base,
*base = ceph_ino(temp->d_inode);
*plen = len;
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;
}

Expand Down
2 changes: 1 addition & 1 deletion fs/coda/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ static int coda_dentry_revalidate(struct dentry *de, unsigned int flags)
if (cii->c_flags & 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 */
goto out;

Expand Down
2 changes: 1 addition & 1 deletion fs/configfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ static void remove_dir(struct dentry * d)
if (d->d_inode)
simple_rmdir(parent->d_inode,d);

pr_debug(" o %s removing done (%d)\n",d->d_name.name, d->d_count);
pr_debug(" o %s removing done (%d)\n",d->d_name.name, d_count(d));

dput(parent);
}
Expand Down
2 changes: 1 addition & 1 deletion fs/ecryptfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ static int ecryptfs_lookup_interpose(struct dentry *dentry,

lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt(dentry->d_parent));
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_lower(dentry, lower_dentry);
Expand Down
20 changes: 9 additions & 11 deletions fs/f2fs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,13 +610,12 @@ static int f2fs_readdir(struct file *file, struct dir_context *ctx)
{
struct inode *inode = file_inode(file);
unsigned long npages = dir_blocks(inode);
unsigned int bit_pos = 0, start_bit_pos = 0;
unsigned int bit_pos = 0;
struct f2fs_dentry_block *dentry_blk = NULL;
struct f2fs_dir_entry *de = NULL;
struct page *dentry_page = NULL;
unsigned int n = ((unsigned long)ctx->pos / NR_DENTRY_IN_BLOCK);
unsigned char d_type = DT_UNKNOWN;
int slots;

bit_pos = ((unsigned long)ctx->pos % NR_DENTRY_IN_BLOCK);

Expand All @@ -625,7 +624,6 @@ static int f2fs_readdir(struct file *file, struct dir_context *ctx)
if (IS_ERR(dentry_page))
continue;

start_bit_pos = bit_pos;
dentry_blk = kmap(dentry_page);
while (bit_pos < NR_DENTRY_IN_BLOCK) {
bit_pos = find_next_bit_le(&dentry_blk->dentry_bitmap,
Expand All @@ -634,27 +632,27 @@ static int f2fs_readdir(struct file *file, struct dir_context *ctx)
if (bit_pos >= NR_DENTRY_IN_BLOCK)
break;

ctx->pos += bit_pos - start_bit_pos;
de = &dentry_blk->dentry[bit_pos];
if (de->file_type < F2FS_FT_MAX)
d_type = f2fs_filetype_table[de->file_type];
else
d_type = DT_UNKNOWN;
if (!dir_emit(ctx,
dentry_blk->filename[bit_pos],
le16_to_cpu(de->name_len),
le32_to_cpu(de->ino), d_type))
goto success;
slots = GET_DENTRY_SLOTS(le16_to_cpu(de->name_len));
bit_pos += slots;
dentry_blk->filename[bit_pos],
le16_to_cpu(de->name_len),
le32_to_cpu(de->ino), d_type))
goto stop;

bit_pos += GET_DENTRY_SLOTS(le16_to_cpu(de->name_len));
ctx->pos = n * NR_DENTRY_IN_BLOCK + bit_pos;
}
bit_pos = 0;
ctx->pos = (n + 1) * NR_DENTRY_IN_BLOCK;
kunmap(dentry_page);
f2fs_put_page(dentry_page, 1);
dentry_page = NULL;
}
success:
stop:
if (dentry_page && !IS_ERR(dentry_page)) {
kunmap(dentry_page);
f2fs_put_page(dentry_page, 1);
Expand Down
Loading

0 comments on commit c75e247

Please sign in to comment.