Skip to content

Commit

Permalink
use the same pattern for in-memory and on-disk queues
Browse files Browse the repository at this point in the history
  • Loading branch information
avg-I committed Aug 29, 2019
1 parent cb1d2b9 commit 5bd8f78
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions module/zfs/dsl_scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2193,17 +2193,35 @@ dsl_scan_ds_clone_swapped(dsl_dataset_t *ds1, dsl_dataset_t *ds2, dmu_tx_t *tx)
ds_clone_swapped_bookmark(ds1, ds2, &scn->scn_phys.scn_bookmark);
ds_clone_swapped_bookmark(ds1, ds2, &scn->scn_phys_cached.scn_bookmark);

/*
* Handle the in-memory scan queue.
*/
ds1_queued = scan_ds_queue_contains(scn, ds1->ds_object, &mintxg1);
ds2_queued = scan_ds_queue_contains(scn, ds2->ds_object, &mintxg2);
if (ds1_queued)

/* Sanity checking. */
if (ds1_queued) {
ASSERT3U(mintxg1, ==, dsl_dataset_phys(ds1)->ds_prev_snap_txg);
ASSERT3U(mintxg1, ==, dsl_dataset_phys(ds2)->ds_prev_snap_txg);
}
if (ds2_queued) {
ASSERT3U(mintxg2, ==, dsl_dataset_phys(ds1)->ds_prev_snap_txg);
ASSERT3U(mintxg2, ==, dsl_dataset_phys(ds2)->ds_prev_snap_txg);
}

if (ds1_queued && ds2_queued) {
/* Nothing to do if both are queued (or both are not queued). */
} else if (ds1_queued) {
scan_ds_queue_remove(scn, ds1->ds_object);
if (ds2_queued)
scan_ds_queue_remove(scn, ds2->ds_object);
if (ds1_queued)
scan_ds_queue_insert(scn, ds2->ds_object, mintxg1);
if (ds2_queued)
} else if (ds2_queued) {
scan_ds_queue_remove(scn, ds2->ds_object);
scan_ds_queue_insert(scn, ds1->ds_object, mintxg2);
}

/*
* Handle the on-disk scan queue.
*/
ds1_queued = zap_lookup_int_key(dp->dp_meta_objset,
scn->scn_phys.scn_queue_obj, ds1->ds_object, &mintxg1) == 0;
ds2_queued = zap_lookup_int_key(dp->dp_meta_objset,
Expand Down

0 comments on commit 5bd8f78

Please sign in to comment.