diff options
Diffstat (limited to 'fs/fs-writeback.c')
-rw-r--r-- | fs/fs-writeback.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index ae45f77765c0..25adfc3c693a 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -424,8 +424,6 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc) | |||
424 | * WB_SYNC_HOLD is a hack for sys_sync(): reattach the inode to sb->s_dirty so | 424 | * WB_SYNC_HOLD is a hack for sys_sync(): reattach the inode to sb->s_dirty so |
425 | * that it can be located for waiting on in __writeback_single_inode(). | 425 | * that it can be located for waiting on in __writeback_single_inode(). |
426 | * | 426 | * |
427 | * Called under inode_lock. | ||
428 | * | ||
429 | * If `bdi' is non-zero then we're being asked to writeback a specific queue. | 427 | * If `bdi' is non-zero then we're being asked to writeback a specific queue. |
430 | * This function assumes that the blockdev superblock's inodes are backed by | 428 | * This function assumes that the blockdev superblock's inodes are backed by |
431 | * a variety of queues, so all inodes are searched. For other superblocks, | 429 | * a variety of queues, so all inodes are searched. For other superblocks, |
@@ -441,11 +439,12 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc) | |||
441 | * on the writer throttling path, and we get decent balancing between many | 439 | * on the writer throttling path, and we get decent balancing between many |
442 | * throttled threads: we don't want them all piling up on inode_sync_wait. | 440 | * throttled threads: we don't want them all piling up on inode_sync_wait. |
443 | */ | 441 | */ |
444 | static void | 442 | void generic_sync_sb_inodes(struct super_block *sb, |
445 | sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc) | 443 | struct writeback_control *wbc) |
446 | { | 444 | { |
447 | const unsigned long start = jiffies; /* livelock avoidance */ | 445 | const unsigned long start = jiffies; /* livelock avoidance */ |
448 | 446 | ||
447 | spin_lock(&inode_lock); | ||
449 | if (!wbc->for_kupdate || list_empty(&sb->s_io)) | 448 | if (!wbc->for_kupdate || list_empty(&sb->s_io)) |
450 | queue_io(sb, wbc->older_than_this); | 449 | queue_io(sb, wbc->older_than_this); |
451 | 450 | ||
@@ -524,8 +523,16 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc) | |||
524 | if (!list_empty(&sb->s_more_io)) | 523 | if (!list_empty(&sb->s_more_io)) |
525 | wbc->more_io = 1; | 524 | wbc->more_io = 1; |
526 | } | 525 | } |
526 | spin_unlock(&inode_lock); | ||
527 | return; /* Leave any unwritten inodes on s_io */ | 527 | return; /* Leave any unwritten inodes on s_io */ |
528 | } | 528 | } |
529 | EXPORT_SYMBOL_GPL(generic_sync_sb_inodes); | ||
530 | |||
531 | static void sync_sb_inodes(struct super_block *sb, | ||
532 | struct writeback_control *wbc) | ||
533 | { | ||
534 | generic_sync_sb_inodes(sb, wbc); | ||
535 | } | ||
529 | 536 | ||
530 | /* | 537 | /* |
531 | * Start writeback of dirty pagecache data against all unlocked inodes. | 538 | * Start writeback of dirty pagecache data against all unlocked inodes. |
@@ -565,11 +572,8 @@ restart: | |||
565 | * be unmounted by the time it is released. | 572 | * be unmounted by the time it is released. |
566 | */ | 573 | */ |
567 | if (down_read_trylock(&sb->s_umount)) { | 574 | if (down_read_trylock(&sb->s_umount)) { |
568 | if (sb->s_root) { | 575 | if (sb->s_root) |
569 | spin_lock(&inode_lock); | ||
570 | sync_sb_inodes(sb, wbc); | 576 | sync_sb_inodes(sb, wbc); |
571 | spin_unlock(&inode_lock); | ||
572 | } | ||
573 | up_read(&sb->s_umount); | 577 | up_read(&sb->s_umount); |
574 | } | 578 | } |
575 | spin_lock(&sb_lock); | 579 | spin_lock(&sb_lock); |
@@ -607,9 +611,7 @@ void sync_inodes_sb(struct super_block *sb, int wait) | |||
607 | (inodes_stat.nr_inodes - inodes_stat.nr_unused) + | 611 | (inodes_stat.nr_inodes - inodes_stat.nr_unused) + |
608 | nr_dirty + nr_unstable; | 612 | nr_dirty + nr_unstable; |
609 | wbc.nr_to_write += wbc.nr_to_write / 2; /* Bit more for luck */ | 613 | wbc.nr_to_write += wbc.nr_to_write / 2; /* Bit more for luck */ |
610 | spin_lock(&inode_lock); | ||
611 | sync_sb_inodes(sb, &wbc); | 614 | sync_sb_inodes(sb, &wbc); |
612 | spin_unlock(&inode_lock); | ||
613 | } | 615 | } |
614 | 616 | ||
615 | /* | 617 | /* |