Skip to content

Commit 16d80c5

Browse files
committed
rbd: set io_min, io_opt and discard_granularity to alloc_size
Now that we have alloc_size that controls our discard behavior, it doesn't make sense to have these set to object (set) size. alloc_size defaults to 64k, but because discard_granularity is likely 4M, only ranges that are equal to or bigger than 4M can be considered during fstrim. A smaller io_min is also more likely to be met, resulting in fewer deferred writes on bluestore OSDs. Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Reviewed-by: Jason Dillaman <dillaman@redhat.com>
1 parent 9e98c67 commit 16d80c5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/block/rbd.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ static int parse_rbd_opts_token(char *c, void *private)
833833
pctx->opts->queue_depth = intval;
834834
break;
835835
case Opt_alloc_size:
836-
if (intval < 1) {
836+
if (intval < SECTOR_SIZE) {
837837
pr_err("alloc_size out of range\n");
838838
return -EINVAL;
839839
}
@@ -4203,12 +4203,12 @@ static int rbd_init_disk(struct rbd_device *rbd_dev)
42034203
q->limits.max_sectors = queue_max_hw_sectors(q);
42044204
blk_queue_max_segments(q, USHRT_MAX);
42054205
blk_queue_max_segment_size(q, UINT_MAX);
4206-
blk_queue_io_min(q, objset_bytes);
4207-
blk_queue_io_opt(q, objset_bytes);
4206+
blk_queue_io_min(q, rbd_dev->opts->alloc_size);
4207+
blk_queue_io_opt(q, rbd_dev->opts->alloc_size);
42084208

42094209
if (rbd_dev->opts->trim) {
42104210
blk_queue_flag_set(QUEUE_FLAG_DISCARD, q);
4211-
q->limits.discard_granularity = objset_bytes;
4211+
q->limits.discard_granularity = rbd_dev->opts->alloc_size;
42124212
blk_queue_max_discard_sectors(q, objset_bytes >> SECTOR_SHIFT);
42134213
blk_queue_max_write_zeroes_sectors(q, objset_bytes >> SECTOR_SHIFT);
42144214
}

0 commit comments

Comments
 (0)