Linux bcache driver list
 help / color / mirror / Atom feed
* [PATCH] bcache: remove return value from bch_cached_dev_error
       [not found] <20230227124132.1925274-1-zhangzhen15@kuaishou.com>
@ 2023-02-27 12:44 ` Zhang Zhen
  2023-02-27 13:52   ` Coly Li
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang Zhen @ 2023-02-27 12:44 UTC (permalink / raw)
  To: linux-bcache, Coly Li

The only caller of bch_cached_dev_error does not check the return
value. We can make it a void function.

Signed-off-by: Zhen Zhang <zhangzhen15@kuaishou.com>
---
  drivers/md/bcache/bcache.h | 2 +-
  drivers/md/bcache/super.c  | 5 ++---
  2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h
index aebb7ef10e63..ff175a2fb2f0 100644
--- a/drivers/md/bcache/bcache.h
+++ b/drivers/md/bcache/bcache.h
@@ -990,7 +990,7 @@ int bch_bucket_alloc_set(struct cache_set *c, 
unsigned int reserve,
  bool bch_alloc_sectors(struct cache_set *c, struct bkey *k,
  		       unsigned int sectors, unsigned int write_point,
  		       unsigned int write_prio, bool wait);
-bool bch_cached_dev_error(struct cached_dev *dc);
+void bch_cached_dev_error(struct cached_dev *dc);
   __printf(2, 3)
  bool bch_cache_set_error(struct cache_set *c, const char *fmt, ...);
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index ba3909bb6bea..9923bb5c4fbe 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1607,10 +1607,10 @@ int bch_flash_dev_create(struct cache_set *c, 
uint64_t size)
  	return flash_dev_run(c, u);
  }
  -bool bch_cached_dev_error(struct cached_dev *dc)
+void bch_cached_dev_error(struct cached_dev *dc)
  {
  	if (!dc || test_bit(BCACHE_DEV_CLOSING, &dc->disk.flags))
-		return false;
+		return;
   	dc->io_disable = true;
  	/* make others know io_disable is true earlier */
@@ -1620,7 +1620,6 @@ bool bch_cached_dev_error(struct cached_dev *dc)
  	       dc->disk.disk->disk_name, dc->bdev);
   	bcache_device_stop(&dc->disk);
-	return true;
  }
   /* Cache set */
-- 
2.27.0


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

* Re: [PATCH] bcache: remove return value from bch_cached_dev_error
  2023-02-27 12:44 ` [PATCH] bcache: remove return value from bch_cached_dev_error Zhang Zhen
@ 2023-02-27 13:52   ` Coly Li
  0 siblings, 0 replies; 2+ messages in thread
From: Coly Li @ 2023-02-27 13:52 UTC (permalink / raw)
  To: Zhang Zhen; +Cc: linux-bcache

On Mon, Feb 27, 2023 at 08:44:33PM +0800, Zhang Zhen wrote:
> The only caller of bch_cached_dev_error does not check the return
> value. We can make it a void function.
> 
> Signed-off-by: Zhen Zhang <zhangzhen15@kuaishou.com>

NACK. I prefer to have the return values for different conditions,
even they are not used for now.

Coly Li

> ---
>  drivers/md/bcache/bcache.h | 2 +-
>  drivers/md/bcache/super.c  | 5 ++---
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h
> index aebb7ef10e63..ff175a2fb2f0 100644
> --- a/drivers/md/bcache/bcache.h
> +++ b/drivers/md/bcache/bcache.h
> @@ -990,7 +990,7 @@ int bch_bucket_alloc_set(struct cache_set *c, unsigned
> int reserve,
>  bool bch_alloc_sectors(struct cache_set *c, struct bkey *k,
>  		       unsigned int sectors, unsigned int write_point,
>  		       unsigned int write_prio, bool wait);
> -bool bch_cached_dev_error(struct cached_dev *dc);
> +void bch_cached_dev_error(struct cached_dev *dc);
>   __printf(2, 3)
>  bool bch_cache_set_error(struct cache_set *c, const char *fmt, ...);
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index ba3909bb6bea..9923bb5c4fbe 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -1607,10 +1607,10 @@ int bch_flash_dev_create(struct cache_set *c,
> uint64_t size)
>  	return flash_dev_run(c, u);
>  }
>  -bool bch_cached_dev_error(struct cached_dev *dc)
> +void bch_cached_dev_error(struct cached_dev *dc)
>  {
>  	if (!dc || test_bit(BCACHE_DEV_CLOSING, &dc->disk.flags))
> -		return false;
> +		return;
>   	dc->io_disable = true;
>  	/* make others know io_disable is true earlier */
> @@ -1620,7 +1620,6 @@ bool bch_cached_dev_error(struct cached_dev *dc)
>  	       dc->disk.disk->disk_name, dc->bdev);
>   	bcache_device_stop(&dc->disk);
> -	return true;
>  }
>   /* Cache set */
> -- 
> 2.27.0
> 

-- 
Coly Li

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

end of thread, other threads:[~2023-02-27 13:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230227124132.1925274-1-zhangzhen15@kuaishou.com>
2023-02-27 12:44 ` [PATCH] bcache: remove return value from bch_cached_dev_error Zhang Zhen
2023-02-27 13:52   ` Coly Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox