summaryrefslogtreecommitdiffstats
path: root/fs/inode.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-02-25 11:13:26 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2011-02-25 11:13:26 -0800
commit638691a7a46a4ae9a7b56c603299e42d7f6e722e (patch)
treef744b3fbdd4704ef9ae122b67a14785b4a7a6b65 /fs/inode.c
parent0a93ea2e897bd793cc0aaaddc397eff32ac8d6fe (diff)
parentf0b4f7e2f29af678bd9af43422c537dcb6008603 (diff)
downloadlinux-638691a7a46a4ae9a7b56c603299e42d7f6e722e.tar.bz2
Merge branch 'for-linus' of git://neil.brown.name/md
* 'for-linus' of git://neil.brown.name/md: md: Fix - again - partition detection when array becomes active Fix over-zealous flush_disk when changing device size. md: avoid spinlock problem in blk_throtl_exit md: correctly handle probe of an 'mdp' device. md: don't set_capacity before array is active. md: Fix raid1->raid0 takeover
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)
/**
* invalidate_inodes - attempt to free all inodes on a superblock
* @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.
*/
-int invalidate_inodes(struct super_block *sb)
+int invalidate_inodes(struct super_block *sb, bool kill_dirty)
{
int busy = 0;
struct inode *inode, *next;
@@ -564,6 +567,10 @@ int invalidate_inodes(struct super_block *sb)
list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) {
if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE))
continue;
+ if (inode->i_state & I_DIRTY && !kill_dirty) {
+ busy = 1;
+ continue;
+ }
if (atomic_read(&inode->i_count)) {
busy = 1;
continue;