Skip to content

Commit

Permalink
Keep track of mixed nonrotational (ssd+hdd) devices.
Browse files Browse the repository at this point in the history
Only mirrors are mixed.  If a pool consist of several mixed vdevs, it is
mixed if all vdevs are either mixed, or fully nonrotational.

Do not mark as mixed when fully nonrotational.
  • Loading branch information
inkdot7 committed Dec 13, 2016
1 parent 02730c3 commit 7cbcb24
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/sys/vdev_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ struct vdev {
boolean_t vdev_expanding; /* expand the vdev? */
boolean_t vdev_reopening; /* reopen in progress? */
boolean_t vdev_nonrot; /* true if solid state */
boolean_t vdev_nonrot_mix; /* true if partial solid state */
int vdev_open_error; /* error on last open */
kthread_t *vdev_open_thread; /* thread opening children */
uint64_t vdev_crtxg; /* txg when top-level was added */
Expand Down
13 changes: 12 additions & 1 deletion module/zfs/vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,7 @@ vdev_open_children(vdev_t *vd)
taskq_t *tq;
int children = vd->vdev_children;
int c;
boolean_t nonrot_some;

/*
* in order to handle pools on top of zvols, do the opens
Expand All @@ -1198,9 +1199,19 @@ vdev_open_children(vdev_t *vd)
}

vd->vdev_nonrot = B_TRUE;
vd->vdev_nonrot_mix = B_TRUE;
nonrot_some = B_FALSE;

for (c = 0; c < children; c++)
for (c = 0; c < children; c++) {
vd->vdev_nonrot &= vd->vdev_child[c]->vdev_nonrot;
vd->vdev_nonrot_mix &= vd->vdev_child[c]->vdev_nonrot_mix |
vd->vdev_child[c]->vdev_nonrot;
nonrot_some |= vd->vdev_child[c]->vdev_nonrot;
}
if (vd->vdev_ops == &vdev_mirror_ops)
vd->vdev_nonrot_mix |= nonrot_some;
if (vd->vdev_nonrot)
vd->vdev_nonrot_mix = B_FALSE;
}

/*
Expand Down
1 change: 1 addition & 0 deletions module/zfs/vdev_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize,

/* Inform the ZIO pipeline that we are non-rotational */
v->vdev_nonrot = blk_queue_nonrot(bdev_get_queue(vd->vd_bdev));
v->vdev_nonrot_mix = B_FALSE;

/* Physical volume size in bytes */
*psize = bdev_capacity(vd->vd_bdev);
Expand Down
1 change: 1 addition & 0 deletions module/zfs/vdev_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,

/* Rotational optimizations only make sense on block devices */
vd->vdev_nonrot = B_TRUE;
vd->vdev_nonrot_mix = B_FALSE;

/*
* We must have a pathname, and it must be absolute.
Expand Down

0 comments on commit 7cbcb24

Please sign in to comment.