Received: by 2002:ac8:6d01:0:b0:423:7e07:f8e4 with SMTP id o1csp6903099qtt; Mon, 18 Dec 2023 09:49:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IHM0xZe1snOTrFEbAVr4J3og26BKcmnPi2lEtn3DRdK5Ldqn3ZsWM+0hpXG7fx1SSbR7VY9 X-Received: by 2002:a17:907:7ba0:b0:a1a:c370:2218 with SMTP id ne32-20020a1709077ba000b00a1ac3702218mr6292742ejc.83.1702921796583; Mon, 18 Dec 2023 09:49:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702921796; cv=none; d=google.com; s=arc-20160816; b=Kr+8J1ltq4BEy0rOfspPYP1LQmyIGg2ZH17vKcduVSBRDd3lHPVbsePTf6DwXWsfiF KoNZjibw0zmytZO2SzYo3kyVM0NU5Gch3uBnQSrm35VgvVSXc1Hd3X+ua6lf37a6y7uL otveiRat9FbIIEoba6Yf/BZSe933Qz+mCLzt64CSs5U5KX1b5LUd52B0vwnQ2fyFZjYW d3mec+szQqZslpWwX1IiBUpEAWCOxCdS6CtNl+QvPE9QoqDHoOyG5fUCYIxAKbcOHIWJ RHpfKamgajGI9nDxqmwLvVN0hz0sWHuVmHVjstGiELrmv2Au1AHBalEz0XS73xbVptU6 xbEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=CpCOkQtAmpi+IOCCnfTfyyBC5ExF9+2rcZZYo/fY4qM=; fh=rpV7l9V6d8gVS1INhlpHfLR5CGtpTEVCX4LnAHFVi/U=; b=XcMtitL4QlZMl18aMGT3VeXlIpZ1Y9ZeWChzqrNFX2hj7hUhsL1OPZLiemy+3tWD7y udzVIoswyTChDkyFOAKLwKUTkWTLqdMCGaEsCfN+cm7OnBvq9/V+UMPWiUiMSEuVU0eb Pz/DOidG2n6Ho9+qyD4LWyPwEvLSuCFgAUDsGHk5jGLO6Zj2d8dhB35t9fC6br+u7kqa HvjKkPlW6nyG7kgVb/SGwOG8LUu4O40DutPLWd4n/AWZ8hK2IuClanFsh3lJAt1m1Xtq 6c0CeoVvmqLpqGKGK/0mo5zHkXu1suLObazXOAPBaIeN6wQ/eJWRqnnFvOG6zU3u6Q5t BBwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IEAoeHwM; spf=pass (google.com: domain of linux-kernel+bounces-4209-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4209-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id s10-20020a1709060c0a00b00a2333033df6si1847380ejf.528.2023.12.18.09.49.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 09:49:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4209-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IEAoeHwM; spf=pass (google.com: domain of linux-kernel+bounces-4209-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4209-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 423C21F28104 for ; Mon, 18 Dec 2023 17:49:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3256E5D758; Mon, 18 Dec 2023 17:45:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IEAoeHwM" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 586A271449 for ; Mon, 18 Dec 2023 17:45:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D23BC433C8; Mon, 18 Dec 2023 17:45:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702921504; bh=kDVkRZAYV2bjlg4876dXBiXZOhzsZ7DaqA1eePR2E2Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IEAoeHwMxC0sPYX6XJSjfJAfU+/8NkyaKA/DkNb41kHu+wFOQgbfGHCyQO3z+S3BE e32GnGhaMwrysGA9xBhZ+WQ3GU3ucUYtgPMFEGjWtUpIsqhHf3NI4sdXtAO0+nzgtW l4/fVdPYTK2cOpbyu3nuJTchPHB0wiiwR0QZf/hKZIJGBmIX+8e/nefLYEpvfZFSqP eV07W38K6MXjT+Dowf+NXOmFsJmkJyr4pu5J4+jTA0DMSlp+Xlo6J0SjqwjDFIDgd1 w4LiQbqpehpKFVMO2t52YuDLge3iXrA2dp74IzbUvfDv52a0QlfHoITNc4sfFIGr5j 1IovLSNIq3e9w== Date: Mon, 18 Dec 2023 09:45:03 -0800 From: Jaegeuk Kim To: Zhiguo Niu Cc: chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, niuzhiguo84@gmail.com, ke.wang@unisoc.com Subject: Re: [PATCH V3] f2fs: show more discard status by sysfs Message-ID: References: <1702897676-12851-1-git-send-email-zhiguo.niu@unisoc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1702897676-12851-1-git-send-email-zhiguo.niu@unisoc.com> On 12/18, Zhiguo Niu wrote: > The current pending_discard attr just only shows the discard_cmd_cnt > information. More discard status can be shown so that we can check > them through sysfs when needed. > > Signed-off-by: Zhiguo Niu > --- > changes of v2: Improve the patch according to Chao's suggestions. > changes of v3: Add a blank line for easy reading. > --- > --- > Documentation/ABI/testing/sysfs-fs-f2fs | 6 ++++++ > fs/f2fs/sysfs.c | 19 +++++++++++++++++++ > 2 files changed, 25 insertions(+) > > diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs > index 36c3cb5..c6970e5 100644 > --- a/Documentation/ABI/testing/sysfs-fs-f2fs > +++ b/Documentation/ABI/testing/sysfs-fs-f2fs > @@ -498,6 +498,12 @@ Description: Show status of f2fs checkpoint in real time. > CP_RESIZEFS_FLAG 0x00004000 > =============================== ============================== > > +What: /sys/fs/f2fs//stat/discard_status > +Date: November 2023 > +Contact: "Zhiguo Niu" > +Description: Show status of f2fs discard in real time, including > + "issued discard","queued discard" and "undiscard blocks". > + > What: /sys/fs/f2fs//ckpt_thread_ioprio > Date: January 2021 > Contact: "Daeho Jeong" > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c > index 417fae96..312a4dc 100644 > --- a/fs/f2fs/sysfs.c > +++ b/fs/f2fs/sysfs.c > @@ -134,6 +134,22 @@ static ssize_t cp_status_show(struct f2fs_attr *a, > return sysfs_emit(buf, "%x\n", le32_to_cpu(F2FS_CKPT(sbi)->ckpt_flags)); > } > > +static ssize_t discard_status_show(struct f2fs_attr *a, > + struct f2fs_sb_info *sbi, char *buf) > +{ > + struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; > + > + if (!dcc) > + return -EINVAL; > + > + return sysfs_emit(buf, "%llu, %llu, %u\n", > + (unsigned long long)atomic_read( > + &dcc->issued_discard), > + (unsigned long long)atomic_read( > + &dcc->queued_discard), > + dcc->undiscard_blks); We cannot do this since it needs one value per one entry. > +} > + > static ssize_t pending_discard_show(struct f2fs_attr *a, > struct f2fs_sb_info *sbi, char *buf) > { > @@ -1197,9 +1213,12 @@ static ssize_t f2fs_sb_feature_show(struct f2fs_attr *a, > > F2FS_GENERAL_RO_ATTR(sb_status); > F2FS_GENERAL_RO_ATTR(cp_status); > +F2FS_GENERAL_RO_ATTR(discard_status); > + > static struct attribute *f2fs_stat_attrs[] = { > ATTR_LIST(sb_status), > ATTR_LIST(cp_status), > + ATTR_LIST(discard_status), > NULL, > }; > ATTRIBUTE_GROUPS(f2fs_stat); > -- > 1.9.1