dm table: improve terse warning messages with more context
PATCH 1/1 dm table: improve terse warning messages with more context
NOTE: this patch depends on the pending device_area_is_invalid() patch:
http://patchwork.kernel.org/patch/37759/
---
The lack of context in two dm-table warnings has already proven unfortunate when analyzing the root-cause of these warnings. Two recent fixes went in to address issues that triggered these terse warnings:5dea271b6d87bd1d79a59c1d5baac2596a841c37 ea9df47cc92573b159ef3b4fda516c32cba9c4fd
If the warnings contained the additional info that this patch provides it would have made life easier on both the developers and end-users.
Having specific information up-front will improve the dialog with users that hit these warnings in the future.
---
drivers/md/dm-table.c +13 -4
@@ -360,8 +360,12 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,return 0 ;if ((start >= dev_size) || (start + len > dev_size)) { -DMWARN ("%s: %s too small for target" , -dm_device_name (ti->table->md),bdevname (bdev, b)); +DMWARN ("%s: %s too small for target: " +"start=%llu, len=%llu, dev_size=%llu" , +dm_device_name (ti->table->md),bdevname (bdev, b), + (unsigned long long )start, + (unsigned long long )len, + (unsigned long long )dev_size);return 1 ; }
@@ -496,8 +500,13 @@ int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev, }if (blk_stack_limits (limits, &q->limits, start <<9 ) <0 ) -DMWARN ("%s: target device %s is misaligned" , -dm_device_name (ti->table->md),bdevname (bdev, b)); +DMWARN ("%s: target device %s is misaligned: " +"physical_block_size=%hu, alignment_offset=%hu, " +"start=%llu" , +dm_device_name (ti->table->md),bdevname (bdev, b), + q->limits.physical_block_size, + q->limits.alignment_offset, + (unsigned long long ) start <<9 );/* * Check if merge fn is supported.
Alasdair G Kergon
maintainerdrivers/md/dm-table.c int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev, · line 509
Quoted 13 lines · Mike Snitzer
drivers/md/dm-table.c +7
-2@@ -496,8 +500,13 @@ int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev, }if (blk_stack_limits (limits, &q->limits, start <<9 ) <0 ) -DMWARN ("%s: target device %s is misaligned" , -dm_device_name (ti->table->md),bdevname (bdev, b)); +DMWARN ("%s: target device %s is misaligned: " +"physical_block_size=%hu, alignment_offset=%hu, " +"start=%llu" , +dm_device_name (ti->table->md),bdevname (bdev, b), + q->limits.physical_block_size, + q->limits.alignment_offset, + (unsigned long long ) start <<9 );
unsigned int physical_block_size;
unsigned int alignment_offset;Presumably those should be just %u.
Alasdair