dm log: fix create_log_context() to use proper logical_block_size
PATCH 1/1 dm log: fix create_log_context() to use proper logical_block_size
create_log_context() must use the logical_block_size from the log disk rather than the target's logical_block_size.
--- drivers/md/dm-log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/dm-log.c +3 -1
@@ -404,17 +404,19 @@ static int create_log_context(struct dm_ } lc->disk_header =NULL ; }else { +struct request_queue *q; lc->log_dev = dev; lc->log_dev_failed =0 ; lc->header_location.bdev = lc->log_dev->bdev; lc->header_location.sector =0 ; + q =bdev_get_queue (lc->header_location.bdev);/* * Buffer holds both header and bitset. */ buf_size =dm_round_up ((LOG_OFFSET <<SECTOR_SHIFT ) + bitset_size, - ti->limits.logical_block_size); + q->limits.logical_block_size);if (buf_size >i_size_read (dev->bdev->bd_inode)) { DMWARN("log device %s too small: need %llu bytes",
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Mike" == Mike Snitzer <[email protected]> writes:
Mike> create_log_context() must use the logical_block_size from the log Mike> disk rather than the target's logical_block_size.
Mike> buf_size = dm_round_up((LOG_OFFSET << SECTOR_SHIFT) +
Mike> bitset_size,
Mike> - ti->limits.logical_block_size);
Mike> + q->limits.logical_block_size);
Please use the accessor functions when possible.
bdev_logical_block_size(lc->header_location.bdev) to the rescue....
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Quoted 5 lines · Martin K. Petersen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Mike" == Mike Snitzer <[email protected]> writes:
Mike>
create_log_context()must use thelogical_block_sizefrom the log Mike> disk rather than the target'slogical_block_size.
Quoted 8 lines
Mike>
buf_size= dm_round_up((LOG_OFFSET <<SECTOR_SHIFT) +
Mike>bitset_size,
Mike> -ti->limits.logical_block_size);
Mike> +q->limits.logical_block_size);Please use the accessor functions when possible.
bdev_logical_block_size(lc->header_location.bdev)to the rescue....
Ah right, thanks for the reminder!
v2 of the patch to follow...
Mike