From patchwork Sat Mar 5 16:04:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 12770423 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35EA4C433F5 for ; Sat, 5 Mar 2022 16:05:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232021AbiCEQFv (ORCPT ); Sat, 5 Mar 2022 11:05:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232001AbiCEQFp (ORCPT ); Sat, 5 Mar 2022 11:05:45 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 449B5652CE; Sat, 5 Mar 2022 08:04:51 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id c192so6671449wma.4; Sat, 05 Mar 2022 08:04:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Gl15jVHDWqQUQcpXGK7b6MQUnuZpOd6NqFaENFI8dkU=; b=NGT+lmyuM3B8f/o23zzVpt18DkPE+YnPfDiBMv0xJX9yW28ILYB7HoN3niGKsRrvtS rupYn6Qa+RnL7rgz2qSaAxxtyM/q4y7G5zU7W1ZDiJZdqFXr54CM9uU+/+mxRBerPxlk xSswoIRT97p5+jZyf948JagexhFdnii1VDJbO34oZtjH/YdCHfKvXPkEhsZvDdotNrk+ dk1rLZ+nX/FQuYcTGoTKf3a7nxvbpw35Qha8JdG1GYShBxuTjWf28qquWeqOGObwhgg8 VyxX5WSviA6cXM+FBF7ehUyeA8kEPN3bmZemQdxr7KAo9/ns2V7mNUKxZNffLskd072V PoiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Gl15jVHDWqQUQcpXGK7b6MQUnuZpOd6NqFaENFI8dkU=; b=ojKPGUVC7SB+yrQT6DXM1/W3FwowjuaCA2/7MfVdwH6s1CmGutfwwdARC3L/pWQPhC oP34hLBWroUEZ5CpG1QESiM4bvbyLLR2ZTYYFR36w7whGkqdmgxAg57+lM/OiByCNoBr oMI+nKDJqgL6Vi4e80ErJSTvSH2/KyF7pB2fFnLf9VcaOBPTbuHno2M7Jd2zTc3QSh0s 7uC4Gb5UNahGIg739KaxkUPy1rYxkfhr9kH02DhdFTYPr/HVmke50HFnBIpK5WIRD87T D6fWAdZ/74MPBCWdyFF8v19msBVL2UNcfeq/KWPQTO6IY09aAkqSeBtHF0/G+jW7qDXf PGyA== X-Gm-Message-State: AOAM531dnebIgNNyfbI1kJVoqe01ulera7dFj1LpOf4e/E7cYFg7O8Gk xIZ0bMhzgf3LhTfIpvudM+FrRF7ftOM= X-Google-Smtp-Source: ABdhPJwzSqC7SMuIZY0VYJ23xyzOpk5c2DMYmZ19g11IitMRBy+GdmJLnfLURcnoJt4dkB+T8rvYfA== X-Received: by 2002:a05:600c:3d99:b0:381:546c:8195 with SMTP id bi25-20020a05600c3d9900b00381546c8195mr12006349wmb.112.1646496289826; Sat, 05 Mar 2022 08:04:49 -0800 (PST) Received: from localhost.localdomain ([77.137.71.203]) by smtp.gmail.com with ESMTPSA id n5-20020a5d5985000000b001f0122f63e1sm1650717wri.85.2022.03.05.08.04.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Mar 2022 08:04:49 -0800 (PST) From: Amir Goldstein To: Miklos Szeredi Cc: Dave Chinner , Al Viro , linux-unionfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v4 6/9] fs: report per-sb io stats Date: Sat, 5 Mar 2022 18:04:21 +0200 Message-Id: <20220305160424.1040102-7-amir73il@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220305160424.1040102-1-amir73il@gmail.com> References: <20220305160424.1040102-1-amir73il@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Show optional collected per-sb io stats in /proc//mountstats for filesystems that do not implement their own show_stats() method and have generic per-sb stats enabled. Signed-off-by: Amir Goldstein --- fs/proc_namespace.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c index 49650e54d2f8..9054a909e031 100644 --- a/fs/proc_namespace.c +++ b/fs/proc_namespace.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include "proc/internal.h" /* only for get_proc_task() in ->open() */ @@ -232,6 +233,21 @@ static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt) if (sb->s_op->show_stats) { seq_putc(m, ' '); err = sb->s_op->show_stats(m, mnt_path.dentry); + } else if (sb_has_iostats(sb)) { + struct sb_iostats *iostats = sb_iostats(sb); + + /* Similar to /proc//io */ + seq_printf(m, "\n" + "\ttimes: %lld %lld\n" + "\trchar: %lld\n" + "\twchar: %lld\n" + "\tsyscr: %lld\n" + "\tsyscw: %lld\n", + iostats->start_time, ktime_get_seconds(), + sb_iostats_counter_read(sb, SB_IOSTATS_CHARS_RD), + sb_iostats_counter_read(sb, SB_IOSTATS_CHARS_WR), + sb_iostats_counter_read(sb, SB_IOSTATS_SYSCALLS_RD), + sb_iostats_counter_read(sb, SB_IOSTATS_SYSCALLS_WR)); } seq_putc(m, '\n');