From patchwork Sun Dec 10 11:35:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13486382 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 2A9C5C4167B for ; Sun, 10 Dec 2023 11:36:14 +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 1rCI6Y-0000pA-OH; Sun, 10 Dec 2023 11:36:13 +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 1rCI6X-0000p4-2r for linux-f2fs-devel@lists.sourceforge.net; Sun, 10 Dec 2023 11:36:12 +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=8+1qvF+S90X+3f5I0kunpxz8Hd4Y0sJorduuL2QvI20=; b=mHdDPi4LdCinQ8zAK1rsWDRmrD mX29teYzZXdXgGUs49o17bIST1WvNQYH2xNVnjp5ZDDqM2tAfMS4SGMC4vjVFrfB0D7+iT3p/IPVC RS9gw1p4sCuITomIbkvtsMcUWiD83cHA91CZqtnsD890NwspU4Z6IEk+UAURIQO7TXhY=; 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=8+1qvF+S90X+3f5I0kunpxz8Hd4Y0sJorduuL2QvI20=; b=m uFIFZ49f4KMzDPQFfe1pb4N7oO4H/0kfbA8Kf3fPqj3BpkgLEJjHbVz+0l8crESFrkEuOuypOCyrM ErZ1JrSBEqHh+X/D+/8jf/DCTA4VoRH3bJgdwuPYk6fKhmh2rdmK/++ZdgjNEPMi1jwR4aeb/JLNn CmXzfcXycqz0mMlo=; 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 1rCI6V-0000U0-0A for linux-f2fs-devel@lists.sourceforge.net; Sun, 10 Dec 2023 11:36:11 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 268C7CE0AD0 for ; Sun, 10 Dec 2023 11:36:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8C3AC433C7; Sun, 10 Dec 2023 11:35:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702208159; bh=rLcyF1ZrszFFVhog4TqrXAnFuqCYoRmQyE22OkV/4iY=; h=From:To:Cc:Subject:Date:From; b=enRuddIEf8bqGYbgra4E2dbFPYn2xIF/4SgpYcYlljGw7xqldMI0SUQIgjvBO2nuA BKwyGFp0hMoAm4BiD+wo9ZE9GHHSXHVSNQUP92fw3zQjDW9b2/Hp5z/L5tv3KJbqby 8SaZ056f/hCouqDOEXQglytYMp4RBzHAtfgz2DQA2TY3uBHmNpNbmAfzMtQPmPosCN CnGBtmVKkIslvgul/9tI9fhJkuHrBXbszL6W0YqMp29yvWLNS4Oz4QmCVrDKzrEB+M 41GlkTNJN4EkLSvW8GBmhHLNHAfIMG9+ohCQQjFvmms8VWHqdsuiZ728EhdNnDLkvi 0d/fCyzrGQPLQ== From: Chao Yu To: jaegeuk@kernel.org Date: Sun, 10 Dec 2023 19:35:42 +0800 Message-Id: <20231210113547.3412782-1-chao@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Headers-End: 1rCI6V-0000U0-0A Subject: [f2fs-dev] [PATCH 1/6] f2fs: fix to tag gcing flag on page during block migration 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 It needs to add missing gcing flag on page during block migration, in order to garantee migrated data be persisted during checkpoint, otherwise out-of-order persistency between data and node may cause data corruption after SPOR. Similar issue was fixed by commit 2d1fe8a86bf5 ("f2fs: fix to tag gcing flag on page during file defragment"). Signed-off-by: Chao Yu --- fs/f2fs/compress.c | 4 +++- fs/f2fs/file.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c index b35be5799726..c5a4364c4482 100644 --- a/fs/f2fs/compress.c +++ b/fs/f2fs/compress.c @@ -1036,8 +1036,10 @@ static void set_cluster_dirty(struct compress_ctx *cc) int i; for (i = 0; i < cc->cluster_size; i++) - if (cc->rpages[i]) + if (cc->rpages[i]) { set_page_dirty(cc->rpages[i]); + set_page_private_gcing(cc->rpages[i]); + } } static int prepare_compress_overwrite(struct compress_ctx *cc, diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 60290940018d..156b0ff05a3b 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1312,6 +1312,7 @@ static int __clone_blkaddrs(struct inode *src_inode, struct inode *dst_inode, } memcpy_page(pdst, 0, psrc, 0, PAGE_SIZE); set_page_dirty(pdst); + set_page_private_gcing(pdst); f2fs_put_page(pdst, 1); f2fs_put_page(psrc, 1); @@ -4046,6 +4047,7 @@ static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len) f2fs_bug_on(F2FS_I_SB(inode), !page); set_page_dirty(page); + set_page_private_gcing(page); f2fs_put_page(page, 1); f2fs_put_page(page, 0); }