ceph: clean-up metrics data structures to reduce code duplication
authorLuís Henriques <lhenriques@suse.de>
Fri, 29 Oct 2021 14:09:28 +0000 (15:09 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 8 Nov 2021 02:29:52 +0000 (03:29 +0100)
commit17e9fc9fca0c4e0d5924f4b92f89c2c2b6b4be15
tree36e170f8c87105336b9be9f05bf12065346ff69e
parentcbed4ff76bbb8083780dcd6ebb5bed2af25b9505
ceph: clean-up metrics data structures to reduce code duplication

This patch modifies struct ceph_client_metric so that each metric block
(read, write and metadata) becomes an element in a array.  This allows to
also re-write the helper functions that handle these blocks, making them
simpler and, above all, reduce the amount of copy&paste every time a new
metric is added.

Thus, for each of these metrics there will be a new struct ceph_metric
entry that'll will contain all the sizes and latencies fields (and a lock).
Note however that the metadata metric doesn't really use the size_fields,
and thus this metric won't be shown in the debugfs '../metrics/size' file.

Signed-off-by: Luís Henriques <lhenriques@suse.de>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/debugfs.c
fs/ceph/metric.c
fs/ceph/metric.h