Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp819746rwl; Wed, 29 Mar 2023 08:53:44 -0700 (PDT) X-Google-Smtp-Source: AKy350ZD8U70DRcT3kbDwjA3/2worP6ipjE7O+3ayq7ywVKTLSEVJ2crltkdQ/z0kLe+fMafNgeT X-Received: by 2002:a17:906:ae53:b0:8b1:7ac6:3186 with SMTP id lf19-20020a170906ae5300b008b17ac63186mr19918646ejb.68.1680105224751; Wed, 29 Mar 2023 08:53:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680105224; cv=none; d=google.com; s=arc-20160816; b=T6CEoGBwsRiYpDE/9CW3MTmIWQq02Z5vsc98s2ETigaxNr8LaN/gD3VJ7FLkVxL9Bp 5w27o4h97cbJW/2GVZHiO700pAyRqAszJDkKBIkT+7Tvzqah00h3dfYA9l5sDQoojCtl zdrWqZeAvN2xvzVzfN8A7MdtGsyxnCidegJGkmuaL4AtZIM5WBZ5/RF9dGvzBTmQtSr4 Vr7VYLImTf85RulN/RjMoxdK6J7DwtQrYOC0/mvu81srOt48HuIC7qtAWn2KiemUJ6rV NszX8yH8IFd5jliLFBflEqzsb/1erTNfaP25pzVIJpnPCn4DzqPKr1JycuDjmru0SyFl a6Pg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=sS9p0wTn0AoAZRi96rQ6edud8lnjeVCzVSBAhQzhINs=; b=Y6s1jEo8MOuviiAvGKYT56lpXCP2SpzNubp4VntEsBpdKQzeTuZ3hkRae2yOBFKDoe 5cASDZi1jfDD61r1CJ1w9fJi/NZyKWI/6x8KyM7W8aYQz4fhSVNbV1klWopYwXnJv4BA ruzQT+WvCXZZT4g/CLBCIhqBjLwlFf15a4camKh1SywnrtH1jod6BTuTPo4TBsq1p6Ch DhUnum+qmYbkE5rqEOOLQHhMTHYfSUex12IxT/+kR7d9vkjEcloMTAG18Ep/piXNGsb0 t+5M3OfkdSZVCYogHHZgMOGi1UsgCEqPUaXPikgo/59SGdcKYl5D1QnKQL53isQDiius ZZgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=z+LUcSZO; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr19-20020a1709073f9300b0093549a153f9si31848075ejc.912.2023.03.29.08.53.18; Wed, 29 Mar 2023 08:53:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=z+LUcSZO; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230167AbjC2PuC (ORCPT + 99 others); Wed, 29 Mar 2023 11:50:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230233AbjC2Pt7 (ORCPT ); Wed, 29 Mar 2023 11:49:59 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57FDC4C08 for ; Wed, 29 Mar 2023 08:49:57 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1069F1FE03; Wed, 29 Mar 2023 15:49:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1680104996; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sS9p0wTn0AoAZRi96rQ6edud8lnjeVCzVSBAhQzhINs=; b=z+LUcSZOVVbk8FHbB8Mwj2rSyPqTnWu+XuzghD+8bHbMgY2KI70kUBoI4YVrFIku5YrTxd zzK1u0T6x002kNDIrvpv2Nr8Quk9bgYPlj11h7V9pBVDq9PwFaZ6nNPvVy8WvfH3OvU3GN 81VhtzPyj6BvNXJrFTb55C7YeptNSQM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1680104996; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sS9p0wTn0AoAZRi96rQ6edud8lnjeVCzVSBAhQzhINs=; b=300HqkwMos++CK20qtzKHaSIyBI+VwNviZjA19sHS+l94OLfEHVor1fQi0YFnCpQpm9i/j c7cZvz+ZgWGE0/Cw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C9DEB13A2A; Wed, 29 Mar 2023 15:49:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mdA/MCJeJGQ0YwAAMHmgww (envelope-from ); Wed, 29 Mar 2023 15:49:54 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 3A155A0732; Wed, 29 Mar 2023 17:49:50 +0200 (CEST) From: Jan Kara To: Ted Tso Cc: , Jan Kara Subject: [PATCH 03/13] ext4: Keep pages with journalled data dirty Date: Wed, 29 Mar 2023 17:49:34 +0200 Message-Id: <20230329154950.19720-3-jack@suse.cz> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230329125740.4127-1-jack@suse.cz> References: <20230329125740.4127-1-jack@suse.cz> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1673; i=jack@suse.cz; h=from:subject; bh=NCZFkjD32UzTWBtRMdaeQU7M3ZxU0fdoytjyRJrOw0Y=; b=owEBbQGS/pANAwAIAZydqgc/ZEDZAcsmYgBkJF4OHAYdNyIMlrD8joPFjhGDdnRsPCvlTMokP4Qe DUmaWNuJATMEAAEIAB0WIQSrWdEr1p4yirVVKBycnaoHP2RA2QUCZCReDgAKCRCcnaoHP2RA2bmCB/ wLmTi394VTYI7YpupUkAOeopQKgNs7tvMzwqqXrp9fibcVCf6p4HreOAz8SkSQXzuVKmi+2uu1VQRj K5tiVSrtv8OLxzSsHW/7MdS66dF/NNvI/HqTAlgJ2zM8vg6wAFpJC8rTjJDTaDmdNPhpXryA6bdQDS bqRQO2vWKTU8L4+biv377/I1yymp4bFSZK4RqUWlOwhgUM7He3ujonP6blyTmmcdh0XUb8PaiTIXD+ rnTlb0pU3VbHO15Vq5mwWr5NN1EEOJL0QIFR3xJZby0CdPVHS75pwBM3GHKotQxR2tPaVTr1vJX0yD YcwNbqWmrCjP8Dw+6U6PD7qcHVI+Pm X-Developer-Key: i=jack@suse.cz; a=openpgp; fpr=93C6099A142276A28BBE35D815BC833443038D8C Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_SOFTFAIL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Currently we clear page dirty bit when we checkpoint some buffers from a page with journalled data or when we perform delayed dirtying of a page in ext4_writepages(). In a quest to simplify handling of journalled data we want to keep page dirty as long as it has either buffers to checkpoint or journalled dirty data. So make sure to keep page dirty in ext4_writepages() if it still has journalled data attached to it. Signed-off-by: Jan Kara --- fs/ext4/inode.c | 1 - fs/ext4/page-io.c | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 73e24e61fdd2..78e29da70af7 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -2387,7 +2387,6 @@ static int mpage_journal_page_buffers(handle_t *handle, int len; ClearPageChecked(page); - clear_page_dirty_for_io(page); mpd->wbc->nr_to_write--; if (page->index == size >> PAGE_SHIFT && diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index 8703fd732abb..23b29a50b159 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c @@ -484,9 +484,11 @@ int ext4_bio_write_page(struct ext4_io_submit *io, * to redirty the page and keep TOWRITE tag so that * racing WB_SYNC_ALL writeback does not skip the page. * This happens e.g. when doing writeout for - * transaction commit. + * transaction commit or when journalled data is not + * yet committed. */ - if (buffer_dirty(bh)) { + if (buffer_dirty(bh) || + (buffer_jbd(bh) && buffer_jbddirty(bh))) { if (!PageDirty(page)) redirty_page_for_writepage(wbc, page); keep_towrite = true; -- 2.35.3