Let's the stripe_size of back device is io_opt of request_queue make
good sense.

Signed-off-by: Jianpeng Ma <[email protected]>
---
 drivers/md/bcache/super.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index c57bfa0..21f77c1 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -759,11 +759,15 @@ static int bcache_device_init(struct bcache_device *d, 
unsigned block_size,
                              sector_t sectors)
 {
        struct request_queue *q;
+       struct cached_dev *dc;
        size_t n;
        int minor;
 
+       dc = container_of(d, struct cached_dev, disk);
+       q = bdev_get_queue(dc->bdev);
+
        if (!d->stripe_size)
-               d->stripe_size = 1 << 31;
+               d->stripe_size = min_t(unsigned, 1 << 31, q->limits.io_opt);
 
        d->nr_stripes = DIV_ROUND_UP_ULL(sectors, d->stripe_size);
 
-- 
1.7.10.4
N‹§²æìr¸›yúèšØb²X¬¶Ç§vØ^–)Þº{.nÇ+‰·¥Š{±mƜ…è§¶›¡Ü¨}©ž²Æ 
zÚ&j:+v‰¨¾«‘êçzZ+€Ê+zf£¢·hšˆ§~†­†Ûiÿûàz¹®w¥¢¸?™¨è­Ú&¢)ߢf

Reply via email to