Skip to content

Commit e127b9b

Browse files
Christoph Hellwigbrauner
authored andcommitted
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: Christoph Hellwig <[email protected]> Reviewed-by: Christian Brauner <[email protected]> Reviewed-by: Josef Bacik <[email protected]> Message-Id: <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 38bcdd3 commit e127b9b

File tree

3 files changed

+4
-17
lines changed

3 files changed

+4
-17
lines changed

fs/inode.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -752,16 +752,11 @@ EXPORT_SYMBOL_GPL(evict_inodes);
752752
/**
753753
* invalidate_inodes - attempt to free all inodes on a superblock
754754
* @sb: superblock to operate on
755-
* @kill_dirty: flag to guide handling of dirty inodes
756755
*
757-
* Attempts to free all inodes for a given superblock. If there were any
758-
* busy inodes return a non-zero value, else zero.
759-
* If @kill_dirty is set, discard dirty inodes too, otherwise treat
760-
* them as busy.
756+
* Attempts to free all inodes (including dirty inodes) for a given superblock.
761757
*/
762-
int invalidate_inodes(struct super_block *sb, bool kill_dirty)
758+
void invalidate_inodes(struct super_block *sb)
763759
{
764-
int busy = 0;
765760
struct inode *inode, *next;
766761
LIST_HEAD(dispose);
767762

@@ -773,14 +768,8 @@ int invalidate_inodes(struct super_block *sb, bool kill_dirty)
773768
spin_unlock(&inode->i_lock);
774769
continue;
775770
}
776-
if (inode->i_state & I_DIRTY_ALL && !kill_dirty) {
777-
spin_unlock(&inode->i_lock);
778-
busy = 1;
779-
continue;
780-
}
781771
if (atomic_read(&inode->i_count)) {
782772
spin_unlock(&inode->i_lock);
783-
busy = 1;
784773
continue;
785774
}
786775

@@ -798,8 +787,6 @@ int invalidate_inodes(struct super_block *sb, bool kill_dirty)
798787
spin_unlock(&sb->s_inode_list_lock);
799788

800789
dispose_list(&dispose);
801-
802-
return busy;
803790
}
804791

805792
/*

fs/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ void lock_two_inodes(struct inode *inode1, struct inode *inode2,
201201
* fs-writeback.c
202202
*/
203203
extern long get_nr_dirty_inodes(void);
204-
extern int invalidate_inodes(struct super_block *, bool);
204+
void invalidate_inodes(struct super_block *sb);
205205

206206
/*
207207
* dcache.c

fs/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,7 @@ static void fs_bdev_mark_dead(struct block_device *bdev, bool surprise)
12041204
if (!surprise)
12051205
sync_filesystem(sb);
12061206
shrink_dcache_sb(sb);
1207-
invalidate_inodes(sb, true);
1207+
invalidate_inodes(sb);
12081208
if (sb->s_op->shutdown)
12091209
sb->s_op->shutdown(sb);
12101210

0 commit comments

Comments
 (0)