Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1146418pxb; Thu, 4 Mar 2021 04:41:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJyO/f1RF0Sg77Pz5Oz8Mg1J0CKk97h378xTNeYzWJBqf6xzO6qATxiXu+jgBf4JCk0w76G0 X-Received: by 2002:a05:6402:4242:: with SMTP id g2mr4022411edb.329.1614861686879; Thu, 04 Mar 2021 04:41:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614861686; cv=none; d=google.com; s=arc-20160816; b=ZAuaTf2ZKtUA1zwmHLRefpOrRkp4hmrM4QAiASd8Ldj9w5S5qRZbX4mmhcDMRTuNiV XB46TRSPyp5NO18zuJYrV9s48pXolc9TCTE8rj808GSyzY3yzHhrLXPOmaf6a2/z4aMX C9DOHSuaHEQhYgaJImevkNpFGs3q8o0N+2vJnXndKu2MsYsmA8ycpmwTit9TnB/domZJ zzJb5JyeLq74/B4V9Pkl2og+N1UaioP+VP0yqYkQhVyaIB1E4w9eptjwJmIpybNRjL6U Ivta24yleH95yhPeiBEsXCXvGvgoeIs+U6tJ7huo/KCEAUr0p+dDBgm6nOxbjeM8YKoX KfMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:to:from:date:dkim-signature; bh=4p66JKbgaafykou5y4TLlXeDyf+4dJR6mJMc9OFCAsE=; b=xGQ+IysmWUr2ZTOuUvBuzMZgQnhau7WC/ejRPihAKG40vBO4d8n+mrTJJZ25hpgRp+ rECx94mJ80lkt93PWe/9ljIK5OW9OFTxBgFNfnRXn3AVVqmtaXFYFjCy4+lyzNw1AIYz ZJEKmu6P950K5q0+SBCXPSdfcAkBraluMfagSiIC95rCX67hWkODAZpowRohtJGwN9tD KDC3iJQIKB/6bXM9dATnKeRCaVS3yysGQ3KH2V6GHP7b5dxha962//RJYgS33F7OQM86 QjlkAL2/44mje+uI/lTIHNBwxRYDxqgqHToWEiwUdcHucaj0QHhvWMpDZTST048vi/qH Bk9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aCdQ2lhI; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id vr7si3960635ejb.392.2021.03.04.04.41.04; Thu, 04 Mar 2021 04:41:26 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=aCdQ2lhI; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231273AbhCCX7m (ORCPT + 99 others); Wed, 3 Mar 2021 18:59:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:57014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235451AbhCCThJ (ORCPT ); Wed, 3 Mar 2021 14:37:09 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D73E264EF0; Wed, 3 Mar 2021 19:28:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614799696; bh=8Ra0AMNh+KuCsZP9ZA7+W5cqVDNHMmMwTZByG6847LQ=; h=Date:From:To:Subject:References:In-Reply-To:From; b=aCdQ2lhI4R9ZSpnrwjYno/GIfUoYO1enl4eBCq7vBku02IvLiXfv9MSMJUQe5QYqP YsWHU5/eYaz8oV6qFTAu5aXuS7pqp672gmBL+LLZYSl8p54wZ5Pm/TyzGmpDZhqtuf yoGC1EXWp4h4MMrdlr0nfX8laVYhPAVOEjEt3r5XI7RfHslg2fhvOqHYn1Kf6g/1vA 6l03ZXNEfiiFUWLiuTjZ7gGlAxA7/dM/hjyd1W34bLDWcWSn4O1RYT3QUHXH+J05D6 zL/mp4zek9wWs7DF5tYAMXsoClH/ULKW0G+WsA+M8pYjJ3tnTLZYXhSQfdlx++gBl/ hq9oYfSu/m9BA== Date: Wed, 3 Mar 2021 11:28:14 -0800 From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com Subject: Re: [PATCH v2] f2fs: expose # of overprivision segments Message-ID: References: <20210302054233.3886681-1-jaegeuk@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210302054233.3886681-1-jaegeuk@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is useful when checking conditions during checkpoint=disable in Android. Signed-off-by: Jaegeuk Kim --- Documentation/ABI/testing/sysfs-fs-f2fs | 5 +++++ fs/f2fs/sysfs.c | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs index 9fa5a528cc23..4aa8f38b52d7 100644 --- a/Documentation/ABI/testing/sysfs-fs-f2fs +++ b/Documentation/ABI/testing/sysfs-fs-f2fs @@ -409,3 +409,8 @@ Description: Give a way to change checkpoint merge daemon's io priority. I/O priority "3". We can select the class between "rt" and "be", and set the I/O priority within valid range of it. "," delimiter is necessary in between I/O class and priority number. + +What: /sys/fs/f2fs//ovp_segments +Date: March 2021 +Contact: "Jaegeuk Kim" +Description: Shows the number of overprovision segments. diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index e38a7f6921dd..0c391ab2d8b7 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -91,6 +91,13 @@ static ssize_t free_segments_show(struct f2fs_attr *a, (unsigned long long)(free_segments(sbi))); } +static ssize_t ovp_segments_show(struct f2fs_attr *a, + struct f2fs_sb_info *sbi, char *buf) +{ + return sprintf(buf, "%llu\n", + (unsigned long long)(overprovision_segments(sbi))); +} + static ssize_t lifetime_write_kbytes_show(struct f2fs_attr *a, struct f2fs_sb_info *sbi, char *buf) { @@ -629,6 +636,7 @@ F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, node_io_flag, node_io_flag); F2FS_RW_ATTR(CPRC_INFO, ckpt_req_control, ckpt_thread_ioprio, ckpt_thread_ioprio); F2FS_GENERAL_RO_ATTR(dirty_segments); F2FS_GENERAL_RO_ATTR(free_segments); +F2FS_GENERAL_RO_ATTR(ovp_segments); F2FS_GENERAL_RO_ATTR(lifetime_write_kbytes); F2FS_GENERAL_RO_ATTR(features); F2FS_GENERAL_RO_ATTR(current_reserved_blocks); @@ -715,6 +723,7 @@ static struct attribute *f2fs_attrs[] = { ATTR_LIST(ckpt_thread_ioprio), ATTR_LIST(dirty_segments), ATTR_LIST(free_segments), + ATTR_LIST(ovp_segments), ATTR_LIST(unusable), ATTR_LIST(lifetime_write_kbytes), ATTR_LIST(features), -- 2.31.0.rc0.254.gbdcc3b1a9d-goog