Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ceph: pass parent inode info to ceph_encode_dentry_release if we have it

If we have a parent inode reference already, then we don't need to
go back up the directory tree to find one.

Link: http://tracker.ceph.com/issues/18148
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Yan, Zheng <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>

authored by

Jeff Layton and committed by
Ilya Dryomov
ca6c8ae0 adf0d687

+13 -6
+7 -4
fs/ceph/caps.c
··· 3924 3924 } 3925 3925 3926 3926 int ceph_encode_dentry_release(void **p, struct dentry *dentry, 3927 + struct inode *dir, 3927 3928 int mds, int drop, int unless) 3928 3929 { 3929 - struct dentry *parent; 3930 + struct dentry *parent = NULL; 3930 3931 struct ceph_mds_request_release *rel = *p; 3931 3932 struct ceph_dentry_info *di = ceph_dentry(dentry); 3932 3933 int force = 0; ··· 3942 3941 spin_lock(&dentry->d_lock); 3943 3942 if (di->lease_session && di->lease_session->s_mds == mds) 3944 3943 force = 1; 3945 - parent = dget(dentry->d_parent); 3944 + if (!dir) { 3945 + parent = dget(dentry->d_parent); 3946 + dir = d_inode(parent); 3947 + } 3946 3948 spin_unlock(&dentry->d_lock); 3947 3949 3948 - ret = ceph_encode_inode_release(p, d_inode(parent), mds, drop, 3949 - unless, force); 3950 + ret = ceph_encode_inode_release(p, dir, mds, drop, unless, force); 3950 3951 dput(parent); 3951 3952 3952 3953 spin_lock(&dentry->d_lock);
+5 -2
fs/ceph/mds_client.c
··· 1954 1954 mds, req->r_inode_drop, req->r_inode_unless, 0); 1955 1955 if (req->r_dentry_drop) 1956 1956 releases += ceph_encode_dentry_release(&p, req->r_dentry, 1957 - mds, req->r_dentry_drop, req->r_dentry_unless); 1957 + req->r_locked_dir, mds, req->r_dentry_drop, 1958 + req->r_dentry_unless); 1958 1959 if (req->r_old_dentry_drop) 1959 1960 releases += ceph_encode_dentry_release(&p, req->r_old_dentry, 1960 - mds, req->r_old_dentry_drop, req->r_old_dentry_unless); 1961 + req->r_old_dentry_dir, mds, 1962 + req->r_old_dentry_drop, 1963 + req->r_old_dentry_unless); 1961 1964 if (req->r_old_inode_drop) 1962 1965 releases += ceph_encode_inode_release(&p, 1963 1966 d_inode(req->r_old_dentry),
+1
fs/ceph/super.h
··· 904 904 extern int ceph_encode_inode_release(void **p, struct inode *inode, 905 905 int mds, int drop, int unless, int force); 906 906 extern int ceph_encode_dentry_release(void **p, struct dentry *dn, 907 + struct inode *dir, 907 908 int mds, int drop, int unless); 908 909 909 910 extern int ceph_get_caps(struct ceph_inode_info *ci, int need, int want,