Skip to content

Commit

Permalink
Improve ZFS N-way mirror read performance + Load/Locality/Rotation
Browse files Browse the repository at this point in the history
Freebsd Rev. 256956 by @stevenh - Improve ZFS N-way mirror read performance by using load and locality
information.

Reviewed by: gibbs, mav, will
Sponsored by: Multiplay

References:
  http://svnweb.freebsd.org/changeset/base/256956
  openzfs#1487
  openzfs#1803
  http://open-zfs.org/wiki/Features#Improve_N-way_mirror_read_performance

Ported by: Andrew Barnes <[email protected]>

Closes openzfs#1803
  • Loading branch information
b333z committed Oct 30, 2013
1 parent a35beed commit bbe360b
Show file tree
Hide file tree
Showing 5 changed files with 249 additions and 111 deletions.
3 changes: 3 additions & 0 deletions include/sys/vdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ extern void vdev_queue_init(vdev_t *vd);
extern void vdev_queue_fini(vdev_t *vd);
extern zio_t *vdev_queue_io(zio_t *zio);
extern void vdev_queue_io_done(zio_t *zio);
extern int vdev_queue_length(vdev_t *vd);
extern uint64_t vdev_queue_lastoffset(vdev_t *vd);
extern void vdev_queue_register_lastoffset(vdev_t *vd, zio_t *zio);

extern void vdev_config_dirty(vdev_t *vd);
extern void vdev_config_clean(vdev_t *vd);
Expand Down
5 changes: 5 additions & 0 deletions include/sys/vdev_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ struct vdev_cache {
avl_tree_t vc_offset_tree;
avl_tree_t vc_lastused_tree;
kmutex_t vc_lock;
uint64_t vq_lastoffset;
};

struct vdev_queue {
Expand All @@ -109,6 +110,7 @@ struct vdev_queue {
hrtime_t vq_io_delta_ts;
list_t vq_io_list;
kmutex_t vq_lock;
uint64_t vq_lastoffset;
};

struct vdev_io {
Expand Down Expand Up @@ -207,6 +209,9 @@ struct vdev {
spa_aux_vdev_t *vdev_aux; /* for l2cache vdevs */
zio_t *vdev_probe_zio; /* root of current probe */
vdev_aux_t vdev_label_aux; /* on-disk aux state */
uint16_t vdev_rotation_rate; /* rotational rate of the media */
#define VDEV_RATE_UNKNOWN 0
#define VDEV_RATE_NON_ROTATING 1

/*
* For DTrace to work in userland (libzpool) context, these fields must
Expand Down
12 changes: 12 additions & 0 deletions module/zfs/vdev_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize,
{
struct block_device *bdev = ERR_PTR(-ENXIO);
vdev_disk_t *vd;
struct request_queue *q;
int mode, block_size;

/* Must have a pathname and it must be absolute. */
Expand Down Expand Up @@ -311,6 +312,17 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize,
/* Try to set the io scheduler elevator algorithm */
(void) vdev_elevator_switch(v, zfs_vdev_scheduler);

v->vdev_rotation_rate = VDEV_RATE_UNKNOWN;

/* Determine if the device has low seek times */
#ifdef HAVE_BLK_QUEUE_NONROT

q = bdev_get_queue(vd->vd_bdev);
if (blk_queue_nonrot(q))
v->vdev_rotation_rate = VDEV_RATE_NON_ROTATING;

#endif

return 0;
}

Expand Down
Loading

0 comments on commit bbe360b

Please sign in to comment.