[PATCH 17/17] fs: simplify invalidate_inodes
- To: Al Viro <viro@zeniv.linux.org.uk>, Christian Brauner <brauner@kernel.org>
- Cc: Jens Axboe <axboe@kernel.dk>, Denis Efremov <efremov@linux.com>, Josef Bacik <josef@toxicpanda.com>, Stefan Haberland <sth@linux.ibm.com>, Jan Hoeppner <hoeppner@linux.ibm.com>, Heiko Carstens <hca@linux.ibm.com>, Vasily Gorbik <gor@linux.ibm.com>, Alexander Gordeev <agordeev@linux.ibm.com>, "Darrick J . Wong" <djwong@kernel.org>, Chris Mason <clm@fb.com>, David Sterba <dsterba@suse.com>, linux-block@vger.kernel.org, nbd@other.debian.org, linux-s390@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
- Subject: [PATCH 17/17] fs: simplify invalidate_inodes
- From: Christoph Hellwig <hch@lst.de>
- Date: Fri, 11 Aug 2023 12:08:28 +0200
- Message-id: <[🔎] 20230811100828.1897174-18-hch@lst.de>
- In-reply-to: <[🔎] 20230811100828.1897174-1-hch@lst.de>
- References: <[🔎] 20230811100828.1897174-1-hch@lst.de>
kill_dirty has always been true for a long time, so hard code it and
remove the unused return value.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/inode.c | 16 ++--------------
fs/internal.h | 2 +-
fs/super.c | 2 +-
3 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/fs/inode.c b/fs/inode.c
index 8fefb69e1f84a9..fd67ca46415d50 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -754,14 +754,10 @@ EXPORT_SYMBOL_GPL(evict_inodes);
* @sb: superblock to operate on
* @kill_dirty: flag to guide handling of dirty inodes
*
- * Attempts to free all inodes for a given superblock. If there were any
- * busy inodes return a non-zero value, else zero.
- * If @kill_dirty is set, discard dirty inodes too, otherwise treat
- * them as busy.
+ * Attempts to free all inodes (including dirty inodes) for a given superblock.
*/
-int invalidate_inodes(struct super_block *sb, bool kill_dirty)
+void invalidate_inodes(struct super_block *sb)
{
- int busy = 0;
struct inode *inode, *next;
LIST_HEAD(dispose);
@@ -773,14 +769,8 @@ int invalidate_inodes(struct super_block *sb, bool kill_dirty)
spin_unlock(&inode->i_lock);
continue;
}
- if (inode->i_state & I_DIRTY_ALL && !kill_dirty) {
- spin_unlock(&inode->i_lock);
- busy = 1;
- continue;
- }
if (atomic_read(&inode->i_count)) {
spin_unlock(&inode->i_lock);
- busy = 1;
continue;
}
@@ -798,8 +788,6 @@ int invalidate_inodes(struct super_block *sb, bool kill_dirty)
spin_unlock(&sb->s_inode_list_lock);
dispose_list(&dispose);
-
- return busy;
}
/*
diff --git a/fs/internal.h b/fs/internal.h
index f7a3dc11102647..b94290f61714a0 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -201,7 +201,7 @@ void lock_two_inodes(struct inode *inode1, struct inode *inode2,
* fs-writeback.c
*/
extern long get_nr_dirty_inodes(void);
-extern int invalidate_inodes(struct super_block *, bool);
+void invalidate_inodes(struct super_block *sb);
/*
* dcache.c
diff --git a/fs/super.c b/fs/super.c
index d3d27ff009d5f6..500c5308f2c8a0 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1204,7 +1204,7 @@ static void fs_bdev_mark_dead(struct block_device *bdev, bool surprise)
if (!surprise)
sync_filesystem(sb);
shrink_dcache_sb(sb);
- invalidate_inodes(sb, true);
+ invalidate_inodes(sb);
if (sb->s_op->shutdown)
sb->s_op->shutdown(sb);
--
2.39.2
Reply to: