Skip to content

Commit

Permalink
Keep track of mixed nonrotational (ssd+hdd) devices.
Browse files Browse the repository at this point in the history
  • Loading branch information
inkdot7 committed Sep 20, 2016
1 parent d2a6f65 commit 6e2db15
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/sys/vdev_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ 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_some; /* true if at least one 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
10 changes: 9 additions & 1 deletion module/zfs/vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,9 @@ vdev_open_child(void *arg)
vd->vdev_open_error = vdev_open(vd);
vd->vdev_open_thread = NULL;
vd->vdev_parent->vdev_nonrot &= vd->vdev_nonrot;
vd->vdev_parent->vdev_nonrot_some |= vd->vdev_nonrot;
vd->vdev_parent->vdev_nonrot_mix =
vd->vdev_parent->vdev_nonrot ^ vd->vdev_parent->vdev_nonrot_some;
}

static boolean_t
Expand Down Expand Up @@ -1163,7 +1166,9 @@ vdev_open_children(vdev_t *vd)
vd->vdev_child[c]->vdev_open_error =
vdev_open(vd->vdev_child[c]);
vd->vdev_nonrot &= vd->vdev_child[c]->vdev_nonrot;
vd->vdev_nonrot_some |= vd->vdev_child[c]->vdev_nonrot;
}
vd->vdev_nonrot_mix = vd->vdev_nonrot ^ vd->vdev_nonrot_some;
return;
}
tq = taskq_create("vdev_open", children, minclsyspri,
Expand All @@ -1175,8 +1180,11 @@ vdev_open_children(vdev_t *vd)

taskq_destroy(tq);

for (c = 0; c < children; c++)
for (c = 0; c < children; c++) {
vd->vdev_nonrot &= vd->vdev_child[c]->vdev_nonrot;
vd->vdev_nonrot_some |= vd->vdev_child[c]->vdev_nonrot;
}
vd->vdev_nonrot_mix = vd->vdev_nonrot ^ vd->vdev_nonrot_some;
}

/*
Expand Down
2 changes: 2 additions & 0 deletions module/zfs/vdev_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ 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_some = v->vdev_nonrot;
v->vdev_nonrot_mix = B_FALSE;

/* Physical volume size in bytes */
*psize = bdev_capacity(vd->vd_bdev);
Expand Down
2 changes: 2 additions & 0 deletions module/zfs/vdev_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ 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_some = vd->vdev_nonrot;
vd->vdev_nonrot_mix = B_FALSE;

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

0 comments on commit 6e2db15

Please sign in to comment.