[PATCH 19/20] bcache: remove a superflous lookup_bdev all
Coly Li
colyli at suse.de
Wed Nov 18 03:54:51 EST 2020
On 11/18/20 4:47 PM, Christoph Hellwig wrote:
> Don't bother to call lookup_bdev for just a slightly different error
> message without any functional change.
>
> Signed-off-by: Christoph Hellwig <hch at lst.de>ist
Hi Christoph,
NACK. This removing error message is frequently triggered and observed,
and distinct a busy device and an already registered device is important
(the first one is critical error and second one is not).
Remove such error message will be a functional regression.
Coly Li
> ---
> drivers/md/bcache/super.c | 44 +--------------------------------------
> 1 file changed, 1 insertion(+), 43 deletions(-)
>
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index e5db2cdd114112..5c531ed7785280 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -2380,40 +2380,6 @@ kobj_attribute_write(register, register_bcache);
> kobj_attribute_write(register_quiet, register_bcache);
> kobj_attribute_write(pendings_cleanup, bch_pending_bdevs_cleanup);
>
> -static bool bch_is_open_backing(struct block_device *bdev)
> -{
> - struct cache_set *c, *tc;
> - struct cached_dev *dc, *t;
> -
> - list_for_each_entry_safe(c, tc, &bch_cache_sets, list)
> - list_for_each_entry_safe(dc, t, &c->cached_devs, list)
> - if (dc->bdev == bdev)
> - return true;
> - list_for_each_entry_safe(dc, t, &uncached_devices, list)
> - if (dc->bdev == bdev)
> - return true;
> - return false;
> -}
> -
> -static bool bch_is_open_cache(struct block_device *bdev)
> -{
> - struct cache_set *c, *tc;
> -
> - list_for_each_entry_safe(c, tc, &bch_cache_sets, list) {
> - struct cache *ca = c->cache;
> -
> - if (ca->bdev == bdev)
> - return true;
> - }
> -
> - return false;
> -}
> -
> -static bool bch_is_open(struct block_device *bdev)
> -{
> - return bch_is_open_cache(bdev) || bch_is_open_backing(bdev);
> -}
> -
> struct async_reg_args {
> struct delayed_work reg_work;
> char *path;
> @@ -2535,15 +2501,7 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,
> sb);
> if (IS_ERR(bdev)) {
> if (bdev == ERR_PTR(-EBUSY)) {
> - bdev = lookup_bdev(strim(path));
> - mutex_lock(&bch_register_lock);
> - if (!IS_ERR(bdev) && bch_is_open(bdev))
> - err = "device already registered";
> - else
> - err = "device busy";
> - mutex_unlock(&bch_register_lock);
> - if (!IS_ERR(bdev))
> - bdput(bdev);
> + err = "device busy";
> if (attr == &ksysfs_register_quiet)
> goto done;
> }
>
More information about the linux-mtd
mailing list