/* Doesn't do anything here. */ int dm_target_snapshot_destroy(dm_table_entry_t * table_en) { dm_target_snapshot_config_t *tsc; /* * Destroy function is called for every target even if it * doesn't have target_config. */ if (table_en->target_config == NULL) return 0; printf("Snapshot target destroy function called\n"); tsc = table_en->target_config; /* Decrement pdev ref counter if 0 remove it */ dm_pdev_decr(tsc->tsc_snap_dev); if (tsc->tsc_persistent_dev) dm_pdev_decr(tsc->tsc_cow_dev); /* Unbusy target so we can unload it */ dm_target_unbusy(table_en->target); kmem_free(table_en->target_config, sizeof(dm_target_snapshot_config_t)); table_en->target_config = NULL; return 0; }
/* Decrement pdev and free allocated space. */ int dm_target_snapshot_orig_destroy(dm_table_entry_t * table_en) { dm_target_snapshot_origin_config_t *tsoc; /* * Destroy function is called for every target even if it * doesn't have target_config. */ if (table_en->target_config == NULL) return 0; tsoc = table_en->target_config; /* Decrement pdev ref counter if 0 remove it */ dm_pdev_decr(tsoc->tsoc_real_dev); /* Unbusy target so we can unload it */ dm_target_unbusy(table_en->target); kmem_free(table_en->target_config, sizeof(dm_target_snapshot_origin_config_t)); table_en->target_config = NULL; return 0; }
/* * Destroy target specific data. Decrement table pdevs. */ static int dm_target_linear_destroy(dm_table_entry_t * table_en) { dm_target_linear_config_t *tlc; /* * Destroy function is called for every target even if it * doesn't have target_config. */ if (table_en->target_config == NULL) return 0; tlc = table_en->target_config; /* Decrement pdev ref counter if 0 remove it */ dm_pdev_decr(tlc->pdev); /* Unbusy target so we can unload it */ dm_target_unbusy(table_en->target); kfree(table_en->target_config, M_DMLINEAR); table_en->target_config = NULL; return 0; }
static void dm_target_stripe_destroy_config(dm_target_stripe_config_t *tsc) { int n; for (n = 0; n < tsc->stripe_num; ++n) { if (tsc->stripe_devs[n].pdev) { dm_pdev_decr(tsc->stripe_devs[n].pdev); tsc->stripe_devs[n].pdev = NULL; } } kfree(tsc, M_DMSTRIPE); }