From: Mike Snitzer <snitzer@redhat.com>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: device-mapper development <dm-devel@redhat.com>, jens.axboe@oracle.com
Subject: Re: dm: Fix alignment stacking on partitioned devices
Date: Fri, 18 Dec 2009 12:33:23 -0500 [thread overview]
Message-ID: <20091218173322.GA4163@redhat.com> (raw)
In-Reply-To: <yq1aaxg7n84.fsf@sermon.lab.mkp.net>
On Fri, Dec 18 2009 at 2:30am -0500,
Martin K. Petersen <martin.petersen@oracle.com> wrote:
>
> The dm device limits function passes the start sector within the block
> device to the block layer stacking function. However, the partition's
> offset on the physical device is not added, resulting in incorrect
> alignment reporting.
>
> Add the partition offset to the values passed to blk_stack_limits().
>
> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Martin,
This is not required because DM assumes alignment_offset has already
been accounted for by the caller (e.g. LVM2 or some other ficitional DM
consumer).
Below, "start" represents the aligned start of the data for a given volume.
That start must have already been shifted by alignment_offset; as is the
case with lvm2 (>= 2.02.51), see the following lvm2 commits:
http://sources.redhat.com/git/gitweb.cgi?p=lvm2.git;a=commit;h=282029eb45e56
http://sources.redhat.com/git/gitweb.cgi?p=lvm2.git;a=commit;h=6c88b6c660020
All this being said, how did you arrive at this patch? Why do you feel
it is needed? Was it just from code inspection?
Regards,
Mike
> diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
> index be62547..67efac9 100644
> --- a/drivers/md/dm-table.c
> +++ b/drivers/md/dm-table.c
> @@ -495,6 +495,7 @@ 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);
> + sector_t offset = (get_start_sect(bdev) + start) << 9;
> char b[BDEVNAME_SIZE];
>
> if (unlikely(!q)) {
> @@ -503,7 +504,7 @@ int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
> return 0;
> }
>
> - if (blk_stack_limits(limits, &q->limits, start << 9) < 0)
> + if (blk_stack_limits(limits, &q->limits, offset) < 0)
> DMWARN("%s: target device %s is misaligned: "
> "physical_block_size=%u, logical_block_size=%u, "
> "alignment_offset=%u, start=%llu",
> @@ -511,7 +512,7 @@ int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
> q->limits.physical_block_size,
> q->limits.logical_block_size,
> q->limits.alignment_offset,
> - (unsigned long long) start << 9);
> + (unsigned long long) offset);
>
>
> /*
next prev parent reply other threads:[~2009-12-18 17:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-18 7:30 [PATCH] dm: Fix alignment stacking on partitioned devices Martin K. Petersen
2009-12-18 17:33 ` Mike Snitzer [this message]
2009-12-21 17:49 ` Martin K. Petersen
2009-12-21 19:52 ` Mike Snitzer
2009-12-22 4:27 ` Martin K. Petersen
2009-12-22 14:32 ` Mike Snitzer
2009-12-22 17:41 ` Martin K. Petersen
2009-12-22 21:42 ` Mike Snitzer
2009-12-22 22:13 ` Mike Snitzer
2009-12-23 6:05 ` Martin K. Petersen
2009-12-23 14:26 ` Mike Snitzer
2009-12-23 16:33 ` Martin K. Petersen
2009-12-23 17:13 ` Mike Snitzer
2009-12-23 20:31 ` Topology fixes Martin K. Petersen
2009-12-23 20:31 ` [PATCH 1/2] block: Fix incorrect reporting of partition alignment Martin K. Petersen
2009-12-23 20:31 ` [PATCH 2/2] block: Fix topology stacking for data and discard alignment Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091218173322.GA4163@redhat.com \
--to=snitzer@redhat.com \
--cc=dm-devel@redhat.com \
--cc=jens.axboe@oracle.com \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox