aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-09-23 13:32:26 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-09-25 12:08:25 -0400
commit71fd05a887e0f3f6bfff76ff81b33776177d0606 (patch)
tree74f03e70445425da3cd441392ad72232ab32eb5a
parentae1b7f7d4b9ea587fda95c38301f4e72e8146634 (diff)
writeback: improve readability of the wb_writeback() continue/break logic
And throw some comments in there, too. Reviewed-by: Wu Fengguang <fengguang.wu@intel.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--fs/fs-writeback.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 916e83489caa..15e375bf93e6 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -750,29 +750,32 @@ static long wb_writeback(struct bdi_writeback *wb,
750 wrote += MAX_WRITEBACK_PAGES - wbc.nr_to_write; 750 wrote += MAX_WRITEBACK_PAGES - wbc.nr_to_write;
751 751
752 /* 752 /*
753 * If we ran out of stuff to write, bail unless more_io got set 753 * If we consumed everything, see if we have more
754 */ 754 */
755 if (wbc.nr_to_write > 0) { 755 if (wbc.nr_to_write <= 0)
756 if (wbc.more_io) { 756 continue;
757 if (wbc.nr_to_write < MAX_WRITEBACK_PAGES) 757 /*
758 continue; 758 * Didn't write everything and we don't have more IO, bail
759 /* 759 */
760 * Nothing written. Wait for some inode to 760 if (!wbc.more_io)
761 * become available for writeback. Otherwise
762 * we'll just busyloop.
763 */
764 spin_lock(&inode_lock);
765 if (!list_empty(&wb->b_more_io)) {
766 inode = list_entry(
767 wb->b_more_io.prev,
768 struct inode, i_list);
769 inode_wait_for_writeback(inode);
770 }
771 spin_unlock(&inode_lock);
772 continue;
773 }
774 break; 761 break;
762 /*
763 * Did we write something? Try for more
764 */
765 if (wbc.nr_to_write < MAX_WRITEBACK_PAGES)
766 continue;
767 /*
768 * Nothing written. Wait for some inode to
769 * become available for writeback. Otherwise
770 * we'll just busyloop.
771 */
772 spin_lock(&inode_lock);
773 if (!list_empty(&wb->b_more_io)) {
774 inode = list_entry(wb->b_more_io.prev,
775 struct inode, i_list);
776 inode_wait_for_writeback(inode);
775 } 777 }
778 spin_unlock(&inode_lock);
776 } 779 }
777 780
778 return wrote; 781 return wrote;