Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp819995rwl; Wed, 29 Mar 2023 08:53:55 -0700 (PDT) X-Google-Smtp-Source: AKy350ZYplHNvYGEw8+6/+kJq0kwj3PkwUi1v5fgzl7Uzxg8dzOiJcQe3U5SjroNordCr32Hv9H+ X-Received: by 2002:a05:6402:653:b0:4fb:e9b8:ca56 with SMTP id u19-20020a056402065300b004fbe9b8ca56mr16779367edx.41.1680105235750; Wed, 29 Mar 2023 08:53:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680105235; cv=none; d=google.com; s=arc-20160816; b=yNXsPVov3uF4oYA+tCSzmsqnkM3WUSJ4VTIYgiaVEUka2iX84N5WxZ8HiGNufJ6GQ5 m8XcfeUKy4wdOGuCA1sIx0x62BcUV3EVXXHQFQdniItvw7fUO1t8sf2G3Y1pFZnHBTod g+Vpd1DT82EQmEx1c8j6OCJxjeL9cUgMChSKo0h4s1wu8C7H1OR0UWweSmIjVlmL9SYY GoLHipmdPlibSgAtLxAv2w9XPEZ3gLSQegT0w2Ci2svhkFgeX9v7MNxttFIvIyFBDe2H eW6Xr9ZdNsyyVaC3i51mTCJctwnsSwjIVj7mf0f32NXJi0EBb9RnMTniPJL5rI7jKswH 4f5g== 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=ZkxVP7aRumgmxpVKpT56v+Tlo7r4pDoPeQGbUaDkmhE=; b=YXIbwhzmNZbnulM+pglQxySeBtDt8EHNriL0ontYW9bwFdsHSi4sB7p2wwNHe/RWEZ K+dCGOBoKd6998bsmcfp2syjYA3c4wZyxUhyP6BAVV/gjC1YUBrFJRMa+hdQGAt/W/3k lHdoOiG5ukLdajHZLJXdWbUr+kqG+tWEbX8nHjHu289cGoZyfsXx2gDiwegUBbITBP3Q Tl0XyDIg44VxA6UObwHwlTweEgRc/ALdEYntz+gTKluRse/2eBCWmnm3AG15P2EDEboT +5jv5W/B2Ar8rtpRFglcmOM491/jhzoKa8MdugBVEy9vbLO6M+X7TVw/8Z4tnML8YXDt MHng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=FliYw8KY; 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 w2-20020aa7cb42000000b004fafc269d55si33804739edt.113.2023.03.29.08.53.32; Wed, 29 Mar 2023 08:53:55 -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=FliYw8KY; 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 S230431AbjC2Pu3 (ORCPT + 99 others); Wed, 29 Mar 2023 11:50:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229532AbjC2PuM (ORCPT ); Wed, 29 Mar 2023 11:50:12 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B5854699 for ; Wed, 29 Mar 2023 08:50:07 -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-out1.suse.de (Postfix) with ESMTPS id C4C7521A1E; Wed, 29 Mar 2023 15:50:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1680105005; 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=ZkxVP7aRumgmxpVKpT56v+Tlo7r4pDoPeQGbUaDkmhE=; b=FliYw8KYwhMftLl6DprkYm7781L8LhpTsrSGU/lvyKSqdJN2ZYX0xxiFnz5JKHUWP69dIe rMpUeelVGzgJ7ulBPgfV3CxVdGBX+kKawUy15SNgXrCnq22zc4QU3cB/HbG4BPzBv0Kr2t /f2am0ZtDJAq97rTiDKB9tqLkUtQObo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1680105005; 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=ZkxVP7aRumgmxpVKpT56v+Tlo7r4pDoPeQGbUaDkmhE=; b=87HM+mr6U4jIcNM7kj+aCzozmO0tW91XUXGH93JRNRqvY2Pm4pfzOb1zq00M3IUPPAWE9l 6PEUGztLlTBlm7Cw== 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 AAC6013A2A; Wed, 29 Mar 2023 15:50:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id IpGqKSxeJGR4YwAAMHmgww (envelope-from ); Wed, 29 Mar 2023 15:50:04 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 5B5F3A074F; Wed, 29 Mar 2023 17:49:50 +0200 (CEST) From: Jan Kara To: Ted Tso Cc: , Jan Kara Subject: [PATCH 09/13] ext4: Drop special handling of journalled data from ext4_evict_inode() Date: Wed, 29 Mar 2023 17:49:40 +0200 Message-Id: <20230329154950.19720-9-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=2097; i=jack@suse.cz; h=from:subject; bh=qucJxV+iEyD6sZZKBCazGMPu/mTeOpijMCAuab3mzsw=; b=owEBbQGS/pANAwAIAZydqgc/ZEDZAcsmYgBkJF4T4g0jpTt2fpdinJ2XC8EskmU5EpLR+erwEjT+ ixdxh1OJATMEAAEIAB0WIQSrWdEr1p4yirVVKBycnaoHP2RA2QUCZCReEwAKCRCcnaoHP2RA2UsRCA CXHsDuCj4aR1pI6LMv9XqnWdZWPO71Cauh2MsspiJc3P6J8/TBc4N4lpbrB1kf8qmEikw7UxItwb5X 0qvw3fE5kv2MT0MJtvtIm6cpn05HN1jc5jNr+ghjjYIJpDTckOkCnyexf830lf3qpYQ71kJFzi9MGe WfqjZ8u0JTMW8cGE2hWVc0XbnoybG7Ww8uuqbQ9t8pazFIuy8CyDHJVRnMdf6pliOjyF4yL4zLXFEr 4rAYwkHordd4C9fyJYGwL9gy+uOdaiPKYyy8RAyb3d5OTZDG1f59mzNVZksRBLvtk89zX3LWLH7BD+ 0P83u4oXKDTdF00+/x1on/SdpLoqVo X-Developer-Key: i=jack@suse.cz; a=openpgp; fpr=93C6099A142276A28BBE35D815BC833443038D8C Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS 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 Now that ext4_writepages() makes sure journalled data is on stable storage, write_inode_now() call in iput_final() is enough to make pagecache pages with journalled data really clean (data committed and checkpointed). So we can drop special handling of journalled data in ext4_evict_inode(). Signed-off-by: Jan Kara --- fs/ext4/inode.c | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 3ab2d56b6840..94bfb12aaa9e 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -179,33 +179,6 @@ void ext4_evict_inode(struct inode *inode) if (EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL) ext4_evict_ea_inode(inode); if (inode->i_nlink) { - /* - * When journalling data dirty buffers are tracked only in the - * journal. So although mm thinks everything is clean and - * ready for reaping the inode might still have some pages to - * write in the running transaction or waiting to be - * checkpointed. Thus calling jbd2_journal_invalidate_folio() - * (via truncate_inode_pages()) to discard these buffers can - * cause data loss. Also even if we did not discard these - * buffers, we would have no way to find them after the inode - * is reaped and thus user could see stale data if he tries to - * read them before the transaction is checkpointed. So be - * careful and force everything to disk here... We use - * ei->i_datasync_tid to store the newest transaction - * containing inode's data. - * - * Note that directories do not have this problem because they - * don't use page cache. - */ - if (inode->i_ino != EXT4_JOURNAL_INO && - ext4_should_journal_data(inode) && - S_ISREG(inode->i_mode) && inode->i_data.nrpages) { - journal_t *journal = EXT4_SB(inode->i_sb)->s_journal; - tid_t commit_tid = EXT4_I(inode)->i_datasync_tid; - - jbd2_complete_transaction(journal, commit_tid); - filemap_write_and_wait(&inode->i_data); - } truncate_inode_pages_final(&inode->i_data); goto no_delete; -- 2.35.3