Commit 70dd5bf3 authored by Martin K. Petersen's avatar Martin K. Petersen Committed by Jens Axboe

block: Stack optimal I/O size

When stacking block devices ensure that optimal I/O size is scaled
accordingly.
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: default avatarMike Snitzer <snitzer@redhat.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 7c958e32
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <linux/bio.h> #include <linux/bio.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/bootmem.h> /* for max_pfn/max_low_pfn */ #include <linux/bootmem.h> /* for max_pfn/max_low_pfn */
#include <linux/gcd.h>
#include "blk.h" #include "blk.h"
...@@ -520,6 +521,16 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, ...@@ -520,6 +521,16 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
return -1; return -1;
} }
/* Find lcm() of optimal I/O size */
if (t->io_opt && b->io_opt)
t->io_opt = (t->io_opt * b->io_opt) / gcd(t->io_opt, b->io_opt);
else if (b->io_opt)
t->io_opt = b->io_opt;
/* Verify that optimal I/O size is a multiple of io_min */
if (t->io_min && t->io_opt % t->io_min)
return -1;
return 0; return 0;
} }
EXPORT_SYMBOL(blk_stack_limits); EXPORT_SYMBOL(blk_stack_limits);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment