Skip to contentSkip to conversation

bcache: remove return value from bch_cached_dev_error

PATCH In review Zhang Zhen 2 participants 2 messages Feb 27, 2023 1 message not in the archive bcache (block layer cache)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Zhang Zhen

author
#1 lore raw

PATCH 1/1 bcache: remove return value from bch_cached_dev_error

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

---
 drivers/md/bcache/bcache.h | 2 +-
 drivers/md/bcache/super.c  | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/md/bcache/bcache.h +1 -1
index aebb7ef10e63..ff175a2fb2f0 100644
@@ -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, ...);
drivers/md/bcache/super.c +2 -2
index ba3909bb6bea..9923bb5c4fbe 100644
@@ -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 */
Signature · 1 line
2.27.0
#2 lore raw
Quoted 4 lines · Zhang Zhen

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

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

Coly Li

Quoted 43 lines
---
 drivers/md/bcache/bcache.h | 2 +-
 drivers/md/bcache/super.c  | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/md/bcache/bcache.h +1 -1
index aebb7ef10e63..ff175a2fb2f0 100644
@@ -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, ...);
drivers/md/bcache/super.c +2 -2
index ba3909bb6bea..9923bb5c4fbe 100644
@@ -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 */
Signature · 1 line
2.27.0
Signature · 1 line
Coly Li