Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp938544pxb; Wed, 3 Mar 2021 21:48:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzmAsmcOSXYyHKwEGwEUXp7SYvJQH8Ju/RBvSBA3I4TNKi8TiqyE501mtwD8ICafl4Q6qgc X-Received: by 2002:a05:6402:50ce:: with SMTP id h14mr2243465edb.279.1614836904645; Wed, 03 Mar 2021 21:48:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614836904; cv=none; d=google.com; s=arc-20160816; b=Ih4Jwr6wFLugwftSHpn04DQUhFQVFahsQFBtm9BdTEUK4tQyQDTw4rrbTtu23mTDTi sgzlSM0yW6c/eUIZwq5P6voqcjgUGHiS8LsgdwSJrRW5aVNqPIVhQ5Hwj255hbDF5mud OD+3AZU9uVyc/HVETI9e15mKJYJbHeG8XNeXM6kG611nJS+3XgJxq5/acB4cu6TluVJ6 9xkElH1qxAmqt0Wa1cXbNzpln5w8xnN6IHvqxtYzN23nLKPgGG4zbFmMl3VVRs2+xdrf HtI90jToh/hqu9NIDlsKXgTrnjCznzUkpMIRm/HjUhDyVS19D/XnkblLVxRdO/o9fkWP qHpw== 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; bh=pN0up/W3CpIAzHX9DnqKbEWmzUfhSNK6BYFqbg37hsQ=; b=JRifYla+FXtbu8kwbvzmia+IkaoLyd8axwYFED6VGEpTTl3q1ChQsaORURP9WknVF/ /sw6CQDu7KKUt18Q3z90H7WsEHVKxTVW3iN/et9qjjYHxCGJcy885nlXIgCL6gORvudV PrnLj1WIpQK7RybvhYpt9tPpmAJj4sGM3THszQEeWWe2FgMfkP0YzCzRyYGWyIdIFJFo 18tHsoPe7NwdRxeEcLHd4DGp5At5A2tOZG+3qYxldvsv5QZPY5PuC0KSRf5RLLiF8guD K2PSAnGWo7NjZvDHTwK8hkhphcsb7JFN6vDQ5USwiisj8wEwFT3sxiJpOktFgVE3GmIH Lh9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Vl/PqZSu"; 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 i13si8378613ejy.93.2021.03.03.21.48.02; Wed, 03 Mar 2021 21:48:24 -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="Vl/PqZSu"; 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 S1836263AbhCBG7v (ORCPT + 99 others); Tue, 2 Mar 2021 01:59:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:33926 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1577107AbhCBFnS (ORCPT ); Tue, 2 Mar 2021 00:43:18 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D0A886146B; Tue, 2 Mar 2021 05:42:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614663755; bh=L/xAWAJDwAT+puMjWqJVBI895stEzEJP7zB19lOugg8=; h=From:To:Cc:Subject:Date:From; b=Vl/PqZSu+l9Incm849CFvZbxe0KngocrQNhV44bnpS/hW7HwmyMw1TScNTNjW/wOJ GGS4KBwj3Fq4ap8JhEVfVVGe6t8TAIIejbmtRXV9/8aRl9BPHuaiVu1puwwBic/Zmk 9D5uGh/775rbSjetWtieVwrqCphQ1pb0V7xtIDhAFM4scS4+RZYXr0TAmNEIpNJjRk zOzceXGPY+WJjCQG544WZKnq/8TVDASBB5c3Pcta81OtQzB+/dPYyeyUpa9FOkTeRT vTrdBs0tVRT3RLqudoO15zioQXeoOcWLTEYFnrh7tsfM/TV58FAiIdfPaTKfw8ROAb 6UMJpstpWpayQ== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com Cc: Jaegeuk Kim Subject: [PATCH] f2fs: expose # of overprivision segments Date: Mon, 1 Mar 2021 21:42:33 -0800 Message-Id: <20210302054233.3886681-1-jaegeuk@kernel.org> X-Mailer: git-send-email 2.30.1.766.gb4fecdf3b7-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- fs/f2fs/sysfs.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index e38a7f6921dd..254b6fa17406 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); -- 2.30.1.766.gb4fecdf3b7-goog