Print this page
2882 implement libzfs_core
2883 changing "canmount" property to "on" should not always remount dataset
2900 "zfs snapshot" should be able to create multiple, arbitrary snapshots at once
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Chris Siden <christopher.siden@delphix.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Bill Pijewski <wdp@joyent.com>
Reviewed by: Dan Kruchinin <dan.kruchinin@gmail.com>


 211                         scn->scn_phys.scn_ddt_class_max = DDT_CLASS_DITTO;
 212 
 213         }
 214 
 215         /* back to the generic stuff */
 216 
 217         if (dp->dp_blkstats == NULL) {
 218                 dp->dp_blkstats =
 219                     kmem_alloc(sizeof (zfs_all_blkstats_t), KM_SLEEP);
 220         }
 221         bzero(dp->dp_blkstats, sizeof (zfs_all_blkstats_t));
 222 
 223         if (spa_version(spa) < SPA_VERSION_DSL_SCRUB)
 224                 ot = DMU_OT_ZAP_OTHER;
 225 
 226         scn->scn_phys.scn_queue_obj = zap_create(dp->dp_meta_objset,
 227             ot ? ot : DMU_OT_SCAN_QUEUE, DMU_OT_NONE, 0, tx);
 228 
 229         dsl_scan_sync_state(scn, tx);
 230 
 231         spa_history_log_internal(LOG_POOL_SCAN, spa, tx,
 232             "func=%u mintxg=%llu maxtxg=%llu",
 233             *funcp, scn->scn_phys.scn_min_txg, scn->scn_phys.scn_max_txg);
 234 }
 235 
 236 /* ARGSUSED */
 237 static void
 238 dsl_scan_done(dsl_scan_t *scn, boolean_t complete, dmu_tx_t *tx)
 239 {
 240         static const char *old_names[] = {
 241                 "scrub_bookmark",
 242                 "scrub_ddt_bookmark",
 243                 "scrub_ddt_class_max",
 244                 "scrub_queue",
 245                 "scrub_min_txg",
 246                 "scrub_max_txg",
 247                 "scrub_func",
 248                 "scrub_errors",
 249                 NULL
 250         };
 251 


 260         }
 261 
 262         if (scn->scn_phys.scn_queue_obj != 0) {
 263                 VERIFY(0 == dmu_object_free(dp->dp_meta_objset,
 264                     scn->scn_phys.scn_queue_obj, tx));
 265                 scn->scn_phys.scn_queue_obj = 0;
 266         }
 267 
 268         /*
 269          * If we were "restarted" from a stopped state, don't bother
 270          * with anything else.
 271          */
 272         if (scn->scn_phys.scn_state != DSS_SCANNING)
 273                 return;
 274 
 275         if (complete)
 276                 scn->scn_phys.scn_state = DSS_FINISHED;
 277         else
 278                 scn->scn_phys.scn_state = DSS_CANCELED;
 279 
 280         spa_history_log_internal(LOG_POOL_SCAN_DONE, spa, tx,
 281             "complete=%u", complete);
 282 
 283         if (DSL_SCAN_IS_SCRUB_RESILVER(scn)) {
 284                 mutex_enter(&spa->spa_scrub_lock);
 285                 while (spa->spa_scrub_inflight > 0) {
 286                         cv_wait(&spa->spa_scrub_io_cv,
 287                             &spa->spa_scrub_lock);
 288                 }
 289                 mutex_exit(&spa->spa_scrub_lock);
 290                 spa->spa_scrub_started = B_FALSE;
 291                 spa->spa_scrub_active = B_FALSE;
 292 
 293                 /*
 294                  * If the scrub/resilver completed, update all DTLs to
 295                  * reflect this.  Whether it succeeded or not, vacate
 296                  * all temporary scrub DTLs.
 297                  */
 298                 vdev_dtl_reassess(spa->spa_root_vdev, tx->tx_txg,
 299                     complete ? scn->scn_phys.scn_max_txg : 0, B_TRUE);
 300                 if (complete) {




 211                         scn->scn_phys.scn_ddt_class_max = DDT_CLASS_DITTO;
 212 
 213         }
 214 
 215         /* back to the generic stuff */
 216 
 217         if (dp->dp_blkstats == NULL) {
 218                 dp->dp_blkstats =
 219                     kmem_alloc(sizeof (zfs_all_blkstats_t), KM_SLEEP);
 220         }
 221         bzero(dp->dp_blkstats, sizeof (zfs_all_blkstats_t));
 222 
 223         if (spa_version(spa) < SPA_VERSION_DSL_SCRUB)
 224                 ot = DMU_OT_ZAP_OTHER;
 225 
 226         scn->scn_phys.scn_queue_obj = zap_create(dp->dp_meta_objset,
 227             ot ? ot : DMU_OT_SCAN_QUEUE, DMU_OT_NONE, 0, tx);
 228 
 229         dsl_scan_sync_state(scn, tx);
 230 
 231         spa_history_log_internal(spa, "scan setup", tx,
 232             "func=%u mintxg=%llu maxtxg=%llu",
 233             *funcp, scn->scn_phys.scn_min_txg, scn->scn_phys.scn_max_txg);
 234 }
 235 
 236 /* ARGSUSED */
 237 static void
 238 dsl_scan_done(dsl_scan_t *scn, boolean_t complete, dmu_tx_t *tx)
 239 {
 240         static const char *old_names[] = {
 241                 "scrub_bookmark",
 242                 "scrub_ddt_bookmark",
 243                 "scrub_ddt_class_max",
 244                 "scrub_queue",
 245                 "scrub_min_txg",
 246                 "scrub_max_txg",
 247                 "scrub_func",
 248                 "scrub_errors",
 249                 NULL
 250         };
 251 


 260         }
 261 
 262         if (scn->scn_phys.scn_queue_obj != 0) {
 263                 VERIFY(0 == dmu_object_free(dp->dp_meta_objset,
 264                     scn->scn_phys.scn_queue_obj, tx));
 265                 scn->scn_phys.scn_queue_obj = 0;
 266         }
 267 
 268         /*
 269          * If we were "restarted" from a stopped state, don't bother
 270          * with anything else.
 271          */
 272         if (scn->scn_phys.scn_state != DSS_SCANNING)
 273                 return;
 274 
 275         if (complete)
 276                 scn->scn_phys.scn_state = DSS_FINISHED;
 277         else
 278                 scn->scn_phys.scn_state = DSS_CANCELED;
 279 
 280         spa_history_log_internal(spa, "scan done", tx,
 281             "complete=%u", complete);
 282 
 283         if (DSL_SCAN_IS_SCRUB_RESILVER(scn)) {
 284                 mutex_enter(&spa->spa_scrub_lock);
 285                 while (spa->spa_scrub_inflight > 0) {
 286                         cv_wait(&spa->spa_scrub_io_cv,
 287                             &spa->spa_scrub_lock);
 288                 }
 289                 mutex_exit(&spa->spa_scrub_lock);
 290                 spa->spa_scrub_started = B_FALSE;
 291                 spa->spa_scrub_active = B_FALSE;
 292 
 293                 /*
 294                  * If the scrub/resilver completed, update all DTLs to
 295                  * reflect this.  Whether it succeeded or not, vacate
 296                  * all temporary scrub DTLs.
 297                  */
 298                 vdev_dtl_reassess(spa->spa_root_vdev, tx->tx_txg,
 299                     complete ? scn->scn_phys.scn_max_txg : 0, B_TRUE);
 300                 if (complete) {