Print this page
7938 Port ZOL #3712 disable LBA weighting on files and SSDs

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/vdev.c
          +++ new/usr/src/uts/common/fs/zfs/vdev.c
↓ open down ↓ 1101 lines elided ↑ open up ↑
1102 1102  }
1103 1103  
1104 1104  static void
1105 1105  vdev_open_child(void *arg)
1106 1106  {
1107 1107          vdev_t *vd = arg;
1108 1108  
1109 1109          vd->vdev_open_thread = curthread;
1110 1110          vd->vdev_open_error = vdev_open(vd);
1111 1111          vd->vdev_open_thread = NULL;
     1112 +        vd->vdev_parent->vdev_nonrot &= vd->vdev_nonrot;
1112 1113  }
1113 1114  
1114 1115  boolean_t
1115 1116  vdev_uses_zvols(vdev_t *vd)
1116 1117  {
1117 1118          if (vd->vdev_path && strncmp(vd->vdev_path, ZVOL_DIR,
1118 1119              strlen(ZVOL_DIR)) == 0)
1119 1120                  return (B_TRUE);
1120 1121          for (int c = 0; c < vd->vdev_children; c++)
1121 1122                  if (vdev_uses_zvols(vd->vdev_child[c]))
1122 1123                          return (B_TRUE);
1123 1124          return (B_FALSE);
1124 1125  }
1125 1126  
1126 1127  void
1127 1128  vdev_open_children(vdev_t *vd)
1128 1129  {
1129 1130          taskq_t *tq;
1130 1131          int children = vd->vdev_children;
1131 1132  
     1133 +        vd->vdev_nonrot = B_TRUE;
     1134 +
1132 1135          /*
1133 1136           * in order to handle pools on top of zvols, do the opens
1134 1137           * in a single thread so that the same thread holds the
1135 1138           * spa_namespace_lock
1136 1139           */
1137 1140          if (vdev_uses_zvols(vd)) {
1138      -                for (int c = 0; c < children; c++)
     1141 +                for (int c = 0; c < children; c++) {
1139 1142                          vd->vdev_child[c]->vdev_open_error =
1140 1143                              vdev_open(vd->vdev_child[c]);
     1144 +                        vd->vdev_nonrot &= vd->vdev_child[c]->vdev_nonrot;
     1145 +                }
1141 1146                  return;
1142 1147          }
1143 1148          tq = taskq_create("vdev_open", children, minclsyspri,
1144 1149              children, children, TASKQ_PREPOPULATE);
1145 1150  
1146 1151          for (int c = 0; c < children; c++)
1147 1152                  VERIFY(taskq_dispatch(tq, vdev_open_child, vd->vdev_child[c],
1148 1153                      TQ_SLEEP) != NULL);
1149 1154  
1150 1155          taskq_destroy(tq);
     1156 +
     1157 +        for (int c = 0; c < children; c++)
     1158 +                vd->vdev_nonrot &= vd->vdev_child[c]->vdev_nonrot;
1151 1159  }
1152 1160  
1153 1161  /*
1154 1162   * Prepare a virtual device for access.
1155 1163   */
1156 1164  int
1157 1165  vdev_open(vdev_t *vd)
1158 1166  {
1159 1167          spa_t *spa = vd->vdev_spa;
1160 1168          int error;
↓ open down ↓ 2322 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX