-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DE249] Destroying all snapshot of rebuild clone dataset once rebuild completes #199
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -393,3 +393,44 @@ uzfs_zvol_get_or_create_internal_clone(zvol_state_t *zv, | |
strfree(snapname); | ||
return (ret); | ||
} | ||
|
||
/* | ||
* To destroy all internal created snapshot | ||
* on a dataset | ||
*/ | ||
int | ||
uzfs_destroy_internal_all_snap(zvol_state_t *zv) | ||
{ | ||
int ret; | ||
char snapname[MAXNAMELEN]; | ||
objset_t *os = zv->zv_objset; | ||
uint64_t obj = 0, cookie = 0; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. put a null check for zv. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
while (1) { | ||
dsl_pool_config_enter(spa_get_dsl(zv->zv_spa), FTAG); | ||
ret = dmu_snapshot_list_next(os, sizeof (snapname) - 1, | ||
snapname, &obj, &cookie, NULL); | ||
dsl_pool_config_exit(spa_get_dsl(zv->zv_spa), FTAG); | ||
|
||
if (ret) { | ||
if (ret == ENOENT) | ||
ret = 0; | ||
break; | ||
} | ||
|
||
if (!(strcmp(snapname, REBUILD_SNAPSHOT_SNAPNAME) == 0) && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we use internal_snapshot() here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
!(strncmp(snapname, IO_DIFF_SNAPNAME, | ||
sizeof (IO_DIFF_SNAPNAME) - 1) == 0)) { | ||
continue; | ||
} | ||
|
||
ret = destroy_snapshot_zv(zv, snapname); | ||
if (ret != 0) { | ||
LOG_ERR("Failed to destroy internal snap(%s) on:%s " | ||
"with err:%d", snapname, zv->zv_name, ret); | ||
break; | ||
} | ||
} | ||
|
||
return (ret); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name change to 'uzfs_destroy_all_internal_snapshots'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok