Skip to contentSkip to conversation

dm log: fix create_log_context() to use proper logical_block_size

PATCH Superseded Mike Snitzer 2 participants 3 messages Jun 17, 2009 Device mapper

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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
Index: linux-2.6/drivers/md/dm-log.c
===================================================================
@@ -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",
#1 lore raw
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
#2 lore raw
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 the logical_block_size from the log Mike> disk rather than the target's logical_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