ceph: make __take_cap_refs non-static
Rename it to ceph_take_cap_refs and make it available to other files. Also replace a comment with a lockdep assertion. Signed-off-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: "Yan, Zheng" <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:

committed by
Ilya Dryomov

parent
891f3f5a6a
commit
40dcf75e82
@@ -2515,12 +2515,12 @@ void ceph_kick_flushing_inode_caps(struct ceph_mds_session *session,
|
|||||||
/*
|
/*
|
||||||
* Take references to capabilities we hold, so that we don't release
|
* Take references to capabilities we hold, so that we don't release
|
||||||
* them to the MDS prematurely.
|
* them to the MDS prematurely.
|
||||||
*
|
|
||||||
* Protected by i_ceph_lock.
|
|
||||||
*/
|
*/
|
||||||
static void __take_cap_refs(struct ceph_inode_info *ci, int got,
|
void ceph_take_cap_refs(struct ceph_inode_info *ci, int got,
|
||||||
bool snap_rwsem_locked)
|
bool snap_rwsem_locked)
|
||||||
{
|
{
|
||||||
|
lockdep_assert_held(&ci->i_ceph_lock);
|
||||||
|
|
||||||
if (got & CEPH_CAP_PIN)
|
if (got & CEPH_CAP_PIN)
|
||||||
ci->i_pin_ref++;
|
ci->i_pin_ref++;
|
||||||
if (got & CEPH_CAP_FILE_RD)
|
if (got & CEPH_CAP_FILE_RD)
|
||||||
@@ -2541,7 +2541,7 @@ static void __take_cap_refs(struct ceph_inode_info *ci, int got,
|
|||||||
if (ci->i_wb_ref == 0)
|
if (ci->i_wb_ref == 0)
|
||||||
ihold(&ci->vfs_inode);
|
ihold(&ci->vfs_inode);
|
||||||
ci->i_wb_ref++;
|
ci->i_wb_ref++;
|
||||||
dout("__take_cap_refs %p wb %d -> %d (?)\n",
|
dout("%s %p wb %d -> %d (?)\n", __func__,
|
||||||
&ci->vfs_inode, ci->i_wb_ref-1, ci->i_wb_ref);
|
&ci->vfs_inode, ci->i_wb_ref-1, ci->i_wb_ref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2664,7 +2664,7 @@ again:
|
|||||||
(need & CEPH_CAP_FILE_RD) &&
|
(need & CEPH_CAP_FILE_RD) &&
|
||||||
!(*got & CEPH_CAP_FILE_CACHE))
|
!(*got & CEPH_CAP_FILE_CACHE))
|
||||||
ceph_disable_fscache_readpage(ci);
|
ceph_disable_fscache_readpage(ci);
|
||||||
__take_cap_refs(ci, *got, true);
|
ceph_take_cap_refs(ci, *got, true);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -2893,7 +2893,7 @@ int ceph_get_caps(struct file *filp, int need, int want,
|
|||||||
void ceph_get_cap_refs(struct ceph_inode_info *ci, int caps)
|
void ceph_get_cap_refs(struct ceph_inode_info *ci, int caps)
|
||||||
{
|
{
|
||||||
spin_lock(&ci->i_ceph_lock);
|
spin_lock(&ci->i_ceph_lock);
|
||||||
__take_cap_refs(ci, caps, false);
|
ceph_take_cap_refs(ci, caps, false);
|
||||||
spin_unlock(&ci->i_ceph_lock);
|
spin_unlock(&ci->i_ceph_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1055,6 +1055,8 @@ void ceph_kick_flushing_inode_caps(struct ceph_mds_session *session,
|
|||||||
struct ceph_inode_info *ci);
|
struct ceph_inode_info *ci);
|
||||||
extern struct ceph_cap *ceph_get_cap_for_mds(struct ceph_inode_info *ci,
|
extern struct ceph_cap *ceph_get_cap_for_mds(struct ceph_inode_info *ci,
|
||||||
int mds);
|
int mds);
|
||||||
|
extern void ceph_take_cap_refs(struct ceph_inode_info *ci, int caps,
|
||||||
|
bool snap_rwsem_locked);
|
||||||
extern void ceph_get_cap_refs(struct ceph_inode_info *ci, int caps);
|
extern void ceph_get_cap_refs(struct ceph_inode_info *ci, int caps);
|
||||||
extern void ceph_put_cap_refs(struct ceph_inode_info *ci, int had);
|
extern void ceph_put_cap_refs(struct ceph_inode_info *ci, int had);
|
||||||
extern void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr,
|
extern void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr,
|
||||||
|
Reference in New Issue
Block a user