879 if (!isenabled) {
880 objset_t *os;
881
882 error = dsl_sync_task(name, dsl_destroy_head_check,
883 dsl_destroy_head_begin_sync, &ddha, 0);
884 if (error != 0)
885 return (error);
886
887 /*
888 * Head deletion is processed in one txg on old pools;
889 * remove the objects from open context so that the txg sync
890 * is not too long.
891 */
892 error = dmu_objset_own(name, DMU_OST_ANY, B_FALSE, FTAG, &os);
893 if (error == 0) {
894 uint64_t prev_snap_txg =
895 dmu_objset_ds(os)->ds_phys->ds_prev_snap_txg;
896 for (uint64_t obj = 0; error == 0;
897 error = dmu_object_next(os, &obj, FALSE,
898 prev_snap_txg))
899 (void) dmu_free_object(os, obj);
900 /* sync out all frees */
901 txg_wait_synced(dmu_objset_pool(os), 0);
902 dmu_objset_disown(os, FTAG);
903 }
904 }
905
906 return (dsl_sync_task(name, dsl_destroy_head_check,
907 dsl_destroy_head_sync, &ddha, 0));
908 }
909
910 /*
911 * Note, this function is used as the callback for dmu_objset_find(). We
912 * always return 0 so that we will continue to find and process
913 * inconsistent datasets, even if we encounter an error trying to
914 * process one of them.
915 */
916 /* ARGSUSED */
917 int
918 dsl_destroy_inconsistent(const char *dsname, void *arg)
919 {
|
879 if (!isenabled) {
880 objset_t *os;
881
882 error = dsl_sync_task(name, dsl_destroy_head_check,
883 dsl_destroy_head_begin_sync, &ddha, 0);
884 if (error != 0)
885 return (error);
886
887 /*
888 * Head deletion is processed in one txg on old pools;
889 * remove the objects from open context so that the txg sync
890 * is not too long.
891 */
892 error = dmu_objset_own(name, DMU_OST_ANY, B_FALSE, FTAG, &os);
893 if (error == 0) {
894 uint64_t prev_snap_txg =
895 dmu_objset_ds(os)->ds_phys->ds_prev_snap_txg;
896 for (uint64_t obj = 0; error == 0;
897 error = dmu_object_next(os, &obj, FALSE,
898 prev_snap_txg))
899 (void) dmu_free_long_object(os, obj);
900 /* sync out all frees */
901 txg_wait_synced(dmu_objset_pool(os), 0);
902 dmu_objset_disown(os, FTAG);
903 }
904 }
905
906 return (dsl_sync_task(name, dsl_destroy_head_check,
907 dsl_destroy_head_sync, &ddha, 0));
908 }
909
910 /*
911 * Note, this function is used as the callback for dmu_objset_find(). We
912 * always return 0 so that we will continue to find and process
913 * inconsistent datasets, even if we encounter an error trying to
914 * process one of them.
915 */
916 /* ARGSUSED */
917 int
918 dsl_destroy_inconsistent(const char *dsname, void *arg)
919 {
|