diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2009-09-23 19:32:26 +0200 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-09-25 18:08:25 +0200 |
commit | 71fd05a887e0f3f6bfff76ff81b33776177d0606 (patch) | |
tree | 74f03e70445425da3cd441392ad72232ab32eb5a /fs/fs-writeback.c | |
parent | ae1b7f7d4b9ea587fda95c38301f4e72e8146634 (diff) | |
download | talos-op-linux-71fd05a887e0f3f6bfff76ff81b33776177d0606.tar.gz talos-op-linux-71fd05a887e0f3f6bfff76ff81b33776177d0606.zip |
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>
Diffstat (limited to 'fs/fs-writeback.c')
-rw-r--r-- | fs/fs-writeback.c | 43 |
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, wrote += MAX_WRITEBACK_PAGES - wbc.nr_to_write; /* - * If we ran out of stuff to write, bail unless more_io got set + * If we consumed everything, see if we have more */ - if (wbc.nr_to_write > 0) { - if (wbc.more_io) { - if (wbc.nr_to_write < MAX_WRITEBACK_PAGES) - continue; - /* - * Nothing written. Wait for some inode to - * become available for writeback. Otherwise - * we'll just busyloop. - */ - spin_lock(&inode_lock); - if (!list_empty(&wb->b_more_io)) { - inode = list_entry( - wb->b_more_io.prev, - struct inode, i_list); - inode_wait_for_writeback(inode); - } - spin_unlock(&inode_lock); - continue; - } + if (wbc.nr_to_write <= 0) + continue; + /* + * Didn't write everything and we don't have more IO, bail + */ + if (!wbc.more_io) break; + /* + * Did we write something? Try for more + */ + if (wbc.nr_to_write < MAX_WRITEBACK_PAGES) + continue; + /* + * Nothing written. Wait for some inode to + * become available for writeback. Otherwise + * we'll just busyloop. + */ + spin_lock(&inode_lock); + if (!list_empty(&wb->b_more_io)) { + inode = list_entry(wb->b_more_io.prev, + struct inode, i_list); + inode_wait_for_writeback(inode); } + spin_unlock(&inode_lock); } return wrote; |