]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ceph: add a new metric to keep track of remote object copies
authorLuís Henriques <lhenriques@suse.de>
Thu, 4 Nov 2021 12:31:47 +0000 (12:31 +0000)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 8 Nov 2021 02:29:52 +0000 (03:29 +0100)
This patch adds latency and size metrics for remote object copies
operations ("copyfrom").  For now, these metrics will be available on the
client only, they won't be sent to the MDS.

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

index e04ae1098431f237d7226694003354d6d4cb8a23..3cf7c9c1085b9121865885847eaec42478c6b465 100644 (file)
@@ -167,7 +167,8 @@ static int metrics_file_show(struct seq_file *s, void *p)
 static const char * const metric_str[] = {
        "read",
        "write",
-       "metadata"
+       "metadata",
+       "copyfrom"
 };
 static int metrics_latency_show(struct seq_file *s, void *p)
 {
index 6c77f203e7b557d523f61fca41dad0146d185c22..220a41831b46f935b8f3d6f1d797a9db0d4fab9f 100644 (file)
@@ -2304,6 +2304,10 @@ static ssize_t ceph_do_objects_copy(struct ceph_inode_info *src_ci, u64 *src_off
                else {
                        ceph_osdc_start_request(osdc, req, false);
                        ret = ceph_osdc_wait_request(osdc, req);
+                       ceph_update_copyfrom_metrics(&fsc->mdsc->metric,
+                                                    req->r_start_latency,
+                                                    req->r_end_latency,
+                                                    object_size, ret);
                        ceph_osdc_put_request(req);
                }
                if (ret) {
index e67fc997760b2445e4dcb9582ce3b63c99dc8ba4..bb45608181e7f2678367a6bf5167ba3f0b3715e8 100644 (file)
@@ -129,6 +129,7 @@ enum metric_type {
        METRIC_READ,
        METRIC_WRITE,
        METRIC_METADATA,
+       METRIC_COPYFROM,
        METRIC_MAX
 };
 
@@ -214,4 +215,11 @@ static inline void ceph_update_metadata_metrics(struct ceph_client_metric *m,
        ceph_update_metrics(&m->metric[METRIC_METADATA],
                            r_start, r_end, 0, rc);
 }
+static inline void ceph_update_copyfrom_metrics(struct ceph_client_metric *m,
+                                               ktime_t r_start, ktime_t r_end,
+                                               unsigned int size, int rc)
+{
+       ceph_update_metrics(&m->metric[METRIC_COPYFROM],
+                           r_start, r_end, size, rc);
+}
 #endif /* _FS_CEPH_MDS_METRIC_H */