Commit 71fd05a8 authored by Jens Axboe's avatar Jens Axboe

writeback: improve readability of the wb_writeback() continue/break logic

And throw some comments in there, too.
Reviewed-by: default avatarWu Fengguang <fengguang.wu@intel.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent ae1b7f7d
...@@ -750,10 +750,18 @@ static long wb_writeback(struct bdi_writeback *wb, ...@@ -750,10 +750,18 @@ static long wb_writeback(struct bdi_writeback *wb,
wrote += MAX_WRITEBACK_PAGES - wbc.nr_to_write; 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)
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 > 0) {
if (wbc.more_io) {
if (wbc.nr_to_write < MAX_WRITEBACK_PAGES) if (wbc.nr_to_write < MAX_WRITEBACK_PAGES)
continue; continue;
/* /*
...@@ -763,16 +771,11 @@ static long wb_writeback(struct bdi_writeback *wb, ...@@ -763,16 +771,11 @@ static long wb_writeback(struct bdi_writeback *wb,
*/ */
spin_lock(&inode_lock); spin_lock(&inode_lock);
if (!list_empty(&wb->b_more_io)) { if (!list_empty(&wb->b_more_io)) {
inode = list_entry( inode = list_entry(wb->b_more_io.prev,
wb->b_more_io.prev,
struct inode, i_list); struct inode, i_list);
inode_wait_for_writeback(inode); inode_wait_for_writeback(inode);
} }
spin_unlock(&inode_lock); spin_unlock(&inode_lock);
continue;
}
break;
}
} }
return wrote; return wrote;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment