Skip to content

Commit

Permalink
Fix zfs_vdev_aggregation_limit bounds checking
Browse files Browse the repository at this point in the history
Update the bounds checking for zfs_vdev_aggregation_limit so that
it has a floor of zero and a maximum value of the supported block
size for the pool.

Additionally add an early return when zfs_vdev_aggregation_limit
equals zero to disable aggregation.  For very fast solid state or
memory devices it may be more expensive to perform the aggregation
than to issue the IO immediately.

Signed-off-by: Brian Behlendorf <[email protected]>
Requires-spl: refs/pull/515/head
  • Loading branch information
behlendorf committed Dec 18, 2015
1 parent 74ee48b commit da42296
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions module/zfs/vdev_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,15 +504,12 @@ vdev_queue_aggregate(vdev_queue_t *vq, zio_t *zio)
enum zio_flag flags = zio->io_flags & ZIO_FLAG_AGG_INHERIT;
void *buf;

if (zio->io_flags & ZIO_FLAG_DONT_AGGREGATE)
return (NULL);
zfs_vdev_aggregation_limit = MAX(MIN(zfs_vdev_aggregation_limit,
spa_maxblocksize(vq->vq_vdev->vdev_spa)), 0);

/*
* Prevent users from setting the zfs_vdev_aggregation_limit
* tuning larger than SPA_MAXBLOCKSIZE.
*/
zfs_vdev_aggregation_limit =
MIN(zfs_vdev_aggregation_limit, SPA_MAXBLOCKSIZE);
if (zio->io_flags & ZIO_FLAG_DONT_AGGREGATE ||
zfs_vdev_aggregation_limit == 0)
return (NULL);

first = last = zio;

Expand Down

0 comments on commit da42296

Please sign in to comment.