2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-19 10:44:14 +08:00

ceph: switch to global cap helper

__ceph_is_any_caps is a duplicate helper.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
Xiubo Li 2019-12-03 03:00:51 -05:00 committed by Ilya Dryomov
parent bba1560bd4
commit bd84fbcb31

View File

@ -1011,18 +1011,13 @@ static int __ceph_is_single_caps(struct ceph_inode_info *ci)
return rb_first(&ci->i_caps) == rb_last(&ci->i_caps); return rb_first(&ci->i_caps) == rb_last(&ci->i_caps);
} }
static int __ceph_is_any_caps(struct ceph_inode_info *ci)
{
return !RB_EMPTY_ROOT(&ci->i_caps);
}
int ceph_is_any_caps(struct inode *inode) int ceph_is_any_caps(struct inode *inode)
{ {
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
int ret; int ret;
spin_lock(&ci->i_ceph_lock); spin_lock(&ci->i_ceph_lock);
ret = __ceph_is_any_caps(ci); ret = __ceph_is_any_real_caps(ci);
spin_unlock(&ci->i_ceph_lock); spin_unlock(&ci->i_ceph_lock);
return ret; return ret;
@ -1099,15 +1094,16 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release)
if (removed) if (removed)
ceph_put_cap(mdsc, cap); ceph_put_cap(mdsc, cap);
/* when reconnect denied, we remove session caps forcibly, if (!__ceph_is_any_real_caps(ci)) {
* i_wr_ref can be non-zero. If there are ongoing write, /* when reconnect denied, we remove session caps forcibly,
* keep i_snap_realm. * i_wr_ref can be non-zero. If there are ongoing write,
*/ * keep i_snap_realm.
if (!__ceph_is_any_caps(ci) && ci->i_wr_ref == 0 && ci->i_snap_realm) */
drop_inode_snap_realm(ci); if (ci->i_wr_ref == 0 && ci->i_snap_realm)
drop_inode_snap_realm(ci);
if (!__ceph_is_any_real_caps(ci))
__cap_delay_cancel(mdsc, ci); __cap_delay_cancel(mdsc, ci);
}
} }
struct cap_msg_args { struct cap_msg_args {
@ -2945,7 +2941,7 @@ void ceph_put_cap_refs(struct ceph_inode_info *ci, int had)
ci->i_head_snapc = NULL; ci->i_head_snapc = NULL;
} }
/* see comment in __ceph_remove_cap() */ /* see comment in __ceph_remove_cap() */
if (!__ceph_is_any_caps(ci) && ci->i_snap_realm) if (!__ceph_is_any_real_caps(ci) && ci->i_snap_realm)
drop_inode_snap_realm(ci); drop_inode_snap_realm(ci);
} }
spin_unlock(&ci->i_ceph_lock); spin_unlock(&ci->i_ceph_lock);