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 9c2b795ccc93..0647d80accf6 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -548,11 +548,14 @@ void evict_inodes(struct super_block *sb)
548/** 548/**
549 * invalidate_inodes - attempt to free all inodes on a superblock 549 * invalidate_inodes - attempt to free all inodes on a superblock
550 * @sb: superblock to operate on 550 * @sb: superblock to operate on
551 * @kill_dirty: flag to guide handling of dirty inodes
551 * 552 *
552 * Attempts to free all inodes for a given superblock. If there were any 553 * Attempts to free all inodes for a given superblock. If there were any
553 * busy inodes return a non-zero value, else zero. 554 * busy inodes return a non-zero value, else zero.
555 * If @kill_dirty is set, discard dirty inodes too, otherwise treat
556 * them as busy.
554 */ 557 */
555int invalidate_inodes(struct super_block *sb) 558int invalidate_inodes(struct super_block *sb, bool kill_dirty)
556{ 559{
557 int busy = 0; 560 int busy = 0;
558 struct inode *inode, *next; 561 struct inode *inode, *next;
@@ -564,6 +567,10 @@ int invalidate_inodes(struct super_block *sb)
564 list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) { 567 list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) {
565 if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) 568 if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE))
566 continue; 569 continue;
570 if (inode->i_state & I_DIRTY && !kill_dirty) {
571 busy = 1;
572 continue;
573 }
567 if (atomic_read(&inode->i_count)) { 574 if (atomic_read(&inode->i_count)) {
568 busy = 1; 575 busy = 1;
569 continue; 576 continue;