From patchwork Fri Feb 23 20:55:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 13569987 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 23B55C54E4F for ; Fri, 23 Feb 2024 20:55:52 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1rdcaF-0005c8-7p; Fri, 23 Feb 2024 20:55:51 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rdcaD-0005bt-Qs for linux-f2fs-devel@lists.sourceforge.net; Fri, 23 Feb 2024 20:55:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=VEWOc3/qVc2KPcpTDw+ll2WDFuxPJYoyTKvqkHF9X/Q=; b=c4Jbq3G/18LyTNLEMvDckGCo0y xaMTrW28wOkrlMMFbn1YGg8HHYMdXVpR6GiJBTABAnncrv1UrxbWEtUeujtGUc57WvqPQFmA2hAKG nNMqPoFKabUnHHtqw4OqVteYJSeCJmn6tXHJXDAikiCBqsn+pfEs987/Qfe+hHPQuEIA=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=VEWOc3/qVc2KPcpTDw+ll2WDFuxPJYoyTKvqkHF9X/Q=; b=G A8NfJfRkbMljDzL4faDP/6nEzM3PYGc8NIJIX1gKoHE5+4kuFM1GvoUUV2VW5ZShTq29cNPxNHKMq ozh1mkEAamKPaoApPwsK4MbtM7McboUL8lBrUeBxwb2mNZUxayaWlwgusjFe/9aTIaVDEgl4kWLVj 3ffkyYNnKwoBIOkM=; Received: from dfw.source.kernel.org ([139.178.84.217]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1rdcaD-0002pP-0p for linux-f2fs-devel@lists.sourceforge.net; Fri, 23 Feb 2024 20:55:49 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 6FF336178E for ; Fri, 23 Feb 2024 20:55:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F407EC433F1; Fri, 23 Feb 2024 20:55:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708721737; bh=wi3u34VTGkwAs5nfIRnTyLTx4oN1qD3NGEQPACYbTI8=; h=From:To:Cc:Subject:Date:From; b=aU2nOLhPL/RgRvW9sZrWBoEMGkQMKGW41pCk2KlqkmzUhp/hX99bvOtMW1LhYDrRd UpXbRlEDrnjPSA3Z0KBG+IoFaWzSBmJB5x+OAf7GWurnmoXDD9q/kagKm6IOFreHzz zivFOs6zRM2qczbiEPefUbwQ7scYiP/8CYr1mRvTg+F+cnhc74lt0vVXBOuKVVfEr8 VBkam+Zf9kUUPIV/XoXtvKMjO6CFCv7tkPcou25L5en85RW/vXwcC0McK1fxlaluYF R0/oJ/6kTuYdO9+fGO9js6zx5uU1LlNkAeML4+TgHU7wP4amKPogX86X9vGjFsbnL2 136s3D2xeMrbg== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Date: Fri, 23 Feb 2024 12:55:31 -0800 Message-ID: <20240223205535.307307-1-jaegeuk@kernel.org> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog MIME-Version: 1.0 X-Headers-End: 1rdcaD-0002pP-0p Subject: [f2fs-dev] [PATCH 1/5] f2fs: check number of blocks in a current section X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jaegeuk Kim Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net In cfd66bb715fd ("f2fs: fix deadloop in foreground GC"), we needed to check the number of blocks in a section instead of the segment. In addtion, let's check the entire node sections when checking the avaiable node block space. It does not match one to one per temperature, but currently we don't have exact dirty page count per temperature. Hence, use a rough estimation. Fixes: cfd66bb715fd ("f2fs: fix deadloop in foreground GC") Signed-off-by: Jaegeuk Kim Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu --- fs/f2fs/segment.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 3edd3809b6b5..15bf5edd9b3c 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -561,23 +561,23 @@ static inline bool has_curseg_enough_space(struct f2fs_sb_info *sbi, unsigned int node_blocks, unsigned int dent_blocks) { - unsigned int segno, left_blocks; + unsigned segno, left_blocks; int i; - /* check current node segment */ + /* check current node sections, which counts very roughly */ + left_blocks = 0; for (i = CURSEG_HOT_NODE; i <= CURSEG_COLD_NODE; i++) { segno = CURSEG_I(sbi, i)->segno; - left_blocks = f2fs_usable_blks_in_seg(sbi, segno) - - get_seg_entry(sbi, segno)->ckpt_valid_blocks; - - if (node_blocks > left_blocks) - return false; + left_blocks += CAP_BLKS_PER_SEC(sbi) - + get_ckpt_valid_blocks(sbi, segno, true); } + if (node_blocks > left_blocks) + return false; - /* check current data segment */ + /* check current data section for dentry blocks. */ segno = CURSEG_I(sbi, CURSEG_HOT_DATA)->segno; - left_blocks = f2fs_usable_blks_in_seg(sbi, segno) - - get_seg_entry(sbi, segno)->ckpt_valid_blocks; + left_blocks = CAP_BLKS_PER_SEC(sbi) - + get_ckpt_valid_blocks(sbi, segno, true); if (dent_blocks > left_blocks) return false; return true; @@ -626,7 +626,7 @@ static inline bool has_not_enough_free_secs(struct f2fs_sb_info *sbi, if (free_secs > upper_secs) return false; - else if (free_secs <= lower_secs) + if (free_secs <= lower_secs) return true; return !curseg_space; } From patchwork Fri Feb 23 20:55:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 13569986 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 40238C5478C for ; Fri, 23 Feb 2024 20:55:52 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1rdcaE-0002Wv-T8; Fri, 23 Feb 2024 20:55:51 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rdcaD-0002Wp-C0 for linux-f2fs-devel@lists.sourceforge.net; Fri, 23 Feb 2024 20:55:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=d6MvAWa8krcr3w/taXqtwCdQET9wq8pEdAb3QBFq3EE=; b=ZkmzQSc4D0u6JlV+rgjPHhvw7y gDGDVIyvs9hLntV8624Frkx0d+swY3wY9ypui1lNgORL48XVAs+/Dy6aZyU+UFh05Jaz5BxXFNcfh Mr2pZzY47XyIFRCiJ5OrEPwr3ImjXwM+eL3A2gLN+G6FWwsraIKF3hIvwN3ZRJlt4i9E=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=d6MvAWa8krcr3w/taXqtwCdQET9wq8pEdAb3QBFq3EE=; b=by1vXPpKUUhMGAQI1h3jTqY+vM 41bw2sRYaAJrsDgALoK09JvS6EX/RU/zuqA4o0E/XDwcmWfqo+NcoZnQtsWVhSZjsvWxvbrgrIOIk TDFwOdiRe827nyIV7ggqMcZC6jFbttTjKLvd0P74guLi5/CycZkgtbgKOcQ3P99U1xzQ=; Received: from dfw.source.kernel.org ([139.178.84.217]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1rdcaD-0002pQ-0x for linux-f2fs-devel@lists.sourceforge.net; Fri, 23 Feb 2024 20:55:49 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 3027E6179A for ; Fri, 23 Feb 2024 20:55:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8180C433C7; Fri, 23 Feb 2024 20:55:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708721737; bh=1gKonBQkHb/HxNH0cWOVYXamRfmS4ibjq2hXF1LjSXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JDztIDUMIf1uQI3wEPns47jCdJLcgDmWlGKrDDrzZPfvjYREA206ffnpHXWjr8NoN 1E1L3M677M9HaICSVu7GqwVPSS0gBAJkgule8HcadYMs8pialTn+Oo59lqQIw+vNwt jlouFmp59ZghxaJN2TnlEmF9erPZoJdfJL1XuhrJta4b4DScZ/tzkwLJpZkDE6I535 CD13j4vOBtp9MiZRkcEfbc55lmB4jw/WP7M+TGrHxTipMhogw6jCdTPeHtSXsj5Px7 EFFF6vjgT6aRfcTQ6HtUXZSNtISV958zN2YFFGwIb9ps1emAkvT8ilyeI18ouCpGSW RDSSuPrZGO9AQ== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Date: Fri, 23 Feb 2024 12:55:32 -0800 Message-ID: <20240223205535.307307-2-jaegeuk@kernel.org> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog In-Reply-To: <20240223205535.307307-1-jaegeuk@kernel.org> References: <20240223205535.307307-1-jaegeuk@kernel.org> MIME-Version: 1.0 X-Headers-End: 1rdcaD-0002pQ-0x Subject: [f2fs-dev] [PATCH 2/5] f2fs: fix write pointers all the time X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jaegeuk Kim Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Even if the roll forward recovery stopped due to any error, we have to fix the write pointers in order to mount the disk from the previous checkpoint. Signed-off-by: Jaegeuk Kim Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu --- fs/f2fs/recovery.c | 2 +- fs/f2fs/super.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c index b3baec666afe..8bbecb5f9323 100644 --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c @@ -913,7 +913,7 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only) * and the f2fs is not read only, check and fix zoned block devices' * write pointer consistency. */ - if (!err && fix_curseg_write_pointer && !f2fs_readonly(sbi->sb) && + if (fix_curseg_write_pointer && !f2fs_readonly(sbi->sb) && f2fs_sb_has_blkzoned(sbi)) { err = f2fs_fix_curseg_write_pointer(sbi); if (!err) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 2e41142d07c0..4d03ce1109ad 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -4673,7 +4673,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) * If the f2fs is not readonly and fsync data recovery succeeds, * check zoned block devices' write pointer consistency. */ - if (!err && !f2fs_readonly(sb) && f2fs_sb_has_blkzoned(sbi)) { + if (!f2fs_readonly(sb) && f2fs_sb_has_blkzoned(sbi)) { err = f2fs_check_write_pointer(sbi); if (err) goto free_meta; From patchwork Fri Feb 23 20:55:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 13569985 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 41D56C54798 for ; Fri, 23 Feb 2024 20:55:50 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1rdcaC-0000i0-JQ; Fri, 23 Feb 2024 20:55:49 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rdcaA-0000hr-Kp for linux-f2fs-devel@lists.sourceforge.net; Fri, 23 Feb 2024 20:55:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=D7XUHBVG5VP8tTRX82JAqat+7CnBaGyL6YGkNS+felE=; b=NXKOaMFj7E1iJ5lYE+HM4dAhNv 2QopfF4xUWkbLDJewUy4vVPM/rEh2yNeLHuVEb1bsswUaMd0nDvbIId/EZ+xPauqoSyGE5IT0SJmY rfYn2bofuahk0owxgWj94H4DZ4VISszYQrLXFN2EgNF4vEnGwy8AmHElplbqXcPszacg=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=D7XUHBVG5VP8tTRX82JAqat+7CnBaGyL6YGkNS+felE=; b=WF41Bgwru0eaVguWNbtEUtrzel 75rCX8+5aAxH50tqvzRDNeGaQzsbxQFRQnFB/0SoBFNKko8yYfw0LN+2TxLLsojaGgFH7l0DfOFma BmnrFbHZtOijbYxAJ4Z38HCuDV3XzHj82UT6GbPHDpRq09t0FTgbKuQG6onq+LkcBXrw=; Received: from sin.source.kernel.org ([145.40.73.55]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1rdcaA-0002pI-68 for linux-f2fs-devel@lists.sourceforge.net; Fri, 23 Feb 2024 20:55:47 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 6C19DCE2F1A for ; Fri, 23 Feb 2024 20:55:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C9C0C433C7; Fri, 23 Feb 2024 20:55:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708721738; bh=R/vfhqy/4C7K0V3VZuGnVkSeQBgr0Z+xmB/Uvgm51/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LRpvbscO7LXmmXBcarD3+VMukyWgtYq/6MbNM+YJxM44f1d3Zscji2NmhPWQqhtO4 8G24rwNuhd1Xrlv6Q6TwY6VPOglTLsMbZMuVRC63y4lAMgbaRtGbrC84e6szyRKYoh KSs3yaxKLEHKui4pzYmwLNARtBc7KNrBUqaRhDjXnKdNCSyjxkU7FMrxbpszmpjTUJ 6HGt1x6ruljOlk2VymQbuYzArXoMHqFDTZ36z/hueyDxP4xn8xMWruGMM/R0MqGzRr JQawne3K20bKzxEwvRqL9WoPAqLsCUXV1yWZf1k4RLj807ar9hwUhNDhYa5YsGqcT4 Sy3tqAPGcTKnA== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Date: Fri, 23 Feb 2024 12:55:33 -0800 Message-ID: <20240223205535.307307-3-jaegeuk@kernel.org> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog In-Reply-To: <20240223205535.307307-1-jaegeuk@kernel.org> References: <20240223205535.307307-1-jaegeuk@kernel.org> MIME-Version: 1.0 X-Headers-End: 1rdcaA-0002pI-68 Subject: [f2fs-dev] [PATCH 3/5] f2fs: print zone status in string and some log X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jaegeuk Kim Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net No functional change, but add some more logs. Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim --- fs/f2fs/segment.c | 34 ++++++++++++++++++++++++---------- fs/f2fs/super.c | 1 + 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index d4f228e6f771..6d586ae8b55f 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -4912,6 +4912,16 @@ static int sanity_check_curseg(struct f2fs_sb_info *sbi) } #ifdef CONFIG_BLK_DEV_ZONED +const char *f2fs_zone_status[BLK_ZONE_COND_OFFLINE + 1] = { + [BLK_ZONE_COND_NOT_WP] = "NOT_WP", + [BLK_ZONE_COND_EMPTY] = "EMPTY", + [BLK_ZONE_COND_IMP_OPEN] = "IMPLICITE_OPEN", + [BLK_ZONE_COND_EXP_OPEN] = "EXPLICITE_OPEN", + [BLK_ZONE_COND_CLOSED] = "CLOSED", + [BLK_ZONE_COND_READONLY] = "READONLY", + [BLK_ZONE_COND_FULL] = "FULL", + [BLK_ZONE_COND_OFFLINE] = "OFFLINE", +}; static int check_zone_write_pointer(struct f2fs_sb_info *sbi, struct f2fs_dev_info *fdev, @@ -4928,18 +4938,22 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, zone_block = fdev->start_blk + (zone->start >> log_sectors_per_block); zone_segno = GET_SEGNO(sbi, zone_block); + /* + * Get # of valid block of the zone. + */ + valid_block_cnt = get_valid_blocks(sbi, zone_segno, true); + /* * Skip check of zones cursegs point to, since * fix_curseg_write_pointer() checks them. */ if (zone_segno >= MAIN_SEGS(sbi) || - IS_CURSEC(sbi, GET_SEC_FROM_SEG(sbi, zone_segno))) + IS_CURSEC(sbi, GET_SEC_FROM_SEG(sbi, zone_segno))) { + f2fs_notice(sbi, "Open zones: valid block[0x%x,0x%x] cond[%s]", + zone_segno, valid_block_cnt, + f2fs_zone_status[zone->cond]); return 0; - - /* - * Get # of valid block of the zone. - */ - valid_block_cnt = get_valid_blocks(sbi, zone_segno, true); + } if ((!valid_block_cnt && zone->cond == BLK_ZONE_COND_EMPTY) || (valid_block_cnt && zone->cond == BLK_ZONE_COND_FULL)) @@ -4947,8 +4961,8 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, if (!valid_block_cnt) { f2fs_notice(sbi, "Zone without valid block has non-zero write " - "pointer. Reset the write pointer: cond[0x%x]", - zone->cond); + "pointer. Reset the write pointer: cond[%s]", + f2fs_zone_status[zone->cond]); ret = __f2fs_issue_discard_zone(sbi, fdev->bdev, zone_block, zone->len >> log_sectors_per_block); if (ret) @@ -4965,8 +4979,8 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, * selected for write operation until it get discarded. */ f2fs_notice(sbi, "Valid blocks are not aligned with write " - "pointer: valid block[0x%x,0x%x] cond[0x%x]", - zone_segno, valid_block_cnt, zone->cond); + "pointer: valid block[0x%x,0x%x] cond[%s]", + zone_segno, valid_block_cnt, f2fs_zone_status[zone->cond]); ret = blkdev_zone_mgmt(fdev->bdev, REQ_OP_ZONE_FINISH, zone->start, zone->len, GFP_NOFS); diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 4d03ce1109ad..fc7f1a9fbbda 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -4674,6 +4674,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) * check zoned block devices' write pointer consistency. */ if (!f2fs_readonly(sb) && f2fs_sb_has_blkzoned(sbi)) { + f2fs_notice(sbi, "Checking entire write pointers"); err = f2fs_check_write_pointer(sbi); if (err) goto free_meta; From patchwork Fri Feb 23 20:55:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 13569988 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 058EEC54E49 for ; Fri, 23 Feb 2024 20:55:54 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1rdcaH-0000iR-29; Fri, 23 Feb 2024 20:55:53 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rdcaF-0000iG-Ma for linux-f2fs-devel@lists.sourceforge.net; Fri, 23 Feb 2024 20:55:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=LY4nb6aO4XFI9t4oJbOKO3rOm7VYOQsfpcV4tt+nqqk=; b=SdcZqOjjXsNmnC2LSylKYWYUPU +4Fz+5gfBzxhlb1m4ISm+HQeVk0hoRSZtqLPVC9SiOuuIva/kXHqSEtZhKBx+sETOFAMqOdvjU2F3 MdOcRzbIwkDwgVe95bk76mUhs7VE96OSbVbsBex1r6lw/zjgA8NAGoR1qk71YGCH0xdA=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=LY4nb6aO4XFI9t4oJbOKO3rOm7VYOQsfpcV4tt+nqqk=; b=iVUdxwsHsZTqwzgGnBFlgLCT5T 9sb4jSyhe9ifOKaOdBAPDlC/qghhdm9kFqbhLOenbK2rED29c8I42X3LmNLNDAPzI0Ss+hQSjD5wI 0XPBPXweo3RrvrocG5inQoaYE5vCPbOfYJUFsicNGSPdEgeXmAGKARpEbBCHZphPbnBI=; Received: from sin.source.kernel.org ([145.40.73.55]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1rdcaF-0002pW-Jb for linux-f2fs-devel@lists.sourceforge.net; Fri, 23 Feb 2024 20:55:52 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id D53CACE2F1F for ; Fri, 23 Feb 2024 20:55:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D6DAC433F1; Fri, 23 Feb 2024 20:55:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708721739; bh=jcqHB3mOguQlmJS0WZkHNVvEJ+LlBmJIQaxT0/mGi48=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SB3mQtoLjZc3slFBxMQrc1O4HtbEMqzWJ/jBNTuPg46FWdAFrTsuEr3EkozkldcV0 qAaO6BTlVNGrYTROIXCN2Amj4mabG7qG2YHN1PAAzYoipn5o5eQUStaR1qZA7rAGeQ jOBs1vmnQXSZ11t341fROSPlKCIb0rk8Xnpu02UC8vzTHnNXzye9LrSr5wuSrq/dVE m3D7HdmqSzsJiRwuLbNCeGxKvCAB6R4c1m878ohP4rQso5/gjLA8hX/Gc84Jdm639T uaZ/L0JUYTkQvgMfOw4hhZ9ZyTy/QHhGl2/oTZ/FCRK/J/cqy/0cBhrUq3Dm8cdQLn 0Kdk/h96tmGbQ== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Date: Fri, 23 Feb 2024 12:55:34 -0800 Message-ID: <20240223205535.307307-4-jaegeuk@kernel.org> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog In-Reply-To: <20240223205535.307307-1-jaegeuk@kernel.org> References: <20240223205535.307307-1-jaegeuk@kernel.org> MIME-Version: 1.0 X-Headers-End: 1rdcaF-0002pW-Jb Subject: [f2fs-dev] [PATCH 4/5] f2fs: prevent an f2fs_gc loop during disable_checkpoint X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jaegeuk Kim Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Don't get stuck in the f2fs_gc loop while disabling checkpoint. Instead, we have a time-based management. Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu Reviewed-by: Daeho Jeong --- fs/f2fs/super.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index fc7f1a9fbbda..7d9b92978709 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2191,6 +2191,7 @@ static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi) .init_gc_type = FG_GC, .should_migrate_blocks = false, .err_gc_skipped = true, + .no_bg_gc = true, .nr_free_secs = 1 }; f2fs_down_write(&sbi->gc_lock); From patchwork Fri Feb 23 20:55:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 13569984 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 467CDC54E49 for ; Fri, 23 Feb 2024 20:55:50 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1rdcaD-0005U2-3t; Fri, 23 Feb 2024 20:55:49 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rdcaB-0005Tv-IY for linux-f2fs-devel@lists.sourceforge.net; Fri, 23 Feb 2024 20:55:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=KEK4PKZpiKuqikEuPIITFI5x9Ipginm3gnaq5OfdLpo=; b=X6rhagSA1j24FgZDIl0SeJa3Id Z4ibOA5x/sD7WuJGxRAORVi9QvkTEbRWJs8Dy919IH8DYdb+MkI3lJdMLgVD2CO7uTgAMnY7ODxpD UKJIaoY/og06/gMQpVYZXsj3gvpS16wFH/AbZdLqlIvrybyL0qrQZSe5sOZr2nz88m94=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=KEK4PKZpiKuqikEuPIITFI5x9Ipginm3gnaq5OfdLpo=; b=TEEa4rhy7uHCeY+4Ss70jSHEyC upbMd50VVwxvz9Ss2YMp9lbELOqWJVanyRJRfM9Z2P4at84/JXG81ejfpszN4Q64QtG751nkP70cQ QMOutHR2/ejzs8PukZ7pnt1dsyh/oPQxOO0NNdZYin0WJkrroVZudYetHgCHJe6dMYqc=; Received: from dfw.source.kernel.org ([139.178.84.217]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1rdca9-0002pL-TH for linux-f2fs-devel@lists.sourceforge.net; Fri, 23 Feb 2024 20:55:47 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 757FF617C7 for ; Fri, 23 Feb 2024 20:55:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 351D1C43390; Fri, 23 Feb 2024 20:55:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708721740; bh=Dks7ZYdpho4cTIrGeKroPJwikwZpUsV1Ym/LDVuEhMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hmh02COfYfzXOAY/wQfnzDRk4Ol3gGYIn1gDcG02Bf2LrYPE/K1cx7LX/SVL2WF9Y WqtEQE8K4EUTV2MyulSisJi14ElRtimAP1qCg6blP4+VPLcEwhbntU9XTDIWE/O1uo 5lUk4hBsmPYcD6+EtNZWUM12c0f53Af/Wqjv6SyFL+PV0rqTv30oxOySWjpKKJJFlb rKjLFIb9CQXbR8X0t/AlGQCS5xV28QufjgyMHagNp6LWXie1aXQR5TuaDqINBkqCrR ToQ3A0XaoLjbIBW1jxCWMyUBzQW/LHF72Vvv1eMGAY5df4w/yuz5kj/kgyGhoyltk3 j410fPAfilfUA== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Date: Fri, 23 Feb 2024 12:55:35 -0800 Message-ID: <20240223205535.307307-5-jaegeuk@kernel.org> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog In-Reply-To: <20240223205535.307307-1-jaegeuk@kernel.org> References: <20240223205535.307307-1-jaegeuk@kernel.org> MIME-Version: 1.0 X-Headers-End: 1rdca9-0002pL-TH Subject: [f2fs-dev] [PATCH 5/5] f2fs: allow to mount if cap is 100 X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jaegeuk Kim Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Don't block mounting the partition, if cap is 100%. Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu Reviewed-by: Daeho Jeong --- fs/f2fs/segment.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 6d586ae8b55f..f11361152d2a 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -904,6 +904,9 @@ int f2fs_disable_cp_again(struct f2fs_sb_info *sbi, block_t unusable) { int ovp_hole_segs = (overprovision_segments(sbi) - reserved_segments(sbi)); + + if (F2FS_OPTION(sbi).unusable_cap_perc == 100) + return 0; if (unusable > F2FS_OPTION(sbi).unusable_cap) return -EAGAIN; if (is_sbi_flag_set(sbi, SBI_CP_DISABLED_QUICK) &&