ceph: send io size metrics to mds daemon
v2 cover ceph: send io size metrics to mds daemon
From: Xiubo Li <[email protected]>
V2:
- change the patch order
- replace the fixed 10 with sizeof(struct ceph_metric_header)
Xiubo Li (2):
ceph: simplify the metrics struct
ceph: send the read/write io size metrics to mds
fs/ceph/metric.c | 90 ++++++++++++++++++++++++++++++------------------ fs/ceph/metric.h | 79 +++++++++++++++++------------------------- 2 files changed, 89 insertions(+), 80 deletions(-)
Signature · 1 line
2.27.0
PATCH v2 1/2 ceph: simplify the metrics struct
From: Xiubo Li <[email protected]>
--- fs/ceph/metric.c | 65 ++++++++++++++++++++++++------------------------ fs/ceph/metric.h | 59 ++++++++++--------------------------------- 2 files changed, 46 insertions(+), 78 deletions(-)
fs/ceph/metric.c +33 -32
@@ -22,6 +22,7 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,struct ceph_opened_inodes *inodes;struct ceph_client_metric *m = &mdsc->metric;u64 nr_caps =atomic64_read (&m->total_caps); +u32 header_len =sizeof (struct ceph_metric_header );struct ceph_msg *msg;struct timespec64 ts;s64 sum;
@@ -43,10 +44,10 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,/* encode the cap metric */ cap = (struct ceph_metric_cap *)(head +1 ); - cap->type =cpu_to_le32 (CLIENT_METRIC_TYPE_CAP_INFO ); - cap->ver =1 ; - cap->compat =1 ; - cap->data_len =cpu_to_le32 (sizeof (*cap) -10 ); + cap->header.type =cpu_to_le32 (CLIENT_METRIC_TYPE_CAP_INFO ); + cap->header.ver =1 ; + cap->header.compat =1 ; + cap->header.data_len =cpu_to_le32 (sizeof (*cap) - header_len); cap->hit =cpu_to_le64 (percpu_counter_sum (&m->i_caps_hit)); cap->mis =cpu_to_le64 (percpu_counter_sum (&m->i_caps_mis)); cap->total =cpu_to_le64 (nr_caps);
@@ -54,10 +55,10 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,/* encode the read latency metric */ read = (struct ceph_metric_read_latency *)(cap +1 ); - read->type =cpu_to_le32 (CLIENT_METRIC_TYPE_READ_LATENCY ); - read->ver =1 ; - read->compat =1 ; - read->data_len =cpu_to_le32 (sizeof (*read) -10 ); + read->header.type =cpu_to_le32 (CLIENT_METRIC_TYPE_READ_LATENCY ); + read->header.ver =1 ; + read->header.compat =1 ; + read->header.data_len =cpu_to_le32 (sizeof (*read) - header_len); sum = m->read_latency_sum;jiffies_to_timespec64 (sum, &ts); read->sec =cpu_to_le32 (ts.tv_sec);
@@ -66,10 +67,10 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,/* encode the write latency metric */ write = (struct ceph_metric_write_latency *)(read +1 ); - write->type =cpu_to_le32 (CLIENT_METRIC_TYPE_WRITE_LATENCY ); - write->ver =1 ; - write->compat =1 ; - write->data_len =cpu_to_le32 (sizeof (*write) -10 ); + write->header.type =cpu_to_le32 (CLIENT_METRIC_TYPE_WRITE_LATENCY ); + write->header.ver =1 ; + write->header.compat =1 ; + write->header.data_len =cpu_to_le32 (sizeof (*write) - header_len); sum = m->write_latency_sum;jiffies_to_timespec64 (sum, &ts); write->sec =cpu_to_le32 (ts.tv_sec);
@@ -78,10 +79,10 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,/* encode the metadata latency metric */ meta = (struct ceph_metric_metadata_latency *)(write +1 ); - meta->type =cpu_to_le32 (CLIENT_METRIC_TYPE_METADATA_LATENCY ); - meta->ver =1 ; - meta->compat =1 ; - meta->data_len =cpu_to_le32 (sizeof (*meta) -10 ); + meta->header.type =cpu_to_le32 (CLIENT_METRIC_TYPE_METADATA_LATENCY ); + meta->header.ver =1 ; + meta->header.compat =1 ; + meta->header.data_len =cpu_to_le32 (sizeof (*meta) - header_len); sum = m->metadata_latency_sum;jiffies_to_timespec64 (sum, &ts); meta->sec =cpu_to_le32 (ts.tv_sec);
@@ -90,10 +91,10 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,/* encode the dentry lease metric */ dlease = (struct ceph_metric_dlease *)(meta +1 ); - dlease->type =cpu_to_le32 (CLIENT_METRIC_TYPE_DENTRY_LEASE ); - dlease->ver =1 ; - dlease->compat =1 ; - dlease->data_len =cpu_to_le32 (sizeof (*dlease) -10 ); + dlease->header.type =cpu_to_le32 (CLIENT_METRIC_TYPE_DENTRY_LEASE ); + dlease->header.ver =1 ; + dlease->header.compat =1 ; + dlease->header.data_len =cpu_to_le32 (sizeof (*dlease) - header_len); dlease->hit =cpu_to_le64 (percpu_counter_sum (&m->d_lease_hit)); dlease->mis =cpu_to_le64 (percpu_counter_sum (&m->d_lease_mis)); dlease->total =cpu_to_le64 (atomic64_read (&m->total_dentries));
@@ -103,30 +104,30 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,/* encode the opened files metric */ files = (struct ceph_opened_files *)(dlease +1 ); - files->type =cpu_to_le32 (CLIENT_METRIC_TYPE_OPENED_FILES ); - files->ver =1 ; - files->compat =1 ; - files->data_len =cpu_to_le32 (sizeof (*files) -10 ); + files->header.type =cpu_to_le32 (CLIENT_METRIC_TYPE_OPENED_FILES ); + files->header.ver =1 ; + files->header.compat =1 ; + files->header.data_len =cpu_to_le32 (sizeof (*files) - header_len); files->opened_files =cpu_to_le64 (atomic64_read (&m->opened_files)); files->total =cpu_to_le64 (sum); items++;/* encode the pinned icaps metric */ icaps = (struct ceph_pinned_icaps *)(files +1 ); - icaps->type =cpu_to_le32 (CLIENT_METRIC_TYPE_PINNED_ICAPS ); - icaps->ver =1 ; - icaps->compat =1 ; - icaps->data_len =cpu_to_le32 (sizeof (*icaps) -10 ); + icaps->header.type =cpu_to_le32 (CLIENT_METRIC_TYPE_PINNED_ICAPS ); + icaps->header.ver =1 ; + icaps->header.compat =1 ; + icaps->header.data_len =cpu_to_le32 (sizeof (*icaps) - header_len); icaps->pinned_icaps =cpu_to_le64 (nr_caps); icaps->total =cpu_to_le64 (sum); items++;/* encode the opened inodes metric */ inodes = (struct ceph_opened_inodes *)(icaps +1 ); - inodes->type =cpu_to_le32 (CLIENT_METRIC_TYPE_OPENED_INODES ); - inodes->ver =1 ; - inodes->compat =1 ; - inodes->data_len =cpu_to_le32 (sizeof (*inodes) -10 ); + inodes->header.type =cpu_to_le32 (CLIENT_METRIC_TYPE_OPENED_INODES ); + inodes->header.ver =1 ; + inodes->header.compat =1 ; + inodes->header.data_len =cpu_to_le32 (sizeof (*inodes) - header_len); inodes->opened_inodes =cpu_to_le64 (percpu_counter_sum (&m->opened_inodes)); inodes->total =cpu_to_le64 (sum); items++;
fs/ceph/metric.h +13 -46
111 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v2 2/2 ceph: send the read/write io size metrics to mds
In reply to [email protected]From: Xiubo Li <[email protected]>
URL: https://tracker.ceph.com/issues/49913
--- fs/ceph/metric.c | 25 ++++++++++++++++++++++++- fs/ceph/metric.h | 20 +++++++++++++++++++- 2 files changed, 43 insertions(+), 2 deletions(-)
fs/ceph/metric.c +24 -1
@@ -20,6 +20,8 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,struct ceph_opened_files *files;struct ceph_pinned_icaps *icaps;struct ceph_opened_inodes *inodes; +struct ceph_read_io_size *rsize; +struct ceph_write_io_size *wsize;struct ceph_client_metric *m = &mdsc->metric;u64 nr_caps =atomic64_read (&m->total_caps);u32 header_len =sizeof (struct ceph_metric_header );
@@ -31,7 +33,8 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc, len =sizeof (*head) +sizeof (*cap) +sizeof (*read) +sizeof (*write) +sizeof (*meta) +sizeof (*dlease) +sizeof (*files) - +sizeof (*icaps) +sizeof (*inodes); + +sizeof (*icaps) +sizeof (*inodes) +sizeof (*rsize) + +sizeof (*wsize); msg =ceph_msg_new (CEPH_MSG_CLIENT_METRICS , len,GFP_NOFS , true);if (!msg) {
@@ -132,6 +135,26 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc, inodes->total =cpu_to_le64 (sum); items++; +/* encode the read io size metric */ + rsize = (struct ceph_read_io_size *)(inodes +1 ); + rsize->header.type =cpu_to_le32 (CLIENT_METRIC_TYPE_READ_IO_SIZES ); + rsize->header.ver =1 ; + rsize->header.compat =1 ; + rsize->header.data_len =cpu_to_le32 (sizeof (*rsize) - header_len); + rsize->total_ops =cpu_to_le64 (m->total_reads); + rsize->total_size =cpu_to_le64 (m->read_size_sum); + items++; + +/* encode the write io size metric */ + wsize = (struct ceph_write_io_size *)(rsize +1 ); + wsize->header.type =cpu_to_le32 (CLIENT_METRIC_TYPE_WRITE_IO_SIZES ); + wsize->header.ver =1 ; + wsize->header.compat =1 ; + wsize->header.data_len =cpu_to_le32 (sizeof (*wsize) - header_len); + wsize->total_ops =cpu_to_le64 (m->total_writes); + wsize->total_size =cpu_to_le64 (m->write_size_sum); + items++; +put_unaligned_le32 (items, &head->num); msg->front.iov_len = len; msg->hdr.version =cpu_to_le16 (1 );
fs/ceph/metric.h +19 -1
@@ -17,8 +17,10 @@ enum ceph_metric_type {CLIENT_METRIC_TYPE_OPENED_FILES ,CLIENT_METRIC_TYPE_PINNED_ICAPS ,CLIENT_METRIC_TYPE_OPENED_INODES , +CLIENT_METRIC_TYPE_READ_IO_SIZES , +CLIENT_METRIC_TYPE_WRITE_IO_SIZES , - CLIENT_METRIC_TYPE_MAX = CLIENT_METRIC_TYPE_OPENED_INODES, + CLIENT_METRIC_TYPE_MAX = CLIENT_METRIC_TYPE_WRITE_IO_SIZES, };/*
@@ -34,6 +36,8 @@ enum ceph_metric_type {CLIENT_METRIC_TYPE_OPENED_FILES , \CLIENT_METRIC_TYPE_PINNED_ICAPS , \CLIENT_METRIC_TYPE_OPENED_INODES , \ +CLIENT_METRIC_TYPE_READ_IO_SIZES , \ +CLIENT_METRIC_TYPE_WRITE_IO_SIZES , \ \ CLIENT_METRIC_TYPE_MAX, \ }
@@ -103,6 +107,20 @@ struct ceph_opened_inodes {__le64 total; } __packed; +/* metric read io size header */ +struct ceph_read_io_size { +struct ceph_metric_header header; +__le64 total_ops; +__le64 total_size; +} __packed; + +/* metric write io size header */ +struct ceph_write_io_size { +struct ceph_metric_header header; +__le64 total_ops; +__le64 total_size; +} __packed; +struct ceph_metric_head {__le32 num;/* the number of metrics that will be sent */ } __packed;
Signature · 1 line
2.27.0
Quoted 6 lines · On Thu, 2021-05-13 at 09:40 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
V2:
- change the patch order
- replace the fixed 10 withsizeof(struct ceph_metric_header)
Quoted 8 lines
Xiubo Li (2):
ceph: simplify the metrics struct
ceph: send the read/write io size metrics to mdsfs/ceph/metric.c | 90 ++++++++++++++++++++++++++++++------------------ fs/ceph/metric.h | 79 +++++++++++++++++------------------------- 2 files changed, 89 insertions(+), 80 deletions(-)
Thanks Xiubo,
These look good. I'll do some testing with them and plan to merge these into the testing branch later today.
Cheers,
Signature · 1 line
Jeff Layton <[email protected]>
Quoted 11 lines · Jeff Layton
Quoted 10 lines · On Thu, 2021-05-13 at 09:40 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
V2:
- change the patch order
- replace the fixed 10 withsizeof(struct ceph_metric_header)Xiubo Li (2):
ceph: simplify the metrics struct
ceph: send the read/write io size metrics to mds
Quoted 8 lines
Quoted 4 lines
fs/ceph/metric.c | 90 ++++++++++++++++++++++++++++++------------------ fs/ceph/metric.h | 79 +++++++++++++++++------------------------- 2 files changed, 89 insertions(+), 80 deletions(-)Thanks Xiubo,
These look good. I'll do some testing with them and plan to merge these into the testing branch later today.
Sure, take your time.
BRs
Xiubo
Quoted 1 line
Cheers,
Ilya Dryomov
maintainerQuoted 18 lines · Xiubo Li
Quoted 15 lines · Jeff Layton
Quoted 14 lines · On Thu, 2021-05-13 at 09:40 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
V2:
- change the patch order
- replace the fixed 10 withsizeof(struct ceph_metric_header)Xiubo Li (2):
ceph: simplify the metrics struct
ceph: send the read/write io size metrics to mdsfs/ceph/metric.c | 90 ++++++++++++++++++++++++++++++------------------ fs/ceph/metric.h | 79 +++++++++++++++++------------------------- 2 files changed, 89 insertions(+), 80 deletions(-)
Quoted 6 lines
Quoted 4 lines
Thanks Xiubo,
These look good. I'll do some testing with them and plan to merge these into the testing branch later today.
Sure, take your time.
FYI I squashed "ceph: send the read/write io size metrics to mds" into "ceph: add IO size metrics support".
Thanks,
Ilya
Quoted 18 lines · Ilya Dryomov
Quoted 17 lines · Xiubo Li
Quoted 15 lines · Jeff Layton
Quoted 14 lines · On Thu, 2021-05-13 at 09:40 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
V2:
- change the patch order
- replace the fixed 10 withsizeof(struct ceph_metric_header)Xiubo Li (2):
ceph: simplify the metrics struct
ceph: send the read/write io size metrics to mdsfs/ceph/metric.c | 90 ++++++++++++++++++++++++++++++------------------ fs/ceph/metric.h | 79 +++++++++++++++++------------------------- 2 files changed, 89 insertions(+), 80 deletions(-)
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
Thanks Xiubo,
These look good. I'll do some testing with them and plan to merge these into the testing branch later today.
Sure, take your time.
FYI I squashed "ceph: send the read/write io size metrics to mds" into "ceph: add IO size metrics support".
Got it.
Thanks
Quoted 4 lines
Thanks,
Ilya
Quoted 19 lines · Xiubo Li
Quoted 18 lines · Ilya Dryomov
Quoted 17 lines · Xiubo Li
Quoted 15 lines · Jeff Layton
Quoted 14 lines · On Thu, 2021-05-13 at 09:40 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
V2:
- change the patch order
- replace the fixed 10 withsizeof(struct ceph_metric_header)Xiubo Li (2):
ceph: simplify the metrics struct
ceph: send the read/write io size metrics to mdsfs/ceph/metric.c | 90 ++++++++++++++++++++++++++++++------------------ fs/ceph/metric.h | 79 +++++++++++++++++------------------------- 2 files changed, 89 insertions(+), 80 deletions(-)
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
Thanks Xiubo,
These look good. I'll do some testing with them and plan to merge these into the testing branch later today.
Sure, take your time.
FYI I squashed "ceph: send the read/write io size metrics to mds" into "ceph: add IO size metrics support".
I've dropped this combined patch for now, as it was triggering an MDS assertion that was hampering testing [1]. I'll plan to add it back once that problem is resolved in the MDS.
[1]: https://github.com/ceph/ceph/pull/41357
Cheers,
Signature · 1 line
Jeff Layton <[email protected]>
Quoted 26 lines · Jeff Layton
Quoted 18 lines · Xiubo Li
Quoted 17 lines · Ilya Dryomov
Quoted 16 lines · Xiubo Li
Quoted 15 lines · Jeff Layton
Quoted 14 lines · On Thu, 2021-05-13 at 09:40 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
V2:
- change the patch order
- replace the fixed 10 withsizeof(struct ceph_metric_header)Xiubo Li (2):
ceph: simplify the metrics struct ceph: send the read/write io size metrics to mds fs/ceph/metric.c | 90 ++++++++++++++++++++++++++++++------------------ fs/ceph/metric.h | 79 +++++++++++++++++------------------------- 2 files changed, 89 insertions(+), 80 deletions(-)Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
Thanks Xiubo,
These look good. I'll do some testing with them and plan to merge these into the testing branch later today.
Sure, take your time.
FYI I squashed "ceph: send the read/write io size metrics to mds" into "ceph: add IO size metrics support".
Quoted 7 lines
I've dropped this combined patch for now, as it was triggering an MDS assertion that was hampering testing [1]. I'll plan to add it back once that problem is resolved in the MDS.
[1]: https://github.com/ceph/ceph/pull/41357
Cheers,
Ack. Thanks.
Quoted 31 lines · Xiubo Li
Quoted 30 lines · Jeff Layton
Quoted 18 lines · Xiubo Li
Quoted 17 lines · Ilya Dryomov
Quoted 16 lines · Xiubo Li
Quoted 15 lines · Jeff Layton
Quoted 14 lines · On Thu, 2021-05-13 at 09:40 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
V2:
- change the patch order
- replace the fixed 10 withsizeof(struct ceph_metric_header)Xiubo Li (2):
ceph: simplify the metrics struct ceph: send the read/write io size metrics to mds fs/ceph/metric.c | 90 ++++++++++++++++++++++++++++++------------------ fs/ceph/metric.h | 79 +++++++++++++++++------------------------- 2 files changed, 89 insertions(+), 80 deletions(-)Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
Thanks Xiubo,
These look good. I'll do some testing with them and plan to merge these into the testing branch later today.
Sure, take your time.
FYI I squashed "ceph: send the read/write io size metrics to mds" into "ceph: add IO size metrics support".
I've dropped this combined patch for now, as it was triggering an MDS assertion that was hampering testing [1]. I'll plan to add it back once that problem is resolved in the MDS.
Quoted 7 lines
Quoted 3 lines
[1]: https://github.com/ceph/ceph/pull/41357
Cheers,
Ack. Thanks.
Patrick mentioned that the problem with the MDS has now been resolved, so I've gone ahead and merged this patch back into testing branch. Let me know if you see any more issues.
Thanks!
Signature · 1 line
Jeff Layton <[email protected]>