forked from Minki/linux
dm: stop using bdevname
Just use the %pg format specifier instead. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
This commit is contained in:
parent
977ff73e64
commit
385411ffba
@ -2015,7 +2015,6 @@ static int parse_metadata_dev(struct cache_args *ca, struct dm_arg_set *as,
|
||||
{
|
||||
int r;
|
||||
sector_t metadata_dev_size;
|
||||
char b[BDEVNAME_SIZE];
|
||||
|
||||
if (!at_least_one_arg(as, error))
|
||||
return -EINVAL;
|
||||
@ -2029,8 +2028,8 @@ static int parse_metadata_dev(struct cache_args *ca, struct dm_arg_set *as,
|
||||
|
||||
metadata_dev_size = get_dev_size(ca->metadata_dev);
|
||||
if (metadata_dev_size > DM_CACHE_METADATA_MAX_SECTORS_WARNING)
|
||||
DMWARN("Metadata device %s is larger than %u sectors: excess space will not be used.",
|
||||
bdevname(ca->metadata_dev->bdev, b), THIN_METADATA_MAX_SECTORS);
|
||||
DMWARN("Metadata device %pg is larger than %u sectors: excess space will not be used.",
|
||||
ca->metadata_dev->bdev, THIN_METADATA_MAX_SECTORS);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -3345,7 +3344,6 @@ static void disable_passdown_if_not_supported(struct cache *cache)
|
||||
struct block_device *origin_bdev = cache->origin_dev->bdev;
|
||||
struct queue_limits *origin_limits = &bdev_get_queue(origin_bdev)->limits;
|
||||
const char *reason = NULL;
|
||||
char buf[BDEVNAME_SIZE];
|
||||
|
||||
if (!cache->features.discard_passdown)
|
||||
return;
|
||||
@ -3357,8 +3355,8 @@ static void disable_passdown_if_not_supported(struct cache *cache)
|
||||
reason = "max discard sectors smaller than a block";
|
||||
|
||||
if (reason) {
|
||||
DMWARN("Origin device (%s) %s: Disabling discard passdown.",
|
||||
bdevname(origin_bdev, buf), reason);
|
||||
DMWARN("Origin device (%pg) %s: Disabling discard passdown.",
|
||||
origin_bdev, reason);
|
||||
cache->features.discard_passdown = false;
|
||||
}
|
||||
}
|
||||
|
@ -1682,7 +1682,6 @@ static int parse_metadata_dev(struct clone *clone, struct dm_arg_set *as, char *
|
||||
{
|
||||
int r;
|
||||
sector_t metadata_dev_size;
|
||||
char b[BDEVNAME_SIZE];
|
||||
|
||||
r = dm_get_device(clone->ti, dm_shift_arg(as), FMODE_READ | FMODE_WRITE,
|
||||
&clone->metadata_dev);
|
||||
@ -1693,8 +1692,8 @@ static int parse_metadata_dev(struct clone *clone, struct dm_arg_set *as, char *
|
||||
|
||||
metadata_dev_size = get_dev_size(clone->metadata_dev);
|
||||
if (metadata_dev_size > DM_CLONE_METADATA_MAX_SECTORS_WARNING)
|
||||
DMWARN("Metadata device %s is larger than %u sectors: excess space will not be used.",
|
||||
bdevname(clone->metadata_dev->bdev, b), DM_CLONE_METADATA_MAX_SECTORS);
|
||||
DMWARN("Metadata device %pg is larger than %u sectors: excess space will not be used.",
|
||||
clone->metadata_dev->bdev, DM_CLONE_METADATA_MAX_SECTORS);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2033,7 +2032,6 @@ static void disable_passdown_if_not_supported(struct clone *clone)
|
||||
struct block_device *dest_dev = clone->dest_dev->bdev;
|
||||
struct queue_limits *dest_limits = &bdev_get_queue(dest_dev)->limits;
|
||||
const char *reason = NULL;
|
||||
char buf[BDEVNAME_SIZE];
|
||||
|
||||
if (!test_bit(DM_CLONE_DISCARD_PASSDOWN, &clone->flags))
|
||||
return;
|
||||
@ -2044,8 +2042,8 @@ static void disable_passdown_if_not_supported(struct clone *clone)
|
||||
reason = "max discard sectors smaller than a region";
|
||||
|
||||
if (reason) {
|
||||
DMWARN("Destination device (%s) %s: Disabling discard passdown.",
|
||||
bdevname(dest_dev, buf), reason);
|
||||
DMWARN("Destination device (%pd) %s: Disabling discard passdown.",
|
||||
dest_dev, reason);
|
||||
clear_bit(DM_CLONE_DISCARD_PASSDOWN, &clone->flags);
|
||||
}
|
||||
}
|
||||
|
@ -899,10 +899,8 @@ retain:
|
||||
if (m->hw_handler_name) {
|
||||
r = scsi_dh_attach(q, m->hw_handler_name);
|
||||
if (r == -EBUSY) {
|
||||
char b[BDEVNAME_SIZE];
|
||||
|
||||
printk(KERN_INFO "dm-mpath: retaining handler on device %s\n",
|
||||
bdevname(bdev, b));
|
||||
printk(KERN_INFO "dm-mpath: retaining handler on device %pg\n",
|
||||
bdev);
|
||||
goto retain;
|
||||
}
|
||||
if (r < 0) {
|
||||
|
@ -230,15 +230,14 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,
|
||||
sector_t dev_size = bdev_nr_sectors(bdev);
|
||||
unsigned short logical_block_size_sectors =
|
||||
limits->logical_block_size >> SECTOR_SHIFT;
|
||||
char b[BDEVNAME_SIZE];
|
||||
|
||||
if (!dev_size)
|
||||
return 0;
|
||||
|
||||
if ((start >= dev_size) || (start + len > dev_size)) {
|
||||
DMWARN("%s: %s too small for target: "
|
||||
DMWARN("%s: %pg too small for target: "
|
||||
"start=%llu, len=%llu, dev_size=%llu",
|
||||
dm_device_name(ti->table->md), bdevname(bdev, b),
|
||||
dm_device_name(ti->table->md), bdev,
|
||||
(unsigned long long)start,
|
||||
(unsigned long long)len,
|
||||
(unsigned long long)dev_size);
|
||||
@ -253,10 +252,10 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,
|
||||
unsigned int zone_sectors = bdev_zone_sectors(bdev);
|
||||
|
||||
if (start & (zone_sectors - 1)) {
|
||||
DMWARN("%s: start=%llu not aligned to h/w zone size %u of %s",
|
||||
DMWARN("%s: start=%llu not aligned to h/w zone size %u of %pg",
|
||||
dm_device_name(ti->table->md),
|
||||
(unsigned long long)start,
|
||||
zone_sectors, bdevname(bdev, b));
|
||||
zone_sectors, bdev);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -270,10 +269,10 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,
|
||||
* the sector range.
|
||||
*/
|
||||
if (len & (zone_sectors - 1)) {
|
||||
DMWARN("%s: len=%llu not aligned to h/w zone size %u of %s",
|
||||
DMWARN("%s: len=%llu not aligned to h/w zone size %u of %pg",
|
||||
dm_device_name(ti->table->md),
|
||||
(unsigned long long)len,
|
||||
zone_sectors, bdevname(bdev, b));
|
||||
zone_sectors, bdev);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -283,19 +282,19 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,
|
||||
|
||||
if (start & (logical_block_size_sectors - 1)) {
|
||||
DMWARN("%s: start=%llu not aligned to h/w "
|
||||
"logical block size %u of %s",
|
||||
"logical block size %u of %pg",
|
||||
dm_device_name(ti->table->md),
|
||||
(unsigned long long)start,
|
||||
limits->logical_block_size, bdevname(bdev, b));
|
||||
limits->logical_block_size, bdev);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (len & (logical_block_size_sectors - 1)) {
|
||||
DMWARN("%s: len=%llu not aligned to h/w "
|
||||
"logical block size %u of %s",
|
||||
"logical block size %u of %pg",
|
||||
dm_device_name(ti->table->md),
|
||||
(unsigned long long)len,
|
||||
limits->logical_block_size, bdevname(bdev, b));
|
||||
limits->logical_block_size, bdev);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -400,20 +399,19 @@ static int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
|
||||
struct queue_limits *limits = data;
|
||||
struct block_device *bdev = dev->bdev;
|
||||
struct request_queue *q = bdev_get_queue(bdev);
|
||||
char b[BDEVNAME_SIZE];
|
||||
|
||||
if (unlikely(!q)) {
|
||||
DMWARN("%s: Cannot set limits for nonexistent device %s",
|
||||
dm_device_name(ti->table->md), bdevname(bdev, b));
|
||||
DMWARN("%s: Cannot set limits for nonexistent device %pg",
|
||||
dm_device_name(ti->table->md), bdev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (blk_stack_limits(limits, &q->limits,
|
||||
get_start_sect(bdev) + start) < 0)
|
||||
DMWARN("%s: adding target device %s caused an alignment inconsistency: "
|
||||
DMWARN("%s: adding target device %pg caused an alignment inconsistency: "
|
||||
"physical_block_size=%u, logical_block_size=%u, "
|
||||
"alignment_offset=%u, start=%llu",
|
||||
dm_device_name(ti->table->md), bdevname(bdev, b),
|
||||
dm_device_name(ti->table->md), bdev,
|
||||
q->limits.physical_block_size,
|
||||
q->limits.logical_block_size,
|
||||
q->limits.alignment_offset,
|
||||
|
@ -2824,7 +2824,6 @@ static void disable_passdown_if_not_supported(struct pool_c *pt)
|
||||
struct block_device *data_bdev = pt->data_dev->bdev;
|
||||
struct queue_limits *data_limits = &bdev_get_queue(data_bdev)->limits;
|
||||
const char *reason = NULL;
|
||||
char buf[BDEVNAME_SIZE];
|
||||
|
||||
if (!pt->adjusted_pf.discard_passdown)
|
||||
return;
|
||||
@ -2836,7 +2835,7 @@ static void disable_passdown_if_not_supported(struct pool_c *pt)
|
||||
reason = "max discard sectors smaller than a block";
|
||||
|
||||
if (reason) {
|
||||
DMWARN("Data device (%s) %s: Disabling discard passdown.", bdevname(data_bdev, buf), reason);
|
||||
DMWARN("Data device (%pg) %s: Disabling discard passdown.", data_bdev, reason);
|
||||
pt->adjusted_pf.discard_passdown = false;
|
||||
}
|
||||
}
|
||||
@ -3201,11 +3200,10 @@ static sector_t get_dev_size(struct block_device *bdev)
|
||||
static void warn_if_metadata_device_too_big(struct block_device *bdev)
|
||||
{
|
||||
sector_t metadata_dev_size = get_dev_size(bdev);
|
||||
char buffer[BDEVNAME_SIZE];
|
||||
|
||||
if (metadata_dev_size > THIN_METADATA_MAX_SECTORS_WARNING)
|
||||
DMWARN("Metadata device %s is larger than %u sectors: excess space will not be used.",
|
||||
bdevname(bdev, buffer), THIN_METADATA_MAX_SECTORS);
|
||||
DMWARN("Metadata device %pg is larger than %u sectors: excess space will not be used.",
|
||||
bdev, THIN_METADATA_MAX_SECTORS);
|
||||
}
|
||||
|
||||
static sector_t get_metadata_dev_size(struct block_device *bdev)
|
||||
|
Loading…
Reference in New Issue
Block a user