Commit e127b9bc authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Christian Brauner

fs: simplify invalidate_inodes

kill_dirty has always been true for a long time, so hard code it and
remove the unused return value.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarChristian Brauner <brauner@kernel.org>
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Message-Id: <20230811100828.1897174-18-hch@lst.de>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 38bcdd38
...@@ -752,16 +752,11 @@ EXPORT_SYMBOL_GPL(evict_inodes); ...@@ -752,16 +752,11 @@ EXPORT_SYMBOL_GPL(evict_inodes);
/** /**
* invalidate_inodes - attempt to free all inodes on a superblock * invalidate_inodes - attempt to free all inodes on a superblock
* @sb: superblock to operate on * @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 * Attempts to free all inodes (including dirty inodes) for a given superblock.
* busy inodes return a non-zero value, else zero.
* If @kill_dirty is set, discard dirty inodes too, otherwise treat
* them as busy.
*/ */
int invalidate_inodes(struct super_block *sb, bool kill_dirty) void invalidate_inodes(struct super_block *sb)
{ {
int busy = 0;
struct inode *inode, *next; struct inode *inode, *next;
LIST_HEAD(dispose); LIST_HEAD(dispose);
...@@ -773,14 +768,8 @@ int invalidate_inodes(struct super_block *sb, bool kill_dirty) ...@@ -773,14 +768,8 @@ int invalidate_inodes(struct super_block *sb, bool kill_dirty)
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
continue; continue;
} }
if (inode->i_state & I_DIRTY_ALL && !kill_dirty) {
spin_unlock(&inode->i_lock);
busy = 1;
continue;
}
if (atomic_read(&inode->i_count)) { if (atomic_read(&inode->i_count)) {
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
busy = 1;
continue; continue;
} }
...@@ -798,8 +787,6 @@ int invalidate_inodes(struct super_block *sb, bool kill_dirty) ...@@ -798,8 +787,6 @@ int invalidate_inodes(struct super_block *sb, bool kill_dirty)
spin_unlock(&sb->s_inode_list_lock); spin_unlock(&sb->s_inode_list_lock);
dispose_list(&dispose); dispose_list(&dispose);
return busy;
} }
/* /*
......
...@@ -201,7 +201,7 @@ void lock_two_inodes(struct inode *inode1, struct inode *inode2, ...@@ -201,7 +201,7 @@ void lock_two_inodes(struct inode *inode1, struct inode *inode2,
* fs-writeback.c * fs-writeback.c
*/ */
extern long get_nr_dirty_inodes(void); extern long get_nr_dirty_inodes(void);
extern int invalidate_inodes(struct super_block *, bool); void invalidate_inodes(struct super_block *sb);
/* /*
* dcache.c * dcache.c
......
...@@ -1204,7 +1204,7 @@ static void fs_bdev_mark_dead(struct block_device *bdev, bool surprise) ...@@ -1204,7 +1204,7 @@ static void fs_bdev_mark_dead(struct block_device *bdev, bool surprise)
if (!surprise) if (!surprise)
sync_filesystem(sb); sync_filesystem(sb);
shrink_dcache_sb(sb); shrink_dcache_sb(sb);
invalidate_inodes(sb, true); invalidate_inodes(sb);
if (sb->s_op->shutdown) if (sb->s_op->shutdown)
sb->s_op->shutdown(sb); sb->s_op->shutdown(sb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment