From patchwork Wed Jan 6 08:39:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Martin K. Petersen" X-Patchwork-Id: 71247 X-Patchwork-Delegate: agk@redhat.com Received: from mx01.util.phx2.redhat.com (mx1-phx2.redhat.com [209.132.183.26]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o068iNHQ025508 for ; Wed, 6 Jan 2010 08:44:23 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx01.util.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o068eDW3004772; Wed, 6 Jan 2010 03:40:41 -0500 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o068eCxS006941 for ; Wed, 6 Jan 2010 03:40:12 -0500 Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.6]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o068e7Lk016895; Wed, 6 Jan 2010 03:40:07 -0500 Received: from rcsinet12.oracle.com (rcsinet12.oracle.com [148.87.113.124]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o068dpb3031256; Wed, 6 Jan 2010 03:39:51 -0500 Received: from rcsinet15.oracle.com (rcsinet15.oracle.com [148.87.113.117]) by rcsinet12.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o068doFT002569 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 6 Jan 2010 08:39:51 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by rcsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o068XaWY000636; Wed, 6 Jan 2010 08:39:48 GMT Received: from abhmt008.oracle.com by acsmt357.oracle.com with ESMTP id 1287884981262767154; Wed, 06 Jan 2010 02:39:14 -0600 Received: from groovelator.mkp.net (/209.217.122.111) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 06 Jan 2010 00:39:13 -0800 To: Mike Snitzer From: "Martin K. Petersen" Organization: Oracle References: <1261591640-24380-1-git-send-email-snitzer@redhat.com> <20100105182735.GC6042@agk-dp.fab.redhat.com> <20100106025731.GA16154@redhat.com> <20100106041050.GA21438@redhat.com> <20100106051605.GB21438@redhat.com> Date: Wed, 06 Jan 2010 03:39:12 -0500 In-Reply-To: <20100106051605.GB21438@redhat.com> (Mike Snitzer's message of "Wed, 6 Jan 2010 00:16:06 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-Source-IP: acsmt357.oracle.com [141.146.40.157] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090205.4B444C55.00E3:SCFMA4539814,ss=1,fgs=0 X-RedHat-Spam-Score: -103.76 (AWL, RCVD_IN_DNSWL_MED, SUBJECT_FUZZY_TION, UNPARSEABLE_RELAY, USER_IN_WHITELIST) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.6 X-loop: dm-devel@redhat.com Cc: device-mapper development , "Alasdair G. Kergon" , "Martin K. Petersen" Subject: Re: [dm-devel] [PATCH v2] dm: Fix alignment stacking on partitioned devices X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com diff --git a/block/blk-settings.c b/block/blk-settings.c index d52d4ad..4b43e14 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -631,6 +631,27 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, EXPORT_SYMBOL(blk_stack_limits); /** + * bdev_stack_limits - adjust queue limits for stacked drivers + * @t: the stacking driver limits (top device) + * @bdev: the component block_device (bottom) + * @start: first data sector within component device + * + * Description: + * Merges queue limits for a top device and a block_device. Returns + * 0 if alignment didn't change. Returns -1 if adding the bottom + * device caused misalignment. + */ +int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev, + sector_t start) +{ + struct request_queue *bq = bdev_get_queue(bdev); + + start += get_start_sect(bdev); + + return blk_stack_limits(t, &bq->limits, start << 9); +} + +/** * disk_stack_limits - adjust queue limits for stacked drivers * @disk: MD/DM gendisk (top) * @bdev: the underlying block device (bottom) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index be62547..e0866a0 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -503,7 +503,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 (bdev_stack_limits(limits, bdev, start) < 0) DMWARN("%s: target device %s is misaligned: " "physical_block_size=%u, logical_block_size=%u, " "alignment_offset=%u, start=%llu", diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 9b98173..70b7ede 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -938,6 +938,8 @@ extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt); extern void blk_set_default_limits(struct queue_limits *lim); extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, sector_t offset); +extern int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev, + sector_t offset); extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, sector_t offset); extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b);