From patchwork Fri Dec 27 03:39:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: zangyangyang1 X-Patchwork-Id: 13921520 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 BAB70E7718B for ; Fri, 27 Dec 2024 03:39: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 1tR1CX-0007OR-Dx; Fri, 27 Dec 2024 03:39:49 +0000 Received: from [172.30.29.66] (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 1tR1CL-0007OB-So for linux-f2fs-devel@lists.sourceforge.net; Fri, 27 Dec 2024 03:39:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:Content-Transfer-Encoding:MIME-Version :Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: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=N8F0/SBGZUMn+FmEvZcioCfuOCEkyvSio6MV1ISvz+s=; b=V1p9rrULhkoAN0vPVS+TiVa1SD b9+DPhqWs57UE/R7vtldRMyV0z7ozeRmrH9dHZqwUz7N5RbI0qjVXltheeRDT/Nd0O4Q+KOOw79ui zT+XXIPaVD2bsm/64qZ+PNSZ1ZsWo5MyF2vLBuumB4Ri8IvyReL+NzFN4/SrhLbWivSQ=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Date: Subject:CC:To:From:Sender:Reply-To: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=N8F0/SBGZUMn+FmEvZcioCfuOCEkyvSio6MV1ISvz+s=; b=F XIs0+qv08sJ954U5FgHaJ/ey/BvpG0raSKPqe3XgDzm/RYSfMCYR+IzuY1YwcU5E62YZ8B7z+AiDJ 48owjl+Cu3gmfY0Fv8z1miYZQ4DwebJUyKLGEaOn7GDT0ghKpZpLptMq0LN2BgTslpLrAdZLBYObb m8FgcU12HGzKUdgg=; Received: from outboundhk.mxmail.xiaomi.com ([207.226.244.122]) by sfi-mx-2.v28.lw.sourceforge.com with esmtp (Exim 4.95) id 1tR1CK-0005x3-Q9 for linux-f2fs-devel@lists.sourceforge.net; Fri, 27 Dec 2024 03:39:37 +0000 X-CSE-ConnectionGUID: FtjdeTNWQTyTB8QVbN5RYQ== X-CSE-MsgGUID: GeLu7PQ2Q3uj0+Z+yWIa0w== X-IronPort-AV: E=Sophos;i="6.12,268,1728921600"; d="scan'208";a="129448166" To: Date: Fri, 27 Dec 2024 11:39:08 +0800 Message-ID: <20241227033908.2949683-1-zangyangyang1@xiaomi.com> X-Mailer: git-send-email 2.43.2 MIME-Version: 1.0 X-Originating-IP: [10.237.88.13] X-ClientProxiedBy: yz-mbx15.mioffice.cn (10.237.88.135) To bj-mbx11.mioffice.cn (10.237.8.131) X-Headers-End: 1tR1CK-0005x3-Q9 Subject: [f2fs-dev] [PATCH V2] f2fs: fix using wrong 'submitted' value in f2fs_write_cache_pages 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: , X-Patchwork-Original-From: zangyangyang1 via Linux-f2fs-devel From: zangyangyang1 Reply-To: zangyangyang1 Cc: jaegeuk@kernel.org, zangyangyang1 , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net When f2fs_write_single_data_page fails, f2fs_write_cache_pages will use the last 'submitted' value incorrectly, which will cause 'nwritten' and 'wbc->nr_to_write' calculation errors Signed-off-by: zangyangyang1 Reviewed-by: Chao Yu --- V2: Initialize "submitted" in f2fs_write_single_data_page() --- fs/f2fs/data.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.43.2 #/******±¾Óʼþ¼°Æ丽¼þº¬ÓÐСÃ×¹«Ë¾µÄ±£ÃÜÐÅÏ¢£¬½öÏÞÓÚ·¢Ë͸øÉÏÃæµØÖ·ÖÐÁгöµÄ¸öÈË»òȺ×é¡£½ûÖ¹ÈκÎÆäËûÈËÒÔÈκÎÐÎʽʹÓ㨰üÀ¨µ«²»ÏÞÓÚÈ«²¿»ò²¿·ÖµØй¶¡¢¸´ÖÆ¡¢»òÉ¢·¢£©±¾ÓʼþÖеÄÐÅÏ¢¡£Èç¹ûÄú´íÊÕÁ˱¾Óʼþ£¬ÇëÄúÁ¢¼´µç»°»òÓʼþ֪ͨ·¢¼þÈ˲¢É¾³ý±¾Óʼþ£¡ This e-mail and its attachments contain confidential information from XIAOMI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!******/# diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 94f7b084f601..f772fbc7f331 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2816,6 +2816,9 @@ int f2fs_write_single_data_page(struct folio *folio, int *submitted, trace_f2fs_writepage(folio, DATA); + if (submitted) + *submitted = 0; + /* we should bypass data pages to proceed the kworker jobs */ if (unlikely(f2fs_cp_error(sbi))) { mapping_set_error(folio->mapping, -EIO);