bcache: remove the cache_dev_name field from struct cache

Just use the %pg format specifier to print the name directly.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Coly Li <colyli@suse.de>
Link: https://lore.kernel.org/r/20211020143812.6403-6-colyli@suse.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Christoph Hellwig 2021-10-20 22:38:09 +08:00 коммит произвёл Jens Axboe
Родитель 0259d4498b
Коммит 7e84c21507
3 изменённых файлов: 7 добавлений и 10 удалений

Просмотреть файл

@ -470,8 +470,6 @@ struct cache {
atomic_long_t meta_sectors_written;
atomic_long_t btree_sectors_written;
atomic_long_t sectors_written;
char cache_dev_name[BDEVNAME_SIZE];
};
struct gc_stat {

Просмотреть файл

@ -123,13 +123,13 @@ void bch_count_io_errors(struct cache *ca,
errors >>= IO_ERROR_SHIFT;
if (errors < ca->set->error_limit)
pr_err("%s: IO error on %s%s\n",
ca->cache_dev_name, m,
pr_err("%pg: IO error on %s%s\n",
ca->bdev, m,
is_read ? ", recovering." : ".");
else
bch_cache_set_error(ca->set,
"%s: too many IO errors %s\n",
ca->cache_dev_name, m);
"%pg: too many IO errors %s\n",
ca->bdev, m);
}
}

Просмотреть файл

@ -2338,7 +2338,7 @@ err_btree_alloc:
err_free:
module_put(THIS_MODULE);
if (err)
pr_notice("error %s: %s\n", ca->cache_dev_name, err);
pr_notice("error %pg: %s\n", ca->bdev, err);
return ret;
}
@ -2348,7 +2348,6 @@ static int register_cache(struct cache_sb *sb, struct cache_sb_disk *sb_disk,
const char *err = NULL; /* must be set for any error case */
int ret = 0;
bdevname(bdev, ca->cache_dev_name);
memcpy(&ca->sb, sb, sizeof(struct cache_sb));
ca->bdev = bdev;
ca->bdev->bd_holder = ca;
@ -2390,14 +2389,14 @@ static int register_cache(struct cache_sb *sb, struct cache_sb_disk *sb_disk,
goto out;
}
pr_info("registered cache device %s\n", ca->cache_dev_name);
pr_info("registered cache device %pg\n", ca->bdev);
out:
kobject_put(&ca->kobj);
err:
if (err)
pr_notice("error %s: %s\n", ca->cache_dev_name, err);
pr_notice("error %pg: %s\n", ca->bdev, err);
return ret;
}