Print this page
NEX-6088 ZFS scrub/resilver take excessively long due to issuing lots of random IO
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>


 192         uint64_t version;
 193         uint64_t stateval;
 194         uint64_t suspended;
 195         uint64_t hostid = 0;
 196 
 197         verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION,
 198             &version) == 0);
 199         verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE,
 200             &nvroot) == 0);
 201         verify(nvlist_lookup_uint64_array(nvroot, ZPOOL_CONFIG_VDEV_STATS,
 202             (uint64_t **)&vs, &vsc) == 0);
 203         verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE,
 204             &stateval) == 0);
 205 
 206         /*
 207          * Currently resilvering a vdev
 208          */
 209         (void) nvlist_lookup_uint64_array(nvroot, ZPOOL_CONFIG_SCAN_STATS,
 210             (uint64_t **)&ps, &psc);
 211         if (ps && ps->pss_func == POOL_SCAN_RESILVER &&
 212             ps->pss_state == DSS_SCANNING)
 213                 return (ZPOOL_STATUS_RESILVERING);
 214 
 215         /*
 216          * Pool last accessed by another system.
 217          */
 218         (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_HOSTID, &hostid);
 219         if (hostid != 0 && (unsigned long)hostid != gethostid() &&
 220             stateval == POOL_STATE_ACTIVE)
 221                 return (ZPOOL_STATUS_HOSTID_MISMATCH);
 222 
 223         /*
 224          * Newer on-disk version.
 225          */
 226         if (vs->vs_state == VDEV_STATE_CANT_OPEN &&
 227             vs->vs_aux == VDEV_AUX_VERSION_NEWER)
 228                 return (ZPOOL_STATUS_VERSION_NEWER);
 229 
 230         /*
 231          * Unsupported feature(s).
 232          */




 192         uint64_t version;
 193         uint64_t stateval;
 194         uint64_t suspended;
 195         uint64_t hostid = 0;
 196 
 197         verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION,
 198             &version) == 0);
 199         verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE,
 200             &nvroot) == 0);
 201         verify(nvlist_lookup_uint64_array(nvroot, ZPOOL_CONFIG_VDEV_STATS,
 202             (uint64_t **)&vs, &vsc) == 0);
 203         verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE,
 204             &stateval) == 0);
 205 
 206         /*
 207          * Currently resilvering a vdev
 208          */
 209         (void) nvlist_lookup_uint64_array(nvroot, ZPOOL_CONFIG_SCAN_STATS,
 210             (uint64_t **)&ps, &psc);
 211         if (ps && ps->pss_func == POOL_SCAN_RESILVER &&
 212             (ps->pss_state == DSS_SCANNING || ps->pss_state == DSS_FINISHING))
 213                 return (ZPOOL_STATUS_RESILVERING);
 214 
 215         /*
 216          * Pool last accessed by another system.
 217          */
 218         (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_HOSTID, &hostid);
 219         if (hostid != 0 && (unsigned long)hostid != gethostid() &&
 220             stateval == POOL_STATE_ACTIVE)
 221                 return (ZPOOL_STATUS_HOSTID_MISMATCH);
 222 
 223         /*
 224          * Newer on-disk version.
 225          */
 226         if (vs->vs_state == VDEV_STATE_CANT_OPEN &&
 227             vs->vs_aux == VDEV_AUX_VERSION_NEWER)
 228                 return (ZPOOL_STATUS_VERSION_NEWER);
 229 
 230         /*
 231          * Unsupported feature(s).
 232          */