[PATCH 06/14] writeback: Switch locking of bandwidth fields to wb_lock

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

 



Currently updates of bandwidth and ratelimit fields in backing_dev_info
is protected by bdi->wb.list_lock. Since that will transition to a
per-sb lock, make those fields protected by bdi->wb_lock.

Signed-off-by: Jan Kara <jack@xxxxxxx>
---
 fs/fs-writeback.c           | 6 +++++-
 include/linux/backing-dev.h | 3 ++-
 mm/page-writeback.c         | 4 ++--
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 47d106ae4879..4bf1db730b40 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -695,7 +695,11 @@ static bool over_bground_thresh(struct backing_dev_info *bdi)
 static void wb_update_bandwidth(struct bdi_writeback *wb,
 				unsigned long start_time)
 {
-	__bdi_update_bandwidth(wb->bdi, 0, 0, 0, 0, 0, start_time);
+	struct backing_dev_info *bdi = wb->bdi;
+ 
+	spin_lock_bh(&bdi->wb_lock);
+	__bdi_update_bandwidth(bdi, 0, 0, 0, 0, 0, start_time);
+	spin_unlock_bh(&bdi->wb_lock);
 }
 
 /*
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 420750f5ed10..87096947af68 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -95,7 +95,8 @@ struct backing_dev_info {
 	struct delayed_work dwork;	/* work item used for writeback */
 
 	struct bdi_writeback wb;  /* default writeback info for this bdi */
-	spinlock_t wb_lock;	  /* protects work_list & wb.dwork scheduling */
+	spinlock_t wb_lock;	  /* protects work_list & wb.dwork scheduling,
+				     updates of bandwidth & ratelimit */
 
 	struct list_head work_list;
 
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 518e2c3f4c75..a0b4776f2bd1 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -1164,10 +1164,10 @@ static void bdi_update_bandwidth(struct backing_dev_info *bdi,
 {
 	if (time_is_after_eq_jiffies(bdi->bw_time_stamp + BANDWIDTH_INTERVAL))
 		return;
-	spin_lock(&bdi->wb.list_lock);
+	spin_lock_bh(&bdi->wb_lock);
 	__bdi_update_bandwidth(bdi, thresh, bg_thresh, dirty,
 			       bdi_thresh, bdi_dirty, start_time);
-	spin_unlock(&bdi->wb.list_lock);
+	spin_unlock_bh(&bdi->wb_lock);
 }
 
 /*
-- 
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