From patchwork Wed Mar 26 14:14:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yohan Joung X-Patchwork-Id: 14030106 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 01DADC36008 for ; Wed, 26 Mar 2025 14:15:03 +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 1txRX4-000663-5O; Wed, 26 Mar 2025 14:15:02 +0000 Received: from [172.30.29.66] (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 1txRX0-000655-S5 for linux-f2fs-devel@lists.sourceforge.net; Wed, 26 Mar 2025 14:14:59 +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=Anvf65kFlASXiYrhuvhmi9oEZJmpnJM1LPwfUNxcGpU=; b=PTFSjUJxzsqeDkz6racaCK8HST VXERPUFOaeL3wlu+99TttYPJ+AIcYJxtmNl/adJf+rRC0dJSbV7rYkVLzPha/PLCaYe62r6WwtnpU xmJ1O8Q2UyQfHsT9GUYhV3YNqvPclZZKVVsiC9mDuEFax1101zGjzWKHglTTQ9Sp7860=; 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=Anvf65kFlASXiYrhuvhmi9oEZJmpnJM1LPwfUNxcGpU=; b=c GZHQwo8aSydlIj7fQSE9gIJcDNRpiczX3QdW8h2sl2Sz87VpZgaJXBDvZNYdaV9sqDp/I5ZWnYCcT rcWCwhVYOSHxGU3FI7laxQyXCwIiTjJ2gLuUr4tIM6YO2YO42V/a3pvQIKcg6mMqlcO9rp94cAW00 AhkLC9nPgew07jiM=; Received: from mail-pl1-f170.google.com ([209.85.214.170]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1txRWp-0004WN-FM for linux-f2fs-devel@lists.sourceforge.net; Wed, 26 Mar 2025 14:14:59 +0000 Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-22423adf751so128876815ad.2 for ; Wed, 26 Mar 2025 07:14:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742998477; x=1743603277; darn=lists.sourceforge.net; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Anvf65kFlASXiYrhuvhmi9oEZJmpnJM1LPwfUNxcGpU=; b=eGd3rKz5d5vfpI2ozbqIeSflr/EMH3ekLPSJ2BCT7Vmf7wpzeHK82TtsmkdVtQhYh2 DQcSjvmi7XWyk2pSisuTJQXFN0tcQwONdPsjoEZSMRNv8BaxX2Ujoll56OzTyuuPlLA5 STvdckKOClokcPd2XEy/x88J3X1fD8AETLgd3ynzDUeOImAta9ZibI4FYilflIOXNJ3p hnb3y53geb0prTDxiSY4Mq/Eayg/pGJwWG4dyx24dnYoNVPHa1KWWDKvoK+ZoQtN7XTQ MTXQp0cf0OtEEX1FCF2tMtwvRvMuM6dnNVgxHJRi6lzydl5XYAhotHKX7wgh6UF1Pg14 4Z8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742998477; x=1743603277; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Anvf65kFlASXiYrhuvhmi9oEZJmpnJM1LPwfUNxcGpU=; b=nHLn0n5G7pHIwSL4Sbw8zSk2w3LPzFUOidYSck4xS8EeQrMZuId0gfE6hikD9zi4Fz EOzXH0qpW1UI7K1ZTAfRNF7VN7QwhlKmMm311IK/LRDuV3t7ueiVHA0A8WNYewpI+DE6 Wt9lnR2quJikZ2Po7XZHryXqgi/FR1gkq4sreVqvqH8+XJVyjvS0kZ0Ni/NFHPgzk49u mPOCcaHXG6ApYDGeVfNjk0n4WjxzQaCbpMc4kLxxM/fCGS8NmzFCa+prVX6lREXasoWp STGjuMQiw0DGic8Qd6oWmERf7/EOreOwIyeGNwWtT078GkHDc4kvRPqYIiQWiGcnJMjy w1yA== X-Gm-Message-State: AOJu0YwnAMSn3vPYMHM3tAM//neeU/NLE4s3pCrqHxH9ZOJfcNqxH9wW BdMmpIFZrmKLeStJI+g3fYLb8p+fXV+a3FZfwhu6Ok7mXkpFw2E+ X-Gm-Gg: ASbGncuyPeEWdZmTSImhrgSAE4I7RGzl0HqDLMfaGgNwB4k9dXpoKteL04rcOiHEM1L wMmLE6Ha3lA4jsK3Y0IDzLvOHqwOY1qeks9j7eUnOtEgX1H86JCyPOqir8IXd8iAHiczF9LKTME bSQtCvXlwzeKUKjpy5erllh9HjnEW5awaA1pAkisCrReYj69VRdx/O1GgbPrJhk6o4qJdFGiI0V w5q+gsxfgO7oslNCu3QPtVK9SCu4xt4XmEga6uaM7FHHUpJAJUYt8IdnrsUish07XXUsnmVg0qt +bWGlmhDsjm7/TBgjjA+i5qWsXEgXZ9j7NKst5NYXaEAVKQ3K2suEjwmbKApKjqH0Au/HKwrbw= = X-Google-Smtp-Source: AGHT+IGK01CfleCX2pzM5nt0ir3um7yD8M9syjpA5VmHgXO/F4LfW2P+UBe4DgFIy/ycLsbdmFIZ2A== X-Received: by 2002:a17:902:cec8:b0:225:abd2:5e4b with SMTP id d9443c01a7336-22780d7fb22mr302208615ad.16.1742998476493; Wed, 26 Mar 2025 07:14:36 -0700 (PDT) Received: from DESKTOP-B5TBVBT.localdomain ([175.117.51.71]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-227967dfe4dsm92323315ad.167.2025.03.26.07.14.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Mar 2025 07:14:36 -0700 (PDT) From: Yohan Joung X-Google-Original-From: Yohan Joung To: jaegeuk@kernel.org, chao@kernel.org, daeho43@gmail.com Date: Wed, 26 Mar 2025 23:14:28 +0900 Message-Id: <20250326141428.280-1-yohan.joung@sk.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Headers-End: 1txRWp-0004WN-FM Subject: [f2fs-dev] [PATCH] f2fs: prevent the current section from being selected as a victim during garbage collection 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: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net When selecting a victim using next_victim_seg in a large section, the selected section might already have been cleared and designated as the new current section, making it actively in use. This behavior causes inconsistency between the SIT and SSA. Signed-off-by: Yohan Joung --- fs/f2fs/gc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 2b8f9239bede..4b5d18e395eb 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1926,6 +1926,10 @@ int f2fs_gc(struct f2fs_sb_info *sbi, struct f2fs_gc_control *gc_control) goto stop; } + if (__is_large_section(sbi) && + IS_CURSEC(sbi, GET_SEC_FROM_SEG(sbi, segno))) + goto stop; + seg_freed = do_garbage_collect(sbi, segno, &gc_list, gc_type, gc_control->should_migrate_blocks, gc_control->one_time);