diff options
Diffstat (limited to 'fs/fs-writeback.c')
-rw-r--r-- | fs/fs-writeback.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 300324bd563c..c0076077d338 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -284,7 +284,17 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc) | |||
284 | * soon as the queue becomes uncongested. | 284 | * soon as the queue becomes uncongested. |
285 | */ | 285 | */ |
286 | inode->i_state |= I_DIRTY_PAGES; | 286 | inode->i_state |= I_DIRTY_PAGES; |
287 | requeue_io(inode); | 287 | if (wbc->nr_to_write <= 0) { |
288 | /* | ||
289 | * slice used up: queue for next turn | ||
290 | */ | ||
291 | requeue_io(inode); | ||
292 | } else { | ||
293 | /* | ||
294 | * somehow blocked: retry later | ||
295 | */ | ||
296 | redirty_tail(inode); | ||
297 | } | ||
288 | } else { | 298 | } else { |
289 | /* | 299 | /* |
290 | * Otherwise fully redirty the inode so that | 300 | * Otherwise fully redirty the inode so that |
@@ -334,9 +344,6 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc) | |||
334 | WARN_ON(inode->i_state & I_WILL_FREE); | 344 | WARN_ON(inode->i_state & I_WILL_FREE); |
335 | 345 | ||
336 | if ((wbc->sync_mode != WB_SYNC_ALL) && (inode->i_state & I_SYNC)) { | 346 | if ((wbc->sync_mode != WB_SYNC_ALL) && (inode->i_state & I_SYNC)) { |
337 | struct address_space *mapping = inode->i_mapping; | ||
338 | int ret; | ||
339 | |||
340 | /* | 347 | /* |
341 | * We're skipping this inode because it's locked, and we're not | 348 | * We're skipping this inode because it's locked, and we're not |
342 | * doing writeback-for-data-integrity. Move it to s_more_io so | 349 | * doing writeback-for-data-integrity. Move it to s_more_io so |
@@ -345,15 +352,7 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc) | |||
345 | * completed a full scan of s_io. | 352 | * completed a full scan of s_io. |
346 | */ | 353 | */ |
347 | requeue_io(inode); | 354 | requeue_io(inode); |
348 | 355 | return 0; | |
349 | /* | ||
350 | * Even if we don't actually write the inode itself here, | ||
351 | * we can at least start some of the data writeout.. | ||
352 | */ | ||
353 | spin_unlock(&inode_lock); | ||
354 | ret = do_writepages(mapping, wbc); | ||
355 | spin_lock(&inode_lock); | ||
356 | return ret; | ||
357 | } | 356 | } |
358 | 357 | ||
359 | /* | 358 | /* |
@@ -479,8 +478,12 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc) | |||
479 | iput(inode); | 478 | iput(inode); |
480 | cond_resched(); | 479 | cond_resched(); |
481 | spin_lock(&inode_lock); | 480 | spin_lock(&inode_lock); |
482 | if (wbc->nr_to_write <= 0) | 481 | if (wbc->nr_to_write <= 0) { |
482 | wbc->more_io = 1; | ||
483 | break; | 483 | break; |
484 | } | ||
485 | if (!list_empty(&sb->s_more_io)) | ||
486 | wbc->more_io = 1; | ||
484 | } | 487 | } |
485 | return; /* Leave any unwritten inodes on s_io */ | 488 | return; /* Leave any unwritten inodes on s_io */ |
486 | } | 489 | } |
@@ -512,8 +515,7 @@ writeback_inodes(struct writeback_control *wbc) | |||
512 | might_sleep(); | 515 | might_sleep(); |
513 | spin_lock(&sb_lock); | 516 | spin_lock(&sb_lock); |
514 | restart: | 517 | restart: |
515 | sb = sb_entry(super_blocks.prev); | 518 | list_for_each_entry_reverse(sb, &super_blocks, s_list) { |
516 | for (; sb != sb_entry(&super_blocks); sb = sb_entry(sb->s_list.prev)) { | ||
517 | if (sb_has_dirty_inodes(sb)) { | 519 | if (sb_has_dirty_inodes(sb)) { |
518 | /* we're making our own get_super here */ | 520 | /* we're making our own get_super here */ |
519 | sb->s_count++; | 521 | sb->s_count++; |
@@ -578,10 +580,8 @@ static void set_sb_syncing(int val) | |||
578 | { | 580 | { |
579 | struct super_block *sb; | 581 | struct super_block *sb; |
580 | spin_lock(&sb_lock); | 582 | spin_lock(&sb_lock); |
581 | sb = sb_entry(super_blocks.prev); | 583 | list_for_each_entry_reverse(sb, &super_blocks, s_list) |
582 | for (; sb != sb_entry(&super_blocks); sb = sb_entry(sb->s_list.prev)) { | ||
583 | sb->s_syncing = val; | 584 | sb->s_syncing = val; |
584 | } | ||
585 | spin_unlock(&sb_lock); | 585 | spin_unlock(&sb_lock); |
586 | } | 586 | } |
587 | 587 | ||
@@ -655,7 +655,7 @@ int write_inode_now(struct inode *inode, int sync) | |||
655 | int ret; | 655 | int ret; |
656 | struct writeback_control wbc = { | 656 | struct writeback_control wbc = { |
657 | .nr_to_write = LONG_MAX, | 657 | .nr_to_write = LONG_MAX, |
658 | .sync_mode = WB_SYNC_ALL, | 658 | .sync_mode = sync ? WB_SYNC_ALL : WB_SYNC_NONE, |
659 | .range_start = 0, | 659 | .range_start = 0, |
660 | .range_end = LLONG_MAX, | 660 | .range_end = LLONG_MAX, |
661 | }; | 661 | }; |