From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1DE737B024 for ; Fri, 20 Mar 2026 13:42:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774014146; cv=none; b=bbxJ/A+NjVCQ8ud6pgA7YUL7+Fha34dEZPttGSOUAPl9TavaQPevIqg5CphFEMmFR41LKIOqG3wJTH8Qh1EUC259R4jwDN1KB3doVLnsCwXjmk7XPk/H9DiD1u4k1F5Sv4hIUyw9KmWLU0oY1+eNWBPs9SjXzI5X6g54BymebtA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774014146; c=relaxed/simple; bh=owc5m+YmFPFX9G7b4L5yVqAn4sHTNVwb7RYuqrd3Kag=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QFbBUH8tRlW9L0HcyTlSbSVvguc4pFsj59hUyekx+S+A+o4MVvoh+yXMaEN1Cf9a1uCKUtqkmx+chCBz1l3tJ6DBeLFhSJcFsD6bFJqHpiAvQBnxHy2NDKEsgpzaQ2lurEL6rhOnRGZnfeCSavZbxSAJfaL+t6nPe2wCHMQJrus= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 5048B4D285; Fri, 20 Mar 2026 13:41:45 +0000 (UTC) Authentication-Results: smtp-out1.suse.de; none Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 452CB42819; Fri, 20 Mar 2026 13:41:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id EyniEJlOvWlsCQAAD6G6ig (envelope-from ); Fri, 20 Mar 2026 13:41:45 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id D935CA0B56; Fri, 20 Mar 2026 14:41:44 +0100 (CET) From: Jan Kara To: Cc: , Christian Brauner , Al Viro , , Ted Tso , "Tigran A. Aivazian" , David Sterba , OGAWA Hirofumi , Muchun Song , Oscar Salvador , David Hildenbrand , linux-mm@kvack.org, linux-aio@kvack.org, Benjamin LaHaise , Jan Kara Subject: [PATCH 17/41] ext4: Sync and invalidate metadata buffers from ext4_evict_inode() Date: Fri, 20 Mar 2026 14:41:12 +0100 Message-ID: <20260320134100.20731-58-jack@suse.cz> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260320131728.6449-1-jack@suse.cz> References: <20260320131728.6449-1-jack@suse.cz> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1456; i=jack@suse.cz; h=from:subject; bh=owc5m+YmFPFX9G7b4L5yVqAn4sHTNVwb7RYuqrd3Kag=; b=owEBbQGS/pANAwAIAZydqgc/ZEDZAcsmYgBpvU56/m40sh9r+/VqeE/EOztc8+Vm8Hwnlm9ew gLKiBy9a+aJATMEAAEIAB0WIQSrWdEr1p4yirVVKBycnaoHP2RA2QUCab1OegAKCRCcnaoHP2RA 2cWCB/9G3dVfiVkIYgi+VExtwyXQQHTeJyM3wYtTmwcKRC9Fw+jtltLqpMltzU5aN6lGYQY6oWJ Nvfqt318qgAKwQHvwqgssFBmm9YMyPUZri8Y21D9V8DftJabV6FTL7wBHMnIbkfHitEm09irp5a tS6TX42aH0xsov2PY8RzkQAfVCPHzlMV+F8hrhqr36s2rvmfvQ+CEqNCZTUy/+98k6EeIV+msAq duXZ0ndGU0dhBtmY19D5E8dYlHvbcVxvAGZeqZJgXzgTTI17ipPPQD0BUf3+FOjcLuYX2nXyQZG OntlKK/d1++/q46iCWtvNlBJ7YTib8NrQwWghea/nMMTaURJ X-Developer-Key: i=jack@suse.cz; a=openpgp; fpr=93C6099A142276A28BBE35D815BC833443038D8C Content-Transfer-Encoding: 8bit X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 5048B4D285 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action X-Spam-Score: -4.00 X-Spam-Level: X-Spam-Flag: NO X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[]; TAGGED_RCPT(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLhafujjw6m7bafrsz8p45s31g)] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org There are only very few filesystems using generic metadata buffer head tracking and everybody is paying the overhead. When we remove this tracking for inode reclaim code .evict will start to see inodes with metadata buffers attached so write them out and prune them. Acked-by: Theodore Ts'o Signed-off-by: Jan Kara --- fs/ext4/inode.c | 4 +++- fs/ext4/super.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index d18d94acddcc..6f892abef003 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -185,7 +185,9 @@ void ext4_evict_inode(struct inode *inode) ext4_evict_ea_inode(inode); if (inode->i_nlink) { truncate_inode_pages_final(&inode->i_data); - + /* Avoid mballoc special inode which has no proper iops */ + if (!EXT4_SB(inode->i_sb)->s_journal) + sync_mapping_buffers(&inode->i_data); goto no_delete; } diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 43f680c750ae..ea827b0ecc8d 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1524,7 +1524,8 @@ static void destroy_inodecache(void) void ext4_clear_inode(struct inode *inode) { ext4_fc_del(inode); - invalidate_inode_buffers(inode); + if (!EXT4_SB(inode->i_sb)->s_journal) + invalidate_inode_buffers(inode); clear_inode(inode); ext4_discard_preallocations(inode); ext4_es_remove_extent(inode, 0, EXT_MAX_BLOCKS); -- 2.51.0