* [PATCH] ceph: send dentry lease metrics to MDS daemon
@ 2020-10-21 4:50 xiubli
2020-11-05 12:34 ` Jeff Layton
0 siblings, 1 reply; 3+ messages in thread
From: xiubli @ 2020-10-21 4:50 UTC (permalink / raw)
To: jlayton; +Cc: idryomov, zyan, pdonnell, vshankar, ceph-devel, Xiubo Li
From: Xiubo Li <xiubli@redhat.com>
For the old ceph version, if it received this one metric message
containing the dentry lease metric info, it will just ignore it.
URL: https://tracker.ceph.com/issues/43423
Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
fs/ceph/metric.c | 18 +++++++++++++++---
fs/ceph/metric.h | 14 ++++++++++++++
2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/fs/ceph/metric.c b/fs/ceph/metric.c
index fee4c4778313..06729cbfabee 100644
--- a/fs/ceph/metric.c
+++ b/fs/ceph/metric.c
@@ -16,6 +16,7 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,
struct ceph_metric_read_latency *read;
struct ceph_metric_write_latency *write;
struct ceph_metric_metadata_latency *meta;
+ struct ceph_metric_dlease *dlease;
struct ceph_client_metric *m = &mdsc->metric;
u64 nr_caps = atomic64_read(&m->total_caps);
struct ceph_msg *msg;
@@ -25,7 +26,7 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,
s32 len;
len = sizeof(*head) + sizeof(*cap) + sizeof(*read) + sizeof(*write)
- + sizeof(*meta);
+ + sizeof(*meta) + sizeof(*dlease);
msg = ceph_msg_new(CEPH_MSG_CLIENT_METRICS, len, GFP_NOFS, true);
if (!msg) {
@@ -42,8 +43,8 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,
cap->ver = 1;
cap->compat = 1;
cap->data_len = cpu_to_le32(sizeof(*cap) - 10);
- cap->hit = cpu_to_le64(percpu_counter_sum(&mdsc->metric.i_caps_hit));
- cap->mis = cpu_to_le64(percpu_counter_sum(&mdsc->metric.i_caps_mis));
+ 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);
items++;
@@ -83,6 +84,17 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,
meta->nsec = cpu_to_le32(ts.tv_nsec);
items++;
+ /* 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->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 = atomic64_read(&m->total_dentries),
+ items++;
+
put_unaligned_le32(items, &head->num);
msg->front.iov_len = len;
msg->hdr.version = cpu_to_le16(1);
diff --git a/fs/ceph/metric.h b/fs/ceph/metric.h
index 710f3f1dceab..af6038ff39d4 100644
--- a/fs/ceph/metric.h
+++ b/fs/ceph/metric.h
@@ -27,6 +27,7 @@ enum ceph_metric_type {
CLIENT_METRIC_TYPE_READ_LATENCY, \
CLIENT_METRIC_TYPE_WRITE_LATENCY, \
CLIENT_METRIC_TYPE_METADATA_LATENCY, \
+ CLIENT_METRIC_TYPE_DENTRY_LEASE, \
\
CLIENT_METRIC_TYPE_MAX, \
}
@@ -80,6 +81,19 @@ struct ceph_metric_metadata_latency {
__le32 nsec;
} __packed;
+/* metric dentry lease header */
+struct ceph_metric_dlease {
+ __le32 type; /* ceph metric type */
+
+ __u8 ver;
+ __u8 compat;
+
+ __le32 data_len; /* length of sizeof(hit + mis + total) */
+ __le64 hit;
+ __le64 mis;
+ __le64 total;
+} __packed;
+
struct ceph_metric_head {
__le32 num; /* the number of metrics that will be sent */
} __packed;
--
2.18.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ceph: send dentry lease metrics to MDS daemon
2020-10-21 4:50 [PATCH] ceph: send dentry lease metrics to MDS daemon xiubli
@ 2020-11-05 12:34 ` Jeff Layton
2020-11-05 12:46 ` Xiubo Li
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Layton @ 2020-11-05 12:34 UTC (permalink / raw)
To: xiubli; +Cc: idryomov, zyan, pdonnell, vshankar, ceph-devel
On Wed, 2020-10-21 at 00:50 -0400, xiubli@redhat.com wrote:
> From: Xiubo Li <xiubli@redhat.com>
>
> For the old ceph version, if it received this one metric message
> containing the dentry lease metric info, it will just ignore it.
>
> URL: https://tracker.ceph.com/issues/43423
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
> fs/ceph/metric.c | 18 +++++++++++++++---
> fs/ceph/metric.h | 14 ++++++++++++++
> 2 files changed, 29 insertions(+), 3 deletions(-)
>
Sorry for the long delay -- this one fell through the cracks somehow...
> diff --git a/fs/ceph/metric.c b/fs/ceph/metric.c
> index fee4c4778313..06729cbfabee 100644
> --- a/fs/ceph/metric.c
> +++ b/fs/ceph/metric.c
> @@ -16,6 +16,7 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,
> struct ceph_metric_read_latency *read;
> struct ceph_metric_write_latency *write;
> struct ceph_metric_metadata_latency *meta;
> + struct ceph_metric_dlease *dlease;
> struct ceph_client_metric *m = &mdsc->metric;
> u64 nr_caps = atomic64_read(&m->total_caps);
> struct ceph_msg *msg;
> @@ -25,7 +26,7 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,
> s32 len;
>
>
>
>
>
>
>
>
> len = sizeof(*head) + sizeof(*cap) + sizeof(*read) + sizeof(*write)
> - + sizeof(*meta);
> + + sizeof(*meta) + sizeof(*dlease);
>
>
>
>
>
>
>
>
> msg = ceph_msg_new(CEPH_MSG_CLIENT_METRICS, len, GFP_NOFS, true);
> if (!msg) {
> @@ -42,8 +43,8 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,
> cap->ver = 1;
> cap->compat = 1;
> cap->data_len = cpu_to_le32(sizeof(*cap) - 10);
> - cap->hit = cpu_to_le64(percpu_counter_sum(&mdsc->metric.i_caps_hit));
> - cap->mis = cpu_to_le64(percpu_counter_sum(&mdsc->metric.i_caps_mis));
> + 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);
> items++;
>
>
>
>
>
>
>
>
> @@ -83,6 +84,17 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,
> meta->nsec = cpu_to_le32(ts.tv_nsec);
> items++;
>
>
>
>
>
>
>
>
> + /* 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->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 = atomic64_read(&m->total_dentries),
dlease->total needs to be wrapped in cpu_to_le64().
> + items++;
> +
> put_unaligned_le32(items, &head->num);
> msg->front.iov_len = len;
> msg->hdr.version = cpu_to_le16(1);
> diff --git a/fs/ceph/metric.h b/fs/ceph/metric.h
> index 710f3f1dceab..af6038ff39d4 100644
> --- a/fs/ceph/metric.h
> +++ b/fs/ceph/metric.h
> @@ -27,6 +27,7 @@ enum ceph_metric_type {
> CLIENT_METRIC_TYPE_READ_LATENCY, \
> CLIENT_METRIC_TYPE_WRITE_LATENCY, \
> CLIENT_METRIC_TYPE_METADATA_LATENCY, \
> + CLIENT_METRIC_TYPE_DENTRY_LEASE, \
> \
> CLIENT_METRIC_TYPE_MAX, \
> }
> @@ -80,6 +81,19 @@ struct ceph_metric_metadata_latency {
> __le32 nsec;
> } __packed;
>
>
>
>
> +/* metric dentry lease header */
> +struct ceph_metric_dlease {
> + __le32 type; /* ceph metric type */
> +
> + __u8 ver;
> + __u8 compat;
> +
> + __le32 data_len; /* length of sizeof(hit + mis + total) */
> + __le64 hit;
> + __le64 mis;
> + __le64 total;
> +} __packed;
> +
> struct ceph_metric_head {
> __le32 num; /* the number of metrics that will be sent */
> } __packed;
--
Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ceph: send dentry lease metrics to MDS daemon
2020-11-05 12:34 ` Jeff Layton
@ 2020-11-05 12:46 ` Xiubo Li
0 siblings, 0 replies; 3+ messages in thread
From: Xiubo Li @ 2020-11-05 12:46 UTC (permalink / raw)
To: Jeff Layton; +Cc: idryomov, zyan, pdonnell, vshankar, ceph-devel
On 2020/11/5 20:34, Jeff Layton wrote:
> On Wed, 2020-10-21 at 00:50 -0400, xiubli@redhat.com wrote:
>> From: Xiubo Li <xiubli@redhat.com>
>>
>> For the old ceph version, if it received this one metric message
>> containing the dentry lease metric info, it will just ignore it.
>>
>> URL: https://tracker.ceph.com/issues/43423
>> Signed-off-by: Xiubo Li <xiubli@redhat.com>
>> ---
>> fs/ceph/metric.c | 18 +++++++++++++++---
>> fs/ceph/metric.h | 14 ++++++++++++++
>> 2 files changed, 29 insertions(+), 3 deletions(-)
>>
> Sorry for the long delay -- this one fell through the cracks somehow...
No worry I was also waiting the ceph PR to be merged.
>> diff --git a/fs/ceph/metric.c b/fs/ceph/metric.c
>> index fee4c4778313..06729cbfabee 100644
>> --- a/fs/ceph/metric.c
>> +++ b/fs/ceph/metric.c
>> @@ -16,6 +16,7 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,
>> struct ceph_metric_read_latency *read;
>> struct ceph_metric_write_latency *write;
>> struct ceph_metric_metadata_latency *meta;
>> + struct ceph_metric_dlease *dlease;
>> struct ceph_client_metric *m = &mdsc->metric;
>> u64 nr_caps = atomic64_read(&m->total_caps);
>> struct ceph_msg *msg;
>> @@ -25,7 +26,7 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,
>> s32 len;
>>
>>
>>
>>
>>
>>
>>
>>
>> len = sizeof(*head) + sizeof(*cap) + sizeof(*read) + sizeof(*write)
>> - + sizeof(*meta);
>> + + sizeof(*meta) + sizeof(*dlease);
>>
>>
>>
>>
>>
>>
>>
>>
>> msg = ceph_msg_new(CEPH_MSG_CLIENT_METRICS, len, GFP_NOFS, true);
>> if (!msg) {
>> @@ -42,8 +43,8 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,
>> cap->ver = 1;
>> cap->compat = 1;
>> cap->data_len = cpu_to_le32(sizeof(*cap) - 10);
>> - cap->hit = cpu_to_le64(percpu_counter_sum(&mdsc->metric.i_caps_hit));
>> - cap->mis = cpu_to_le64(percpu_counter_sum(&mdsc->metric.i_caps_mis));
>> + 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);
>> items++;
>>
>>
>>
>>
>>
>>
>>
>>
>> @@ -83,6 +84,17 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,
>> meta->nsec = cpu_to_le32(ts.tv_nsec);
>> items++;
>>
>>
>>
>>
>>
>>
>>
>>
>> + /* 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->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 = atomic64_read(&m->total_dentries),
> dlease->total needs to be wrapped in cpu_to_le64().
Yeah, will fix it.
Thanks
BRs
>> + items++;
>> +
>> put_unaligned_le32(items, &head->num);
>> msg->front.iov_len = len;
>> msg->hdr.version = cpu_to_le16(1);
>> diff --git a/fs/ceph/metric.h b/fs/ceph/metric.h
>> index 710f3f1dceab..af6038ff39d4 100644
>> --- a/fs/ceph/metric.h
>> +++ b/fs/ceph/metric.h
>> @@ -27,6 +27,7 @@ enum ceph_metric_type {
>> CLIENT_METRIC_TYPE_READ_LATENCY, \
>> CLIENT_METRIC_TYPE_WRITE_LATENCY, \
>> CLIENT_METRIC_TYPE_METADATA_LATENCY, \
>> + CLIENT_METRIC_TYPE_DENTRY_LEASE, \
>> \
>> CLIENT_METRIC_TYPE_MAX, \
>> }
>> @@ -80,6 +81,19 @@ struct ceph_metric_metadata_latency {
>> __le32 nsec;
>> } __packed;
>>
>>
>>
>>
>> +/* metric dentry lease header */
>> +struct ceph_metric_dlease {
>> + __le32 type; /* ceph metric type */
>> +
>> + __u8 ver;
>> + __u8 compat;
>> +
>> + __le32 data_len; /* length of sizeof(hit + mis + total) */
>> + __le64 hit;
>> + __le64 mis;
>> + __le64 total;
>> +} __packed;
>> +
>> struct ceph_metric_head {
>> __le32 num; /* the number of metrics that will be sent */
>> } __packed;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-05 12:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-21 4:50 [PATCH] ceph: send dentry lease metrics to MDS daemon xiubli
2020-11-05 12:34 ` Jeff Layton
2020-11-05 12:46 ` Xiubo Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).