diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-16 10:24:44 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-16 10:24:44 -0800 |
commit | 9a19a6db37ee0b7a6db796b3dcd6bb6e7237d6ea (patch) | |
tree | 614d68498eea1c6f9120cae07806f916fd9776bc /fs/ceph/dir.c | |
parent | bd9999cd6a5eb899504ce14c1f70c5479143bbbc (diff) | |
parent | c4364f837caf618c2fdb51a2e132cf29dfd1fffa (diff) | |
download | linux-stable-9a19a6db37ee0b7a6db796b3dcd6bb6e7237d6ea.tar.gz linux-stable-9a19a6db37ee0b7a6db796b3dcd6bb6e7237d6ea.tar.bz2 linux-stable-9a19a6db37ee0b7a6db796b3dcd6bb6e7237d6ea.zip |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs updates from Al Viro:
- more ->d_init() stuff (work.dcache)
- pathname resolution cleanups (work.namei)
- a few missing iov_iter primitives - copy_from_iter_full() and
friends. Either copy the full requested amount, advance the iterator
and return true, or fail, return false and do _not_ advance the
iterator. Quite a few open-coded callers converted (and became more
readable and harder to fuck up that way) (work.iov_iter)
- several assorted patches, the big one being logfs removal
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
logfs: remove from tree
vfs: fix put_compat_statfs64() does not handle errors
namei: fold should_follow_link() with the step into not-followed link
namei: pass both WALK_GET and WALK_MORE to should_follow_link()
namei: invert WALK_PUT logics
namei: shift interpretation of LOOKUP_FOLLOW inside should_follow_link()
namei: saner calling conventions for mountpoint_last()
namei.c: get rid of user_path_parent()
switch getfrag callbacks to ..._full() primitives
make skb_add_data,{_nocache}() and skb_copy_to_page_nocache() advance only on success
[iov_iter] new primitives - copy_from_iter_full() and friends
don't open-code file_inode()
ceph: switch to use of ->d_init()
ceph: unify dentry_operations instances
lustre: switch to use of ->d_init()
Diffstat (limited to 'fs/ceph/dir.c')
-rw-r--r-- | fs/ceph/dir.c | 51 |
1 files changed, 5 insertions, 46 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index a594c7879cc2..d7a93696663b 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -32,40 +32,19 @@ const struct dentry_operations ceph_dentry_ops; /* * Initialize ceph dentry state. */ -int ceph_init_dentry(struct dentry *dentry) +static int ceph_d_init(struct dentry *dentry) { struct ceph_dentry_info *di; - if (dentry->d_fsdata) - return 0; - di = kmem_cache_zalloc(ceph_dentry_cachep, GFP_KERNEL); if (!di) return -ENOMEM; /* oh well */ - spin_lock(&dentry->d_lock); - if (dentry->d_fsdata) { - /* lost a race */ - kmem_cache_free(ceph_dentry_cachep, di); - goto out_unlock; - } - - if (ceph_snap(d_inode(dentry->d_parent)) == CEPH_NOSNAP) - d_set_d_op(dentry, &ceph_dentry_ops); - else if (ceph_snap(d_inode(dentry->d_parent)) == CEPH_SNAPDIR) - d_set_d_op(dentry, &ceph_snapdir_dentry_ops); - else - d_set_d_op(dentry, &ceph_snap_dentry_ops); - di->dentry = dentry; di->lease_session = NULL; di->time = jiffies; - /* avoid reordering d_fsdata setup so that the check above is safe */ - smp_mb(); dentry->d_fsdata = di; ceph_dentry_lru_add(dentry); -out_unlock: - spin_unlock(&dentry->d_lock); return 0; } @@ -737,10 +716,6 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry, if (dentry->d_name.len > NAME_MAX) return ERR_PTR(-ENAMETOOLONG); - err = ceph_init_dentry(dentry); - if (err < 0) - return ERR_PTR(err); - /* can we conclude ENOENT locally? */ if (d_really_is_negative(dentry)) { struct ceph_inode_info *ci = ceph_inode(dir); @@ -1323,16 +1298,6 @@ static void ceph_d_release(struct dentry *dentry) kmem_cache_free(ceph_dentry_cachep, di); } -static int ceph_snapdir_d_revalidate(struct dentry *dentry, - unsigned int flags) -{ - /* - * Eventually, we'll want to revalidate snapped metadata - * too... probably... - */ - return 1; -} - /* * When the VFS prunes a dentry from the cache, we need to clear the * complete flag on the parent directory. @@ -1351,6 +1316,9 @@ static void ceph_d_prune(struct dentry *dentry) if (d_unhashed(dentry)) return; + if (ceph_snap(d_inode(dentry->d_parent)) == CEPH_SNAPDIR) + return; + /* * we hold d_lock, so d_parent is stable, and d_fsdata is never * cleared until d_release @@ -1521,14 +1489,5 @@ const struct dentry_operations ceph_dentry_ops = { .d_revalidate = ceph_d_revalidate, .d_release = ceph_d_release, .d_prune = ceph_d_prune, -}; - -const struct dentry_operations ceph_snapdir_dentry_ops = { - .d_revalidate = ceph_snapdir_d_revalidate, - .d_release = ceph_d_release, -}; - -const struct dentry_operations ceph_snap_dentry_ops = { - .d_release = ceph_d_release, - .d_prune = ceph_d_prune, + .d_init = ceph_d_init, }; |