From: Xiubo Li via B4 Relay <devnull+xiubo.li.clyso.com@kernel.org>
To: Ilya Dryomov <idryomov@gmail.com>,
Alex Markuze <amarkuze@redhat.com>,
Viacheslav Dubeyko <slava@dubeyko.com>,
Milind Changire <mchangir@redhat.com>,
Jeff Layton <jlayton@kernel.org>
Cc: ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
Dan van der Ster <dan.vanderster@clyso.com>,
Xiubo Li <xiubo.li@clyso.com>
Subject: [PATCH 2/3] ceph: drop the unused subvolume metrics debug counters
Date: Wed, 14 Oct 2026 01:20:41 +0200 [thread overview]
Message-ID: <20261014-ceph-metrics-percpu-v1-2-38c5a24fec6e@clyso.com> (raw)
In-Reply-To: <20261014-ceph-metrics-percpu-v1-0-38c5a24fec6e@clyso.com>
From: Xiubo Li <xiubo.li@clyso.com>
ceph_subvolume_metrics_record_io() bumps tracker->record_calls on
every OSD read and write completion, plus record_disabled or
record_no_subvol when it bails out, and ceph_subvolume_metrics_record()
adds to the total_read/write_ops/bytes counters on top of its own
per-subvolume ones. All of them are atomic64_t shared by every CPU
of the mount, so even with subvolume metrics disabled each I/O
completion dirties a cache line that every other completion on the
client also writes.
Nothing ever reads these counters, nor the snapshot_* ones: debugfs
prints the per-subvolume entries and the totals kept under
subvol_metrics_last_mutex. Remove them.
Fixes: b1137e0b3d4b ("ceph: add subvolume metrics collection and reporting")
Reported-by: Dan van der Ster <dan.vanderster@clyso.com>
Signed-off-by: Xiubo Li <xiubo.li@clyso.com>
---
fs/ceph/subvolume_metrics.c | 34 ++++------------------------------
fs/ceph/subvolume_metrics.h | 21 ---------------------
2 files changed, 4 insertions(+), 51 deletions(-)
diff --git a/fs/ceph/subvolume_metrics.c b/fs/ceph/subvolume_metrics.c
index 03fda1f9257b..895878a49ea7 100644
--- a/fs/ceph/subvolume_metrics.c
+++ b/fs/ceph/subvolume_metrics.c
@@ -39,16 +39,6 @@ void ceph_subvolume_metrics_init(struct ceph_subvolume_metrics_tracker *tracker)
tracker->tree = RB_ROOT_CACHED;
tracker->nr_entries = 0;
tracker->enabled = false;
- atomic64_set(&tracker->snapshot_attempts, 0);
- atomic64_set(&tracker->snapshot_empty, 0);
- atomic64_set(&tracker->snapshot_failures, 0);
- atomic64_set(&tracker->record_calls, 0);
- atomic64_set(&tracker->record_disabled, 0);
- atomic64_set(&tracker->record_no_subvol, 0);
- atomic64_set(&tracker->total_read_ops, 0);
- atomic64_set(&tracker->total_read_bytes, 0);
- atomic64_set(&tracker->total_write_ops, 0);
- atomic64_set(&tracker->total_write_bytes, 0);
}
static struct ceph_subvol_metric_rb_entry *
@@ -196,14 +186,10 @@ void ceph_subvolume_metrics_record(struct ceph_subvolume_metrics_tracker *tracke
entry->write_ops++;
entry->write_bytes += size;
entry->write_latency_us += latency_us;
- atomic64_inc(&tracker->total_write_ops);
- atomic64_add(size, &tracker->total_write_bytes);
} else {
entry->read_ops++;
entry->read_bytes += size;
entry->read_latency_us += latency_us;
- atomic64_inc(&tracker->total_read_ops);
- atomic64_add(size, &tracker->total_read_bytes);
}
spin_unlock(&tracker->lock);
if (new_entry)
@@ -227,8 +213,6 @@ int ceph_subvolume_metrics_snapshot(struct ceph_subvolume_metrics_tracker *track
if (!READ_ONCE(tracker->enabled))
return 0;
- atomic64_inc(&tracker->snapshot_attempts);
-
spin_lock(&tracker->lock);
for (node = rb_first_cached(&tracker->tree); node; node = rb_next(node)) {
struct ceph_subvol_metric_rb_entry *entry =
@@ -240,16 +224,12 @@ int ceph_subvolume_metrics_snapshot(struct ceph_subvolume_metrics_tracker *track
}
spin_unlock(&tracker->lock);
- if (!count) {
- atomic64_inc(&tracker->snapshot_empty);
+ if (!count)
return 0;
- }
snap = kcalloc(count, sizeof(*snap), GFP_NOFS);
- if (!snap) {
- atomic64_inc(&tracker->snapshot_failures);
+ if (!snap)
return -ENOMEM;
- }
spin_lock(&tracker->lock);
node = rb_first_cached(&tracker->tree);
@@ -380,18 +360,12 @@ void ceph_subvolume_metrics_record_io(struct ceph_mds_client *mdsc,
return;
tracker = &mdsc->subvol_metrics;
- atomic64_inc(&tracker->record_calls);
-
- if (!ceph_subvolume_metrics_enabled(tracker)) {
- atomic64_inc(&tracker->record_disabled);
+ if (!ceph_subvolume_metrics_enabled(tracker))
return;
- }
subvol_id = READ_ONCE(ci->i_subvolume_id);
- if (subvol_id == CEPH_SUBVOLUME_ID_NONE) {
- atomic64_inc(&tracker->record_no_subvol);
+ if (subvol_id == CEPH_SUBVOLUME_ID_NONE)
return;
- }
delta_us = ktime_to_us(ktime_sub(end, start));
if (delta_us <= 0)
diff --git a/fs/ceph/subvolume_metrics.h b/fs/ceph/subvolume_metrics.h
index 6f53ff726c75..8b901ae05e00 100644
--- a/fs/ceph/subvolume_metrics.h
+++ b/fs/ceph/subvolume_metrics.h
@@ -6,7 +6,6 @@
#include <linux/rbtree.h>
#include <linux/spinlock.h>
#include <linux/ktime.h>
-#include <linux/atomic.h>
struct seq_file;
struct ceph_mds_client;
@@ -38,32 +37,12 @@ struct ceph_subvol_metric_snapshot {
* @tree: Red-black tree of per-subvolume entries, keyed by subvolume_id
* @nr_entries: Number of entries currently in @tree
* @enabled: Whether collection is enabled (requires MDS feature support)
- * @snapshot_attempts: Debug counter: total ceph_subvolume_metrics_snapshot() calls
- * @snapshot_empty: Debug counter: snapshots that found no data to report
- * @snapshot_failures: Debug counter: snapshots that failed to allocate memory
- * @record_calls: Debug counter: total ceph_subvolume_metrics_record() calls
- * @record_disabled: Debug counter: record calls skipped because disabled
- * @record_no_subvol: Debug counter: record calls skipped (no subvolume_id)
- * @total_read_ops: Cumulative read ops across all snapshots (never reset)
- * @total_read_bytes: Cumulative bytes read across all snapshots (never reset)
- * @total_write_ops: Cumulative write ops across all snapshots (never reset)
- * @total_write_bytes: Cumulative bytes written across all snapshots (never reset)
*/
struct ceph_subvolume_metrics_tracker {
spinlock_t lock;
struct rb_root_cached tree;
u32 nr_entries;
bool enabled;
- atomic64_t snapshot_attempts;
- atomic64_t snapshot_empty;
- atomic64_t snapshot_failures;
- atomic64_t record_calls;
- atomic64_t record_disabled;
- atomic64_t record_no_subvol;
- atomic64_t total_read_ops;
- atomic64_t total_read_bytes;
- atomic64_t total_write_ops;
- atomic64_t total_write_bytes;
};
void ceph_subvolume_metrics_init(struct ceph_subvolume_metrics_tracker *tracker);
--
2.53.0
next prev parent reply other threads:[~2026-10-13 23:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 23:20 [PATCH 0/3] ceph: fix the buffered read size metric and make the subvolume metrics per CPU Xiubo Li via B4 Relay
2026-10-13 23:20 ` [PATCH 1/3] ceph: report the requested length in the netfs read metrics Xiubo Li via B4 Relay
2026-10-13 23:20 ` Xiubo Li via B4 Relay [this message]
2026-10-13 23:20 ` [PATCH 3/3] ceph: accumulate subvolume metrics per CPU Xiubo Li via B4 Relay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261014-ceph-metrics-percpu-v1-2-38c5a24fec6e@clyso.com \
--to=devnull+xiubo.li.clyso.com@kernel.org \
--cc=amarkuze@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=dan.vanderster@clyso.com \
--cc=idryomov@gmail.com \
--cc=jlayton@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchangir@redhat.com \
--cc=slava@dubeyko.com \
--cc=xiubo.li@clyso.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®