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