ceph: add remote object copy counter to fs client metrics
RFC PATCH v2 1/1 ceph: add remote object copy counter to fs client metrics
This counter will keep track of the number of remote object copies done on copy_file_range syscalls. This counter will be kept using the metrics infrastructure and thus accessible through debugfs. For now, this counter won't be sent to the MDS.
---
Hi!
So, here's v2 of this RFC. Now, I guess that Patrick's idea of adding this counter was to validate the test results, isn't that right? If so, this has to be done from within the fstest code and not from teuthology test. The reason is that fstests mount and unmount the filesystems under test, which effectively wipe the metrics on the client.
So, the follow-up to this patch would be changes to the corresponding fstests so that they would access this debugfs file and check the counter is set to the expected value.
Cheers,
Signature · 7 lines
Luís fs/ceph/debugfs.c | 6 ++++++ fs/ceph/file.c | 1 + fs/ceph/metric.c | 2 ++ fs/ceph/metric.h | 2 ++ 4 files changed, 11 insertions(+)
fs/ceph/debugfs.c +6 -0
@@ -235,6 +235,12 @@ static int metric_show(struct seq_file *s, void *p)percpu_counter_sum (&m->i_caps_mis), percpu_counter_sum(&m->i_caps_hit)); +seq_printf (s,"\n" ); +seq_printf (s,"item total\n" ); +seq_printf (s,"-------------------\n" ); +seq_printf (s,"%-14s%-16lld\n" ,"copy-from" , +atomic64_read (&m->total_copyfrom)); +return 0 ; }
fs/ceph/file.c +1 -0
@@ -2253,6 +2253,7 @@ static ssize_t ceph_do_objects_copy(struct ceph_inode_info *src_ci, u64 *src_off bytes = ret; goto out; } +atomic64_inc (&fsc->mdsc->metric.total_copyfrom); len -= object_size; bytes += object_size; *src_off += object_size;
fs/ceph/metric.c +2 -0
@@ -278,6 +278,8 @@ int ceph_metric_init(struct ceph_client_metric *m)if (ret) goto err_total_inodes; +atomic64_set (&m->total_copyfrom,0 ); + m->session =NULL ;INIT_DELAYED_WORK (&m->delayed_work, metric_delayed_work);
fs/ceph/metric.h +2 -0
@@ -169,6 +169,8 @@ struct ceph_client_metric {struct percpu_counter opened_inodes;struct percpu_counter total_inodes; +atomic64_t total_copyfrom; +struct ceph_mds_session *session;struct delayed_work delayed_work;/* delayed work */ };
Quoted 82 lines · Luís Henriques
This counter will keep track of the number of remote object copies done on
copy_file_rangesyscalls. This counter will be kept using the metrics infrastructure and thus accessible through debugfs. For now, this counter won't be sent to the MDS.Cc Patrick Donnelly <[email protected]>Signed-off-by Luís Henriques <[email protected]>---
Hi!So, here's v2 of this RFC. Now, I guess that Patrick's idea of adding this counter was to validate the test results, isn't that right? If so, this has to be done from within the fstest code and not from teuthology test. The reason is that fstests mount and unmount the filesystems under test, which effectively wipe the metrics on the client.
So, the follow-up to this patch would be changes to the corresponding fstests so that they would access this debugfs file and check the counter is set to the expected value.
Cheers,
--
Luísfs/ceph/debugfs.c | 6 ++++++
fs/ceph/file.c | 1 +
fs/ceph/metric.c | 2 ++
fs/ceph/metric.h | 2 ++4 files changed, 11 insertions(+)fs/ceph/debugfs.c +0
-0@@ -235,6 +235,12 @@ static int metric_show(struct seq_file *s, void *p) percpu_counter_sum(&m->i_caps_mis), percpu_counter_sum(&m->i_caps_hit));fs/ceph/debugfs.c +6
-0+seq_printf (s,"\n" ); +seq_printf (s,"item total\n" ); +seq_printf (s,"-------------------\n" ); +seq_printf (s,"%-14s%-16lld\n" ,"copy-from" , + atomic64_read(&m->total_copyfrom)); +return 0;
}fs/ceph/file.c +1
-0@@ -2253,6 +2253,7 @@ static ssize_t ceph_do_objects_copy(struct ceph_inode_info *src_ci, u64 *src_off bytes = ret; goto out; } +atomic64_inc (&fsc->mdsc->metric.total_copyfrom); len -= object_size; bytes += object_size; *src_off += object_size;fs/ceph/metric.c +0
-0@@ -278,6 +278,8 @@ int ceph_metric_init(struct ceph_client_metric *m) if (ret) goto err_total_inodes;fs/ceph/metric.c +2
-0+atomic64_set (&m->total_copyfrom,0 ); +
m->session= NULL;INIT_DELAYED_WORK(&m->delayed_work, metric_delayed_work);fs/ceph/metric.h +0
-0@@ -169,6 +169,8 @@ struct ceph_client_metric { struct percpu_counter opened_inodes; struct percpu_counter total_inodes;fs/ceph/metric.h +2
-0+atomic64_t total_copyfrom; +
Quoted 3 lines
struct
ceph_mds_session*session;
structdelayed_workdelayed_work; /* delayed work */ };
I know the main interest currently is just the count of ops, but I do think that we'll want a full set of stats like we track for reads/writes, and I'd rather not rev the file format any more than we need to.
Could you extend struct ceph_client_metric with a full set of copy stats and plumb in the places to record and report them? It should be pretty similar to how reads/writes are tracked.
Signature · 1 line
Jeff Layton <[email protected]>