From: Jan Kara Subject: [PATCH 12/14] writeback: Move refill of b_io list into writeback_inodes() Date: Fri, 1 Aug 2014 00:00:51 +0200 Message-ID: <1406844053-25982-13-git-send-email-jack@suse.cz> References: <1406844053-25982-1-git-send-email-jack@suse.cz> Cc: OGAWA Hirofumi , Wu Fengguang , Jan Kara To: linux-fsdevel@vger.kernel.org Return-path: Received: from cantor2.suse.de ([195.135.220.15]:42533 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751336AbaGaWBS (ORCPT ); Thu, 31 Jul 2014 18:01:18 -0400 In-Reply-To: <1406844053-25982-1-git-send-email-jack@suse.cz> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: The only place where we refill b_io is just before calling writeback_inodes() (and that function has only one call site). Move the refill into writeback_inodes(). This allows for easier separation when transitioning to per-sb dirty tracking. Signed-off-by: Jan Kara --- fs/fs-writeback.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index a3f37b128446..6caf55858dcb 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -563,7 +563,8 @@ static long writeback_chunk_size(struct backing_dev_info *bdi, } /* - * Write inodes in b_io list belonging to @work->sb (if set). + * Refill b_io list if needed and start writing inodes on that list belonging + * to @work->sb (if set). * * Return the number of pages and/or inodes written. */ @@ -584,6 +585,9 @@ static long writeback_inodes(struct bdi_writeback *wb, long write_chunk; long wrote = 0; /* count both pages and inodes */ + spin_lock(&wb->list_lock); + if (list_empty(&wb->b_io)) + queue_io(wb, work); while (!list_empty(&wb->b_io)) { struct inode *inode = wb_inode(wb->b_io.prev); @@ -668,6 +672,8 @@ static long writeback_inodes(struct bdi_writeback *wb, break; } } + spin_unlock(&wb->list_lock); + return wrote; } @@ -764,15 +770,10 @@ 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); - /* * Did we write something? Try for more * -- 1.8.1.4