From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 99443317171 for ; Fri, 20 Mar 2026 13:42:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774014167; cv=none; b=WuZuvMMkhK29/KMHtSDolqudy8iSOnN1OnIre9/12d8A6mT+D1Au88MHR0JL3qIjzb4cNLzDGofxAEZfjuHn/VqYDPi9LV9QEmXJ8Lsn8CB9XvknnKiS6sJZYwCNGzk4SZFaZw7r8p+oDF2MNHuR+Y9BIm0eA00T4Gfu56Uuzlg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774014167; c=relaxed/simple; bh=1NKDncz6Z7546ej0732+hXSWl17G06Ctb725RLacGIs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PC0rzeOMVFtlz6NcMcZ2hkCjcN6jtjQUVVp/B8uY6VnbfiCzcKZOGO1aEPeHZJLfDiYYYGTkw4j7pR03VPsOd3bDNA4E1qdPXq6QmG/X0y1Y08mp38opQyMoOEWOneYJDJQ403zoOxMAxSSHyJaZ8FESB0Qg8vAIL8OXlVygeeI= 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.131 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-out2.suse.de (Postfix) with ESMTPS id 698FE5BEDC; Fri, 20 Mar 2026 13:41:45 +0000 (UTC) Authentication-Results: smtp-out2.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 523B34281C; 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 5TYSFJlOvWlzCQAAD6G6ig (envelope-from ); Fri, 20 Mar 2026 13:41:45 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id F359EA0B3C; 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 20/41] fs: Ignore inode metadata buffers in inode_lru_isolate() Date: Fri, 20 Mar 2026 14:41:15 +0100 Message-ID: <20260320134100.20731-61-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=4530; i=jack@suse.cz; h=from:subject; bh=1NKDncz6Z7546ej0732+hXSWl17G06Ctb725RLacGIs=; b=owEBbQGS/pANAwAIAZydqgc/ZEDZAcsmYgBpvU59nMMCriSqYDkQ+rIxKnPPuxayrxzgjDtg5 Npw+AarQEuJATMEAAEIAB0WIQSrWdEr1p4yirVVKBycnaoHP2RA2QUCab1OfQAKCRCcnaoHP2RA 2TL7B/9+3M09G8xKSiyYXHTJO/TNRoEGH/s/2BP9I+Z/jzcafAw0j66C0G8g+WjoY5ggjOKV5Ci oi6MpNhW+kmcj3j/qWfQpU7A09glQ43CB5XbDJ2jHzIMtILDN9oYKwVCEcS2ha7JRwNfStB/QAE TT4u78pgrWYuIRUO7aCIHYgT6Kjk+C70UUqfqNuh2XpipH+COC7YXq1NUxA9MfUmICcOLUsbF+0 bLBA2QGR7vv4ZD0bt3Ox1XSHqvyvVmjjM2q4g6LhJPD+AUcogOgEu5Ccewgfd75ddsMIuVttHdc yoB1nmkmk9obTCrzz/aAg4Rh7PqTbgRAG6VkcVuiqOov0rLD 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-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[]; TAGGED_RCPT(0.00)[] X-Rspamd-Queue-Id: 698FE5BEDC X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action X-Spam-Flag: NO X-Spam-Score: -4.00 X-Spam-Level: There are only a few filesystems that use generic tracking of inode metadata buffer heads. As such it is mostly pointless to verify such attached buffer heads during inode reclaim. Drop the handling from inode_lru_isolate(). Signed-off-by: Jan Kara --- fs/buffer.c | 29 ----------------------------- fs/inode.c | 21 +++++++++------------ include/linux/buffer_head.h | 3 --- 3 files changed, 9 insertions(+), 44 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 1bc0f22f3cc2..bd48644e1bf8 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -878,35 +878,6 @@ void invalidate_inode_buffers(struct inode *inode) } EXPORT_SYMBOL(invalidate_inode_buffers); -/* - * Remove any clean buffers from the inode's buffer list. This is called - * when we're trying to free the inode itself. Those buffers can pin it. - * - * Returns true if all buffers were removed. - */ -int remove_inode_buffers(struct inode *inode) -{ - int ret = 1; - - if (inode_has_buffers(inode)) { - struct address_space *mapping = &inode->i_data; - struct list_head *list = &mapping->i_private_list; - struct address_space *buffer_mapping = mapping->i_private_data; - - spin_lock(&buffer_mapping->i_private_lock); - while (!list_empty(list)) { - struct buffer_head *bh = BH_ENTRY(list->next); - if (buffer_dirty(bh)) { - ret = 0; - break; - } - __remove_assoc_queue(bh); - } - spin_unlock(&buffer_mapping->i_private_lock); - } - return ret; -} - /* * Create the appropriate buffers when given a folio for data area and * the size of each buffer.. Use the bh->b_this_page linked list to diff --git a/fs/inode.c b/fs/inode.c index cc12b68e021b..4f98a5f04bbd 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -17,7 +17,6 @@ #include #include #include -#include /* for inode_has_buffers */ #include #include #include @@ -367,7 +366,6 @@ struct inode *alloc_inode(struct super_block *sb) void __destroy_inode(struct inode *inode) { - BUG_ON(inode_has_buffers(inode)); inode_detach_wb(inode); security_inode_free(inode); fsnotify_inode_delete(inode); @@ -994,19 +992,18 @@ static enum lru_status inode_lru_isolate(struct list_head *item, * page cache in order to free up struct inodes: lowmem might * be under pressure before the cache inside the highmem zone. */ - if (inode_has_buffers(inode) || !mapping_empty(&inode->i_data)) { + if (!mapping_empty(&inode->i_data)) { + unsigned long reap; + inode_pin_lru_isolating(inode); spin_unlock(&inode->i_lock); spin_unlock(&lru->lock); - if (remove_inode_buffers(inode)) { - unsigned long reap; - reap = invalidate_mapping_pages(&inode->i_data, 0, -1); - if (current_is_kswapd()) - __count_vm_events(KSWAPD_INODESTEAL, reap); - else - __count_vm_events(PGINODESTEAL, reap); - mm_account_reclaimed_pages(reap); - } + reap = invalidate_mapping_pages(&inode->i_data, 0, -1); + if (current_is_kswapd()) + __count_vm_events(KSWAPD_INODESTEAL, reap); + else + __count_vm_events(PGINODESTEAL, reap); + mm_account_reclaimed_pages(reap); inode_unpin_lru_isolating(inode); return LRU_RETRY; } diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index b16b88bfbc3e..631bf971efc0 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -517,7 +517,6 @@ void buffer_init(void); bool try_to_free_buffers(struct folio *folio); int inode_has_buffers(struct inode *inode); void invalidate_inode_buffers(struct inode *inode); -int remove_inode_buffers(struct inode *inode); int sync_mapping_buffers(struct address_space *mapping); void invalidate_bh_lrus(void); void invalidate_bh_lrus_cpu(void); @@ -528,9 +527,7 @@ extern int buffer_heads_over_limit; static inline void buffer_init(void) {} static inline bool try_to_free_buffers(struct folio *folio) { return true; } -static inline int inode_has_buffers(struct inode *inode) { return 0; } static inline void invalidate_inode_buffers(struct inode *inode) {} -static inline int remove_inode_buffers(struct inode *inode) { return 1; } static inline int sync_mapping_buffers(struct address_space *mapping) { return 0; } static inline void invalidate_bh_lrus(void) {} static inline void invalidate_bh_lrus_cpu(void) {} -- 2.51.0