aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-settings.c22
-rw-r--r--include/linux/blkdev.h2
2 files changed, 24 insertions, 0 deletions
diff --git a/block/blk-settings.c b/block/blk-settings.c
index 127f82551855..5eeb9e0d256e 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -640,6 +640,28 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
640EXPORT_SYMBOL(blk_stack_limits); 640EXPORT_SYMBOL(blk_stack_limits);
641 641
642/** 642/**
643 * bdev_stack_limits - adjust queue limits for stacked drivers
644 * @t: the stacking driver limits (top device)
645 * @bdev: the component block_device (bottom)
646 * @start: first data sector within component device
647 *
648 * Description:
649 * Merges queue limits for a top device and a block_device. Returns
650 * 0 if alignment didn't change. Returns -1 if adding the bottom
651 * device caused misalignment.
652 */
653int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev,
654 sector_t start)
655{
656 struct request_queue *bq = bdev_get_queue(bdev);
657
658 start += get_start_sect(bdev);
659
660 return blk_stack_limits(t, &bq->limits, start << 9);
661}
662EXPORT_SYMBOL(bdev_stack_limits);
663
664/**
643 * disk_stack_limits - adjust queue limits for stacked drivers 665 * disk_stack_limits - adjust queue limits for stacked drivers
644 * @disk: MD/DM gendisk (top) 666 * @disk: MD/DM gendisk (top)
645 * @bdev: the underlying block device (bottom) 667 * @bdev: the underlying block device (bottom)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index a41bcc8e140f..5c8018977efa 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);
938extern void blk_set_default_limits(struct queue_limits *lim); 938extern void blk_set_default_limits(struct queue_limits *lim);
939extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, 939extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
940 sector_t offset); 940 sector_t offset);
941extern int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev,
942 sector_t offset);
941extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, 943extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
942 sector_t offset); 944 sector_t offset);
943extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); 945extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b);