diff mbox

dm log: fix create_log_context() to use proper logical_block_size

Message ID 1245255712-5320-1-git-send-email-snitzer@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Alasdair Kergon
Headers show

Commit Message

Mike Snitzer June 17, 2009, 4:21 p.m. UTC
create_log_context() must use the logical_block_size from the log disk
rather than the target's logical_block_size.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
 drivers/md/dm-log.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)


--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

Comments

Martin K. Petersen June 17, 2009, 4:26 p.m. UTC | #1
>>>>> "Mike" == Mike Snitzer <snitzer@redhat.com> 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....
Mike Snitzer June 17, 2009, 4:29 p.m. UTC | #2
On Wed, Jun 17 2009 at 12:26pm -0400,
Martin K. Petersen <martin.petersen@oracle.com> wrote:

> >>>>> "Mike" == Mike Snitzer <snitzer@redhat.com> 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....

Ah right, thanks for the reminder!

v2 of the patch to follow...

Mike

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
diff mbox

Patch

Index: linux-2.6/drivers/md/dm-log.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-log.c
+++ 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",