All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] use STORE_LOCKED instead of STORE macro
@ 2018-09-27  5:31 Dongbo Cao
  2018-09-27 15:44 ` Coly Li
  0 siblings, 1 reply; 2+ messages in thread
From: Dongbo Cao @ 2018-09-27  5:31 UTC (permalink / raw)
  To: colyli; +Cc: kent.overstreet, linux-bcache, linux-kernel, Dongbo Cao

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

Signed-off-by: Dongbo Cao <cdbdyx@163.com>
---
 drivers/md/bcache/sysfs.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
index 26f035a0..14fc9104 100644
--- a/drivers/md/bcache/sysfs.c
+++ b/drivers/md/bcache/sysfs.c
@@ -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,
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] use STORE_LOCKED instead of STORE macro
  2018-09-27  5:31 [PATCH] use STORE_LOCKED instead of STORE macro Dongbo Cao
@ 2018-09-27 15:44 ` Coly Li
  0 siblings, 0 replies; 2+ messages in thread
From: Coly Li @ 2018-09-27 15:44 UTC (permalink / raw)
  To: Dongbo Cao; +Cc: kent.overstreet, linux-bcache, linux-kernel


On 9/27/18 1:31 PM, Dongbo Cao wrote:
> merge sysfs_writeback_running attr and sysfs_writeback_percent attr together with other attrs of cached_dev.
>
> Signed-off-by: Dongbo Cao <cdbdyx@163.com>

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

Thanks.


Coly Li

> ---
>   drivers/md/bcache/sysfs.c | 15 ++-------------
>   1 file changed, 2 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
> index 26f035a0..14fc9104 100644
> --- a/drivers/md/bcache/sysfs.c
> +++ b/drivers/md/bcache/sysfs.c
> @@ -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,

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-09-27 15:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-27  5:31 [PATCH] use STORE_LOCKED instead of STORE macro Dongbo Cao
2018-09-27 15:44 ` Coly Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.