aboutsummaryrefslogtreecommitdiffstats
path: root/fs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/inode.c')
-rw-r--r--fs/inode.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/inode.c b/fs/inode.c
index da85e56378f3..c50d7feb87b1 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -540,11 +540,14 @@ void evict_inodes(struct super_block *sb)
540/** 540/**
541 * invalidate_inodes - attempt to free all inodes on a superblock 541 * invalidate_inodes - attempt to free all inodes on a superblock
542 * @sb: superblock to operate on 542 * @sb: superblock to operate on
543 * @kill_dirty: flag to guide handling of dirty inodes
543 * 544 *
544 * Attempts to free all inodes for a given superblock. If there were any 545 * Attempts to free all inodes for a given superblock. If there were any
545 * busy inodes return a non-zero value, else zero. 546 * busy inodes return a non-zero value, else zero.
547 * If @kill_dirty is set, discard dirty inodes too, otherwise treat
548 * them as busy.
546 */ 549 */
547int invalidate_inodes(struct super_block *sb) 550int invalidate_inodes(struct super_block *sb, bool kill_dirty)
548{ 551{
549 int busy = 0; 552 int busy = 0;
550 struct inode *inode, *next; 553 struct inode *inode, *next;
@@ -556,6 +559,10 @@ int invalidate_inodes(struct super_block *sb)
556 list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) { 559 list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) {
557 if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) 560 if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE))
558 continue; 561 continue;
562 if (inode->i_state & I_DIRTY && !kill_dirty) {
563 busy = 1;
564 continue;
565 }
559 if (atomic_read(&inode->i_count)) { 566 if (atomic_read(&inode->i_count)) {
560 busy = 1; 567 busy = 1;
561 continue; 568 continue;