diff options
Diffstat (limited to 'fs/fs-writeback.c')
-rw-r--r-- | fs/fs-writeback.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 587ac08eabb6..091a36444972 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -1481,6 +1481,21 @@ static long writeback_sb_inodes(struct super_block *sb, | |||
1481 | wbc_detach_inode(&wbc); | 1481 | wbc_detach_inode(&wbc); |
1482 | work->nr_pages -= write_chunk - wbc.nr_to_write; | 1482 | work->nr_pages -= write_chunk - wbc.nr_to_write; |
1483 | wrote += write_chunk - wbc.nr_to_write; | 1483 | wrote += write_chunk - wbc.nr_to_write; |
1484 | |||
1485 | if (need_resched()) { | ||
1486 | /* | ||
1487 | * We're trying to balance between building up a nice | ||
1488 | * long list of IOs to improve our merge rate, and | ||
1489 | * getting those IOs out quickly for anyone throttling | ||
1490 | * in balance_dirty_pages(). cond_resched() doesn't | ||
1491 | * unplug, so get our IOs out the door before we | ||
1492 | * give up the CPU. | ||
1493 | */ | ||
1494 | blk_flush_plug(current); | ||
1495 | cond_resched(); | ||
1496 | } | ||
1497 | |||
1498 | |||
1484 | spin_lock(&wb->list_lock); | 1499 | spin_lock(&wb->list_lock); |
1485 | spin_lock(&inode->i_lock); | 1500 | spin_lock(&inode->i_lock); |
1486 | if (!(inode->i_state & I_DIRTY_ALL)) | 1501 | if (!(inode->i_state & I_DIRTY_ALL)) |
@@ -1488,7 +1503,7 @@ static long writeback_sb_inodes(struct super_block *sb, | |||
1488 | requeue_inode(inode, wb, &wbc); | 1503 | requeue_inode(inode, wb, &wbc); |
1489 | inode_sync_complete(inode); | 1504 | inode_sync_complete(inode); |
1490 | spin_unlock(&inode->i_lock); | 1505 | spin_unlock(&inode->i_lock); |
1491 | cond_resched_lock(&wb->list_lock); | 1506 | |
1492 | /* | 1507 | /* |
1493 | * bail out to wb_writeback() often enough to check | 1508 | * bail out to wb_writeback() often enough to check |
1494 | * background threshold and other termination conditions. | 1509 | * background threshold and other termination conditions. |