We unnecessarily hold wb->list_lock when checking various conditions in bdi_writeback(). Move list_lock inside only around the place where we really need it. This will also make transition to per-sb dirty tracking easier. Signed-off-by: Jan Kara <jack@xxxxxxx> --- fs/fs-writeback.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 149f8b35bab2..a3f37b128446 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -727,7 +727,6 @@ static long bdi_writeback(struct backing_dev_info *bdi, oldest_jif = jiffies; work->older_than_this = &oldest_jif; - spin_lock(&wb->list_lock); for (;;) { /* * Stop writeback when nr_pages has been consumed @@ -765,9 +764,11 @@ static long bdi_writeback(struct backing_dev_info *bdi, oldest_jif = jiffies; trace_writeback_start(bdi, work); + spin_lock(&wb->list_lock); if (list_empty(&wb->b_io)) queue_io(wb, work); progress = writeback_inodes(wb, work); + spin_unlock(&wb->list_lock); trace_writeback_written(bdi, work); update_bandwidth(bdi, wb_start); @@ -788,7 +789,6 @@ static long bdi_writeback(struct backing_dev_info *bdi, if (list_empty(&wb->b_more_io)) break; } - spin_unlock(&wb->list_lock); return nr_pages - work->nr_pages; } -- 1.8.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html