diff options
author | Martin K. Petersen <martin.petersen@oracle.com> | 2010-01-11 03:21:49 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-01-25 10:49:40 -0800 |
commit | fbe2992083cc1e865a91a4a101e97c2c35667acf (patch) | |
tree | 2d850de5691209926fdb6e9b8d9c0ad77d5b4767 /block/blk-settings.c | |
parent | ed0cd89c7333b17d50812201602f436b57ef1482 (diff) |
block: bdev_stack_limits wrapper
commit 17be8c245054b9c7786545af3ba3ca4e54cd4ad9 upstream.
DM does not want to know about partition offsets. Add a partition-aware
wrapper that DM can use when stacking block devices.
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Mike Snitzer <snitzer@redhat.com>
Reviewed-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'block/blk-settings.c')
-rw-r--r-- | block/blk-settings.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/block/blk-settings.c b/block/blk-settings.c index 66d4aa8799b..d5aa8865c64 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -560,6 +560,28 @@ 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); +} +EXPORT_SYMBOL(bdev_stack_limits); + +/** * disk_stack_limits - adjust queue limits for stacked drivers * @disk: MD/DM gendisk (top) * @bdev: the underlying block device (bottom) |