dmu_traverse.c (259813) | dmu_traverse.c (260150) |
---|---|
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 --- 22 unchanged lines hidden (view full) --- 31#include <sys/dsl_pool.h> 32#include <sys/dnode.h> 33#include <sys/spa.h> 34#include <sys/zio.h> 35#include <sys/dmu_impl.h> 36#include <sys/sa.h> 37#include <sys/sa_impl.h> 38#include <sys/callb.h> | 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 --- 22 unchanged lines hidden (view full) --- 31#include <sys/dsl_pool.h> 32#include <sys/dnode.h> 33#include <sys/spa.h> 34#include <sys/zio.h> 35#include <sys/dmu_impl.h> 36#include <sys/sa.h> 37#include <sys/sa_impl.h> 38#include <sys/callb.h> |
39#include <sys/zfeature.h> |
|
39 40int zfs_pd_blks_max = 100; 41 42typedef struct prefetch_data { 43 kmutex_t pd_mtx; 44 kcondvar_t pd_cv; 45 int pd_blks_max; 46 int pd_blks_fetched; --- 20 unchanged lines hidden (view full) --- 67 uint64_t objset, uint64_t object); 68 69static int 70traverse_zil_block(zilog_t *zilog, blkptr_t *bp, void *arg, uint64_t claim_txg) 71{ 72 traverse_data_t *td = arg; 73 zbookmark_t zb; 74 | 40 41int zfs_pd_blks_max = 100; 42 43typedef struct prefetch_data { 44 kmutex_t pd_mtx; 45 kcondvar_t pd_cv; 46 int pd_blks_max; 47 int pd_blks_fetched; --- 20 unchanged lines hidden (view full) --- 68 uint64_t objset, uint64_t object); 69 70static int 71traverse_zil_block(zilog_t *zilog, blkptr_t *bp, void *arg, uint64_t claim_txg) 72{ 73 traverse_data_t *td = arg; 74 zbookmark_t zb; 75 |
75 if (bp->blk_birth == 0) | 76 if (BP_IS_HOLE(bp)) |
76 return (0); 77 78 if (claim_txg == 0 && bp->blk_birth >= spa_first_txg(td->td_spa)) 79 return (0); 80 81 SET_BOOKMARK(&zb, td->td_objset, ZB_ZIL_OBJECT, ZB_ZIL_LEVEL, 82 bp->blk_cksum.zc_word[ZIL_ZC_SEQ]); 83 --- 7 unchanged lines hidden (view full) --- 91{ 92 traverse_data_t *td = arg; 93 94 if (lrc->lrc_txtype == TX_WRITE) { 95 lr_write_t *lr = (lr_write_t *)lrc; 96 blkptr_t *bp = &lr->lr_blkptr; 97 zbookmark_t zb; 98 | 77 return (0); 78 79 if (claim_txg == 0 && bp->blk_birth >= spa_first_txg(td->td_spa)) 80 return (0); 81 82 SET_BOOKMARK(&zb, td->td_objset, ZB_ZIL_OBJECT, ZB_ZIL_LEVEL, 83 bp->blk_cksum.zc_word[ZIL_ZC_SEQ]); 84 --- 7 unchanged lines hidden (view full) --- 92{ 93 traverse_data_t *td = arg; 94 95 if (lrc->lrc_txtype == TX_WRITE) { 96 lr_write_t *lr = (lr_write_t *)lrc; 97 blkptr_t *bp = &lr->lr_blkptr; 98 zbookmark_t zb; 99 |
99 if (bp->blk_birth == 0) | 100 if (BP_IS_HOLE(bp)) |
100 return (0); 101 102 if (claim_txg == 0 || bp->blk_birth < claim_txg) 103 return (0); 104 105 SET_BOOKMARK(&zb, td->td_objset, lr->lr_foid, 106 ZB_ZIL_LEVEL, lr->lr_offset / BP_GET_LSIZE(bp)); 107 --- 113 unchanged lines hidden (view full) --- 221 case RESUME_SKIP_CHILDREN: 222 goto post; 223 case RESUME_SKIP_NONE: 224 break; 225 default: 226 ASSERT(0); 227 } 228 | 101 return (0); 102 103 if (claim_txg == 0 || bp->blk_birth < claim_txg) 104 return (0); 105 106 SET_BOOKMARK(&zb, td->td_objset, lr->lr_foid, 107 ZB_ZIL_LEVEL, lr->lr_offset / BP_GET_LSIZE(bp)); 108 --- 113 unchanged lines hidden (view full) --- 222 case RESUME_SKIP_CHILDREN: 223 goto post; 224 case RESUME_SKIP_NONE: 225 break; 226 default: 227 ASSERT(0); 228 } 229 |
230 if (bp->blk_birth == 0) { 231 if (spa_feature_is_active(td->td_spa, SPA_FEATURE_HOLE_BIRTH)) { 232 /* 233 * Since this block has a birth time of 0 it must be a 234 * hole created before the SPA_FEATURE_HOLE_BIRTH 235 * feature was enabled. If SPA_FEATURE_HOLE_BIRTH 236 * was enabled before the min_txg for this traveral we 237 * know the hole must have been created before the 238 * min_txg for this traveral, so we can skip it. If 239 * SPA_FEATURE_HOLE_BIRTH was enabled after the min_txg 240 * for this traveral we cannot tell if the hole was 241 * created before or after the min_txg for this 242 * traversal, so we cannot skip it. 243 */ 244 uint64_t hole_birth_enabled_txg; 245 VERIFY(spa_feature_enabled_txg(td->td_spa, 246 SPA_FEATURE_HOLE_BIRTH, &hole_birth_enabled_txg)); 247 if (hole_birth_enabled_txg < td->td_min_txg) 248 return (0); 249 } 250 } else if (bp->blk_birth <= td->td_min_txg) { 251 return (0); 252 } 253 |
|
229 if (BP_IS_HOLE(bp)) { | 254 if (BP_IS_HOLE(bp)) { |
230 err = td->td_func(td->td_spa, NULL, NULL, zb, dnp, td->td_arg); | 255 err = td->td_func(td->td_spa, NULL, bp, zb, dnp, td->td_arg); |
231 return (err); 232 } 233 | 256 return (err); 257 } 258 |
234 if (bp->blk_birth <= td->td_min_txg) 235 return (0); 236 | |
237 if (pd && !pd->pd_exited && 238 ((pd->pd_flags & TRAVERSE_PREFETCH_DATA) || 239 BP_GET_TYPE(bp) == DMU_OT_DNODE || BP_GET_LEVEL(bp) > 0)) { 240 mutex_enter(&pd->pd_mtx); 241 ASSERT(pd->pd_blks_fetched >= 0); 242 while (pd->pd_blks_fetched == 0 && !pd->pd_exited) 243 cv_wait(&pd->pd_cv, &pd->pd_mtx); 244 pd->pd_blks_fetched--; --- 186 unchanged lines hidden (view full) --- 431{ 432 prefetch_data_t *pfd = arg; 433 uint32_t aflags = ARC_NOWAIT | ARC_PREFETCH; 434 435 ASSERT(pfd->pd_blks_fetched >= 0); 436 if (pfd->pd_cancel) 437 return (SET_ERROR(EINTR)); 438 | 259 if (pd && !pd->pd_exited && 260 ((pd->pd_flags & TRAVERSE_PREFETCH_DATA) || 261 BP_GET_TYPE(bp) == DMU_OT_DNODE || BP_GET_LEVEL(bp) > 0)) { 262 mutex_enter(&pd->pd_mtx); 263 ASSERT(pd->pd_blks_fetched >= 0); 264 while (pd->pd_blks_fetched == 0 && !pd->pd_exited) 265 cv_wait(&pd->pd_cv, &pd->pd_mtx); 266 pd->pd_blks_fetched--; --- 186 unchanged lines hidden (view full) --- 453{ 454 prefetch_data_t *pfd = arg; 455 uint32_t aflags = ARC_NOWAIT | ARC_PREFETCH; 456 457 ASSERT(pfd->pd_blks_fetched >= 0); 458 if (pfd->pd_cancel) 459 return (SET_ERROR(EINTR)); 460 |
439 if (bp == NULL || !((pfd->pd_flags & TRAVERSE_PREFETCH_DATA) || | 461 if (BP_IS_HOLE(bp) || 462 !((pfd->pd_flags & TRAVERSE_PREFETCH_DATA) || |
440 BP_GET_TYPE(bp) == DMU_OT_DNODE || BP_GET_LEVEL(bp) > 0) || 441 BP_GET_TYPE(bp) == DMU_OT_INTENT_LOG) 442 return (0); 443 444 mutex_enter(&pfd->pd_mtx); 445 while (!pfd->pd_cancel && pfd->pd_blks_fetched >= pfd->pd_blks_max) 446 cv_wait(&pfd->pd_cv, &pfd->pd_mtx); 447 pfd->pd_blks_fetched++; --- 188 unchanged lines hidden --- | 463 BP_GET_TYPE(bp) == DMU_OT_DNODE || BP_GET_LEVEL(bp) > 0) || 464 BP_GET_TYPE(bp) == DMU_OT_INTENT_LOG) 465 return (0); 466 467 mutex_enter(&pfd->pd_mtx); 468 while (!pfd->pd_cancel && pfd->pd_blks_fetched >= pfd->pd_blks_max) 469 cv_wait(&pfd->pd_cv, &pfd->pd_mtx); 470 pfd->pd_blks_fetched++; --- 188 unchanged lines hidden --- |