Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp275425pxb; Mon, 25 Oct 2021 08:06:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8N2YHDVTOQwr7bEnCv+apXu4XPvwQGQ4lNgKLvAKunphh9efpJILcQU99o3E3KC600GFO X-Received: by 2002:a17:906:80cd:: with SMTP id a13mr10187245ejx.405.1635174397611; Mon, 25 Oct 2021 08:06:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635174397; cv=none; d=google.com; s=arc-20160816; b=pf+13kBfzDRt3DlouW73FJvsUo74jbWL4bzR1oilAKHXPEyoaDZJgbW3J9C/qvyMH0 TEpFu3CgP30BzYRDav+Xibe8PrYsXOhbqeIcfYsUiwi1AKEt439hayo6Lg8NKJRNvJ2Q DFyOesyNnI46ZMDGqBTAUTYuVnkogJmW42MZTgKY4xeNOJLb9Mb2LorvdfNXF8m9B247 mEII4ttFPPz5/wF47Urc5AaGFtn4kDDt71W5QxUkKdx7vY9+FTwUOsXopwur2BQDxZW8 zomB8NXorkdY6T+F/4p6zsIYW2o/iA/pRDJqis30sGVHX2YAJ7MukWuE/O0PCINxgMLF xLxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=Em7EGGqG6o35wKmiax01QEikuwAkO36IkSznNVbOrlc=; b=Cqq7UBkeOkczsbtc4eaxeATmjIXj2cBiMtf1sbUKNUWADN11X76h5s710/OehrfPa/ 5SpyewRmZX8qrtEyBR7lExPwxedg2pzp04zWJr0UnYxv3ImIQQCEsuzCHkzgRoJXRnwa MGcGYMsD5nGhFEUQySzcxcgY0casG1IajphvOkXLp4zSzNN6VtMUndOVI39R477n0Ce/ g/WR5RMANdUdv9cfUEcgYoRMS3liz8ZR9EqlchnaOl6GmX0nF10XqR1EU/HCKSP3Hjm/ WvXMcVc/Nd/t5yGU60PcnCzfO82OlG1eHdyDyaJ5VjLKlMhXfk0rq7bSbVQj5tH8/50l MfNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=jIahhHxF; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r2si23316048eja.442.2021.10.25.08.06.13; Mon, 25 Oct 2021 08:06:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=jIahhHxF; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233775AbhJYPDU (ORCPT + 99 others); Mon, 25 Oct 2021 11:03:20 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:44100 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233726AbhJYPDJ (ORCPT ); Mon, 25 Oct 2021 11:03:09 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 4B1B61FD3A; Mon, 25 Oct 2021 15:00:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1635174046; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Em7EGGqG6o35wKmiax01QEikuwAkO36IkSznNVbOrlc=; b=jIahhHxFdvhSnQYxu0IBU28NRIRCzOOJrmFrset/zDMiZ7xfEq1BN9mZzJHvCKOHHJfCCX S8085s18u/fWaQ/C9Djhh9Ak8fX8tL/KcURPxIKTnUGLt9n8GwtYDciaZma8CYY5sviWFb i5x8fpIWp0c40NjlZRLsHpgUm7POKHg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1635174046; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Em7EGGqG6o35wKmiax01QEikuwAkO36IkSznNVbOrlc=; b=EzpQlzC437+htL/7LNxRfvm4yG04LClGFMDBNi0+MIMs/PBqGghZtfRguuxQfp/nBUh4q9 rewS9GLRZ/qQPWCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 94A9513C0B; Mon, 25 Oct 2021 15:00:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id cCmUIZ3GdmHSDQAAMHmgww (envelope-from ); Mon, 25 Oct 2021 15:00:45 +0000 Received: from localhost (brahms [local]) by brahms (OpenSMTPD) with ESMTPA id 03806f0b; Mon, 25 Oct 2021 15:00:44 +0000 (UTC) From: =?UTF-8?q?Lu=C3=ADs=20Henriques?= To: Jeff Layton , Ilya Dryomov Cc: ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Lu=C3=ADs=20Henriques?= , Patrick Donnelly Subject: [RFC PATCH v2] ceph: add remote object copy counter to fs client metrics Date: Mon, 25 Oct 2021 16:00:42 +0100 Message-Id: <20211025150042.1677-1-lhenriques@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Cc: Patrick Donnelly Signed-off-by: Luís Henriques --- 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í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(+) diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c index 38b78b45811f..9f1a09816541 100644 --- a/fs/ceph/debugfs.c +++ b/fs/ceph/debugfs.c @@ -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; } diff --git a/fs/ceph/file.c b/fs/ceph/file.c index e61018d9764e..b36a7b9c1ab8 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -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; diff --git a/fs/ceph/metric.c b/fs/ceph/metric.c index 04d5df29bbbf..a8a9f96c56a8 100644 --- a/fs/ceph/metric.c +++ b/fs/ceph/metric.c @@ -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); diff --git a/fs/ceph/metric.h b/fs/ceph/metric.h index 0133955a3c6a..a1e2cd46de6b 100644 --- a/fs/ceph/metric.h +++ b/fs/ceph/metric.h @@ -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 */ };