Skip to contentSkip to conversation

use STORE_LOCKED instead of STORE macro

PATCH In review Dongbo Cao 2 participants 2 messages Sep 27, 2018 bcache (block layer cache)

lore
Share & tools
lore

Dongbo Cao

author
#0 lore raw

PATCH 1/1 use STORE_LOCKED instead of STORE macro

merge sysfs_writeback_running attr and sysfs_writeback_percent attr together with other attrs of cached_dev.

---
 drivers/md/bcache/sysfs.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
drivers/md/bcache/sysfs.c +2 -13
index 26f035a0..14fc9104 100644
@@ -245,7 +245,7 @@ SHOW(__bch_cached_dev)
 }
 SHOW_LOCKED(bch_cached_dev)
 
-STORE(__cached_dev)
+STORE(__bch_cached_dev)
 {
 	struct cached_dev *dc = container_of(kobj, struct cached_dev,
 					     disk.kobj);
@@ -373,17 +373,6 @@ STORE(__cached_dev)
 	if (attr == &sysfs_stop)
 		bcache_device_stop(&dc->disk);
 
-	return size;
-}
-
-STORE(bch_cached_dev)
-{
-	struct cached_dev *dc = container_of(kobj, struct cached_dev,
-					     disk.kobj);
-
-	mutex_lock(&bch_register_lock);
-	size = __cached_dev_store(kobj, attr, buf, size);
-
 	if (attr == &sysfs_writeback_running)
 		bch_writeback_queue(dc);
 
@@ -392,9 +381,9 @@ STORE(bch_cached_dev)
 			schedule_delayed_work(&dc->writeback_rate_update,
 				      dc->writeback_rate_update_seconds * HZ);
 
-	mutex_unlock(&bch_register_lock);
 	return size;
 }
+STORE_LOCKED(bch_cached_dev)
 
 static struct attribute *bch_cached_dev_files[] = {
 	&sysfs_attach,
Signature · 1 line
2.17.1
#1 lore raw
Quoted 3 lines · Dongbo Cao

merge sysfs_writeback_running attr and sysfs_writeback_percent attr together with other attrs of cached_dev.

Could you please to explain more what you want to do, and why you make this change?

Thanks.

Coly Li

Quoted 46 lines
---
  drivers/md/bcache/sysfs.c | 15 ++-------------
  1 file changed, 2 insertions(+), 13 deletions(-)
drivers/md/bcache/sysfs.c +2 -13
index 26f035a0..14fc9104 100644
@@ -245,7 +245,7 @@ SHOW(__bch_cached_dev)
  }
  SHOW_LOCKED(bch_cached_dev)
 
-STORE(__cached_dev)
+STORE(__bch_cached_dev)
  {
  	struct cached_dev *dc = container_of(kobj, struct cached_dev,
  					     disk.kobj);
@@ -373,17 +373,6 @@ STORE(__cached_dev)
  	if (attr == &sysfs_stop)
  		bcache_device_stop(&dc->disk);
 
-	return size;
-}
-
-STORE(bch_cached_dev)
-{
-	struct cached_dev *dc = container_of(kobj, struct cached_dev,
-					     disk.kobj);
-
-	mutex_lock(&bch_register_lock);
-	size = __cached_dev_store(kobj, attr, buf, size);
-
  	if (attr == &sysfs_writeback_running)
  		bch_writeback_queue(dc);
 
@@ -392,9 +381,9 @@ STORE(bch_cached_dev)
  			schedule_delayed_work(&dc->writeback_rate_update,
  				      dc->writeback_rate_update_seconds * HZ);
 
-	mutex_unlock(&bch_register_lock);
  	return size;
  }
+STORE_LOCKED(bch_cached_dev)
 
  static struct attribute *bch_cached_dev_files[] = {
  	&sysfs_attach,