bpobj.c (259813) | bpobj.c (268075) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 178 unchanged lines hidden (view full) --- 187 bpo->bpo_dbuf = NULL; 188 bpo->bpo_phys = NULL; 189 bpo->bpo_cached_dbuf = NULL; 190 bpo->bpo_object = 0; 191 192 mutex_destroy(&bpo->bpo_lock); 193} 194 | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 178 unchanged lines hidden (view full) --- 187 bpo->bpo_dbuf = NULL; 188 bpo->bpo_phys = NULL; 189 bpo->bpo_cached_dbuf = NULL; 190 bpo->bpo_object = 0; 191 192 mutex_destroy(&bpo->bpo_lock); 193} 194 |
195static boolean_t 196bpobj_hasentries(bpobj_t *bpo) 197{ 198 return (bpo->bpo_phys->bpo_num_blkptrs != 0 || 199 (bpo->bpo_havesubobj && bpo->bpo_phys->bpo_num_subobjs != 0)); 200} 201 |
|
195static int 196bpobj_iterate_impl(bpobj_t *bpo, bpobj_itor_t func, void *arg, dmu_tx_t *tx, 197 boolean_t free) 198{ 199 dmu_object_info_t doi; 200 int epb; 201 int64_t i; 202 int err = 0; --- 124 unchanged lines hidden (view full) --- 327 if (free) { 328 VERIFY3U(0, ==, dmu_free_range(bpo->bpo_os, 329 bpo->bpo_phys->bpo_subobjs, 330 (i + 1) * sizeof (uint64_t), -1ULL, tx)); 331 } 332 333out: 334 /* If there are no entries, there should be no bytes. */ | 202static int 203bpobj_iterate_impl(bpobj_t *bpo, bpobj_itor_t func, void *arg, dmu_tx_t *tx, 204 boolean_t free) 205{ 206 dmu_object_info_t doi; 207 int epb; 208 int64_t i; 209 int err = 0; --- 124 unchanged lines hidden (view full) --- 334 if (free) { 335 VERIFY3U(0, ==, dmu_free_range(bpo->bpo_os, 336 bpo->bpo_phys->bpo_subobjs, 337 (i + 1) * sizeof (uint64_t), -1ULL, tx)); 338 } 339 340out: 341 /* If there are no entries, there should be no bytes. */ |
335 ASSERT(bpo->bpo_phys->bpo_num_blkptrs > 0 || 336 (bpo->bpo_havesubobj && bpo->bpo_phys->bpo_num_subobjs > 0) || 337 bpo->bpo_phys->bpo_bytes == 0); | 342 if (!bpobj_hasentries(bpo)) { 343 ASSERT0(bpo->bpo_phys->bpo_bytes); 344 ASSERT0(bpo->bpo_phys->bpo_comp); 345 ASSERT0(bpo->bpo_phys->bpo_uncomp); 346 } |
338 339 mutex_exit(&bpo->bpo_lock); 340 return (err); 341} 342 343/* 344 * Iterate and remove the entries. If func returns nonzero, iteration 345 * will stop and that entry will not be removed. --- 26 unchanged lines hidden (view full) --- 372 if (subobj == dmu_objset_pool(bpo->bpo_os)->dp_empty_bpobj) { 373 bpobj_decr_empty(bpo->bpo_os, tx); 374 return; 375 } 376 377 VERIFY3U(0, ==, bpobj_open(&subbpo, bpo->bpo_os, subobj)); 378 VERIFY3U(0, ==, bpobj_space(&subbpo, &used, &comp, &uncomp)); 379 | 347 348 mutex_exit(&bpo->bpo_lock); 349 return (err); 350} 351 352/* 353 * Iterate and remove the entries. If func returns nonzero, iteration 354 * will stop and that entry will not be removed. --- 26 unchanged lines hidden (view full) --- 381 if (subobj == dmu_objset_pool(bpo->bpo_os)->dp_empty_bpobj) { 382 bpobj_decr_empty(bpo->bpo_os, tx); 383 return; 384 } 385 386 VERIFY3U(0, ==, bpobj_open(&subbpo, bpo->bpo_os, subobj)); 387 VERIFY3U(0, ==, bpobj_space(&subbpo, &used, &comp, &uncomp)); 388 |
380 if (used == 0) { | 389 if (!bpobj_hasentries(&subbpo)) { |
381 /* No point in having an empty subobj. */ 382 bpobj_close(&subbpo); 383 bpobj_free(bpo->bpo_os, subobj, tx); 384 return; 385 } 386 387 dmu_buf_will_dirty(bpo->bpo_dbuf, tx); 388 if (bpo->bpo_phys->bpo_subobjs == 0) { --- 59 unchanged lines hidden (view full) --- 448 blkptr_t stored_bp = *bp; 449 uint64_t offset; 450 int blkoff; 451 blkptr_t *bparray; 452 453 ASSERT(!BP_IS_HOLE(bp)); 454 ASSERT(bpo->bpo_object != dmu_objset_pool(bpo->bpo_os)->dp_empty_bpobj); 455 | 390 /* No point in having an empty subobj. */ 391 bpobj_close(&subbpo); 392 bpobj_free(bpo->bpo_os, subobj, tx); 393 return; 394 } 395 396 dmu_buf_will_dirty(bpo->bpo_dbuf, tx); 397 if (bpo->bpo_phys->bpo_subobjs == 0) { --- 59 unchanged lines hidden (view full) --- 457 blkptr_t stored_bp = *bp; 458 uint64_t offset; 459 int blkoff; 460 blkptr_t *bparray; 461 462 ASSERT(!BP_IS_HOLE(bp)); 463 ASSERT(bpo->bpo_object != dmu_objset_pool(bpo->bpo_os)->dp_empty_bpobj); 464 |
465 if (BP_IS_EMBEDDED(bp)) { 466 /* 467 * The bpobj will compress better without the payload. 468 * 469 * Note that we store EMBEDDED bp's because they have an 470 * uncompressed size, which must be accounted for. An 471 * alternative would be to add their size to bpo_uncomp 472 * without storing the bp, but that would create additional 473 * complications: bpo_uncomp would be inconsistent with the 474 * set of BP's stored, and bpobj_iterate() wouldn't visit 475 * all the space accounted for in the bpobj. 476 */ 477 bzero(&stored_bp, sizeof (stored_bp)); 478 stored_bp.blk_prop = bp->blk_prop; 479 stored_bp.blk_birth = bp->blk_birth; 480 } else if (!BP_GET_DEDUP(bp)) { 481 /* The bpobj will compress better without the checksum */ 482 bzero(&stored_bp.blk_cksum, sizeof (stored_bp.blk_cksum)); 483 } 484 |
|
456 /* We never need the fill count. */ 457 stored_bp.blk_fill = 0; 458 | 485 /* We never need the fill count. */ 486 stored_bp.blk_fill = 0; 487 |
459 /* The bpobj will compress better if we can leave off the checksum */ 460 if (!BP_GET_DEDUP(bp)) 461 bzero(&stored_bp.blk_cksum, sizeof (stored_bp.blk_cksum)); 462 | |
463 mutex_enter(&bpo->bpo_lock); 464 465 offset = bpo->bpo_phys->bpo_num_blkptrs * sizeof (stored_bp); 466 blkoff = P2PHASE(bpo->bpo_phys->bpo_num_blkptrs, bpo->bpo_epb); 467 468 if (bpo->bpo_cached_dbuf == NULL || 469 offset < bpo->bpo_cached_dbuf->db_offset || 470 offset >= bpo->bpo_cached_dbuf->db_offset + --- 94 unchanged lines hidden --- | 488 mutex_enter(&bpo->bpo_lock); 489 490 offset = bpo->bpo_phys->bpo_num_blkptrs * sizeof (stored_bp); 491 blkoff = P2PHASE(bpo->bpo_phys->bpo_num_blkptrs, bpo->bpo_epb); 492 493 if (bpo->bpo_cached_dbuf == NULL || 494 offset < bpo->bpo_cached_dbuf->db_offset || 495 offset >= bpo->bpo_cached_dbuf->db_offset + --- 94 unchanged lines hidden --- |