diff options
author | Xiubo Li <xiubli@redhat.com> | 2020-06-30 09:52:16 +0200 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2020-08-03 11:05:15 +0200 |
commit | 4f1d756def68588b88068af1d5a4a3b6dc7e6e2a (patch) | |
tree | edfa235e919db5e27474367a2d7ea5e69a367086 /fs/ceph/caps.c | |
parent | ceph: add check_session_state() helper and make it global (diff) | |
download | linux-4f1d756def68588b88068af1d5a4a3b6dc7e6e2a.tar.xz linux-4f1d756def68588b88068af1d5a4a3b6dc7e6e2a.zip |
ceph: add global total_caps to count the mdsc's total caps number
This will help to reduce using the global mdsc->mutex lock in many
places.
Signed-off-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r-- | fs/ceph/caps.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 972c13aa4225..5f4894063a73 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -668,6 +668,7 @@ void ceph_add_cap(struct inode *inode, spin_lock(&session->s_cap_lock); list_add_tail(&cap->session_caps, &session->s_caps); session->s_nr_caps++; + atomic64_inc(&mdsc->metric.total_caps); spin_unlock(&session->s_cap_lock); } else { spin_lock(&session->s_cap_lock); @@ -1161,6 +1162,7 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release) } else { list_del_init(&cap->session_caps); session->s_nr_caps--; + atomic64_dec(&mdsc->metric.total_caps); cap->session = NULL; removed = 1; } |