-
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
API to get condensed tree of modified blocks between two txg #6
Conversation
- changes in zvol zap update/read API for microzap checks Signed-off-by: mayank <[email protected]>
Signed-off-by: mayank <[email protected]>
@@ -61,8 +73,8 @@ uzfs_update_zap_entries(void *zvol, const uzfs_zap_kv_t **array, | |||
|
|||
for (i = 0; i < count; i++) { | |||
kv = array[i]; | |||
VERIFY0(zap_update(os, ZVOL_ZAP_OBJ, kv->key, 1, kv->size, | |||
kv->value, tx)); | |||
VERIFY0(zap_update(os, ZVOL_ZAP_OBJ, kv->key, kv->size, 1, |
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.
I understand our kv->size is 8 currently. But, its better to be (.., 1, kv->size,..) @mynktl incase if kv->size becomes greater than 8 later on. Same goes to below also.
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.
I kept it this way to avoid fat zap upgrade.
lib/libzpool/uzfs_zap.c
Outdated
@@ -50,6 +51,17 @@ uzfs_update_zap_entries(void *zvol, const uzfs_zap_kv_t **array, | |||
int err; | |||
int i = 0; | |||
|
|||
/* | |||
* check if key length is greater than MZAP_NAME_LEN. | |||
* key with MZAP_NAME_LEN+ length will convert microzap |
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.
Thanks @mynktl for these changes, so that, it won't become fat zap. Comment need to be fixed at this line.
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
lib/libzpool/uzfs_mtree.c
Outdated
}; | ||
|
||
void | ||
add_to_mblktree(avl_tree_t *tree, uint64_t boffset, uint64_t blen) |
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.
why tree called as mblktree..? also, add comments at each logic.
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.
it contains modified block's details, so i kept it as mblktree. I will add comments at each tree operation/logic.
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.
add_to_txg_diff_tree
snprintf(snapname, sizeof (snapname), "%s@%s%llu", zv->zv_name, | ||
TXG_DIFF_SNAPNAME, now); | ||
|
||
error = dsl_pool_hold(snapname, FTAG, &dp); |
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.
why don't we use dmu_objset_own rather than dsl_pool_hold & dsl_dataset_hold?
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.
here, we are traversing snapshot only, so we can avoid dmu_objset_own. Regarding snapshot destruction while we are traversing snapshot, we can use dsl_dataset_long_hold.
cmd/uzfs_test/uzfs_txg_diff.c
Outdated
} wblkinfo_t; | ||
|
||
int | ||
del_from_mblktree(avl_tree_t *tree, uint64_t offset, uint64_t len) |
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.
operations on tree can go into one file in lib/libzpool/
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.
in production code, we are not using this API. So, i didn't keep it in lib/libzpool. Once we need this, we will move this to lib/libzpool.
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.
changes looks good @mynktl .. but, we need to change data structures and functions names. Also, some more unit testing needed to see whether the traversal is returning correct values.
lib/libzpool/uzfs_mtree.c
Outdated
|
||
|
||
int | ||
uzfs_txg_block_diff(zvol_state_t *zv, uint64_t start_txg, uint64_t end_txg, |
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.
uzfs_get_txg_diff_tree
lib/libzpool/uzfs_mtree.c
Outdated
|
||
#define TXG_DIFF_SNAPNAME "tsnap" | ||
|
||
struct diff_txg_blk { |
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.
uzfs_txg_diff_cb_args_t
lib/libzpool/uzfs_mtree.c
Outdated
} | ||
|
||
int | ||
uzfs_changed_block_cb(spa_t *spa, zilog_t *zillog, const blkptr_t *bp, |
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.
uzfs_txg_diff_cb
lib/libzpool/uzfs_mtree.c
Outdated
#define TXG_DIFF_SNAPNAME "tsnap" | ||
|
||
struct diff_txg_blk { | ||
avl_tree_t *tree; |
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.
uzfs_txg_diff_tree
lib/libzpool/uzfs_mtree.c
Outdated
} | ||
|
||
static int | ||
zvol_blk_off_cmpr(const void *arg1, const void *arg2) |
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.
uzfs_txg_diff_tree_compare
cmd/uzfs_test/uzfs_txg_diff.c
Outdated
} | ||
|
||
void | ||
uzfs_zvol_txg_diff_blk_test(void *arg) |
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.
uzfs_txg_diff_test
Signed-off-by: mayank <[email protected]>
Signed-off-by: mayank <[email protected]>
@vishnuitta I have updated PR with review comments.
|
cmd/uzfs_test/uzfs_txg_diff.c
Outdated
io_num++; | ||
blk_offset = uzfs_random(vol_blocks - 16); | ||
/* | ||
* make sure offset is aligned to block size | ||
*/ | ||
offset = ((blk_offset * blksz + block_size) / |
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.
offset can be just blk_offset * block_size
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.
also, have a test case with less active size (probably for 30K or 50K blocks), so that, collisions/merges of tree can be verified
cmd/uzfs_test/uzfs_txg_diff.c
Outdated
offset_matched = B_TRUE; | ||
break; | ||
} | ||
if (temp_blk->offset + temp_blk->len == |
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.
this condition is not required at all
cmd/uzfs_test/uzfs_txg_diff.c
Outdated
@@ -166,16 +186,37 @@ uzfs_zvol_txg_diff_blk_test(void *arg) | |||
|
|||
while (i++ < test_iterations) { | |||
count = 0; | |||
max_io = MAX(uzfs_random(100), 5); |
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.
make it as 10K..
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.
changes looks good Mayank. Just take care of those minor comments.
modified blocks between two txg - fix for active_size/vol_size argument parsing in uzfs_test Signed-off-by: mayank <[email protected]>
[CCS-68] travis integration with ZoL
- API to get condensed tree of modified blocks between two txg Signed-off-by: mayank <[email protected]>
Description
API to get condense tree of modified blocks between two txg
Changes in ZVOL ZAP update/read API regarding microzap
Added uzfs_txg_block_diff API, which will return condensed tree of changed blocks
between two txg.
In ZVOL ZAP update/read API, value changed to 64bit unsigned integer instead of char *.
How Has This Been Tested?
Unit test are added to test this change with uzfs_test.
To test this change :
Types of changes
Checklist:
Signed-off-by
.