[PATCH 11/14] writeback: Shorten list_lock hold times in bdi_writeback()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux