mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 19:28:53 +03:00
Provide macros for setting and getting blkptr birth times
There exist a couple of macros that are used to update the blkptr birth times but they can often be confusing. For example, the BP_PHYSICAL_BIRTH() macro will provide either the physical birth time if it is set or else return back the logical birth time. The complement to this macro is BP_SET_BIRTH() which will set the logical birth time and set the physical birth time if they are not the same. Consumers may get confused when they are trying to get the physical birth time and use the BP_PHYSICAL_BIRTH() macro only to find out that the logical birth time is what is actually returned. This change cleans up these macros and makes them symmetrical. The same functionally is preserved but the name is changed. Instead of calling BP_PHYSICAL_BIRTH(), consumer can now call BP_GET_BIRTH(). In additional to cleaning up this naming conventions, two new sets of macros are introduced -- BP_[SET|GET]_LOGICAL_BIRTH() and BP_[SET|GET]_PHYSICAL_BIRTH. These new macros allow the consumer to get and set the specific birth time. As part of the cleanup, the unused GRID macros have been removed and that portion of the blkptr are currently unused. Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Mark Maybee <mark.maybee@delphix.com> Signed-off-by: George Wilson <gwilson@delphix.com> Closes #15962
This commit is contained in:
+17
-14
@@ -429,8 +429,8 @@ sio2bp(const scan_io_t *sio, blkptr_t *bp)
|
||||
{
|
||||
memset(bp, 0, sizeof (*bp));
|
||||
bp->blk_prop = sio->sio_blk_prop;
|
||||
bp->blk_phys_birth = sio->sio_phys_birth;
|
||||
bp->blk_birth = sio->sio_birth;
|
||||
BP_SET_PHYSICAL_BIRTH(bp, sio->sio_phys_birth);
|
||||
BP_SET_LOGICAL_BIRTH(bp, sio->sio_birth);
|
||||
bp->blk_fill = 1; /* we always only work with data pointers */
|
||||
bp->blk_cksum = sio->sio_cksum;
|
||||
|
||||
@@ -444,8 +444,8 @@ static inline void
|
||||
bp2sio(const blkptr_t *bp, scan_io_t *sio, int dva_i)
|
||||
{
|
||||
sio->sio_blk_prop = bp->blk_prop;
|
||||
sio->sio_phys_birth = bp->blk_phys_birth;
|
||||
sio->sio_birth = bp->blk_birth;
|
||||
sio->sio_phys_birth = BP_GET_PHYSICAL_BIRTH(bp);
|
||||
sio->sio_birth = BP_GET_LOGICAL_BIRTH(bp);
|
||||
sio->sio_cksum = bp->blk_cksum;
|
||||
sio->sio_nr_dvas = BP_GET_NDVAS(bp);
|
||||
|
||||
@@ -1721,7 +1721,8 @@ dsl_scan_zil_block(zilog_t *zilog, const blkptr_t *bp, void *arg,
|
||||
zbookmark_phys_t zb;
|
||||
|
||||
ASSERT(!BP_IS_REDACTED(bp));
|
||||
if (BP_IS_HOLE(bp) || bp->blk_birth <= scn->scn_phys.scn_cur_min_txg)
|
||||
if (BP_IS_HOLE(bp) ||
|
||||
BP_GET_LOGICAL_BIRTH(bp) <= scn->scn_phys.scn_cur_min_txg)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
@@ -1730,7 +1731,8 @@ dsl_scan_zil_block(zilog_t *zilog, const blkptr_t *bp, void *arg,
|
||||
* (on-disk) even if it hasn't been claimed (even though for
|
||||
* scrub there's nothing to do to it).
|
||||
*/
|
||||
if (claim_txg == 0 && bp->blk_birth >= spa_min_claim_txg(dp->dp_spa))
|
||||
if (claim_txg == 0 &&
|
||||
BP_GET_LOGICAL_BIRTH(bp) >= spa_min_claim_txg(dp->dp_spa))
|
||||
return (0);
|
||||
|
||||
SET_BOOKMARK(&zb, zh->zh_log.blk_cksum.zc_word[ZIL_ZC_OBJSET],
|
||||
@@ -1756,7 +1758,7 @@ dsl_scan_zil_record(zilog_t *zilog, const lr_t *lrc, void *arg,
|
||||
|
||||
ASSERT(!BP_IS_REDACTED(bp));
|
||||
if (BP_IS_HOLE(bp) ||
|
||||
bp->blk_birth <= scn->scn_phys.scn_cur_min_txg)
|
||||
BP_GET_LOGICAL_BIRTH(bp) <= scn->scn_phys.scn_cur_min_txg)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
@@ -1764,7 +1766,7 @@ dsl_scan_zil_record(zilog_t *zilog, const lr_t *lrc, void *arg,
|
||||
* already txg sync'ed (but this log block contains
|
||||
* other records that are not synced)
|
||||
*/
|
||||
if (claim_txg == 0 || bp->blk_birth < claim_txg)
|
||||
if (claim_txg == 0 || BP_GET_LOGICAL_BIRTH(bp) < claim_txg)
|
||||
return (0);
|
||||
|
||||
ASSERT3U(BP_GET_LSIZE(bp), !=, 0);
|
||||
@@ -1903,7 +1905,8 @@ dsl_scan_prefetch(scan_prefetch_ctx_t *spc, blkptr_t *bp, zbookmark_phys_t *zb)
|
||||
if (zfs_no_scrub_prefetch || BP_IS_REDACTED(bp))
|
||||
return;
|
||||
|
||||
if (BP_IS_HOLE(bp) || bp->blk_birth <= scn->scn_phys.scn_cur_min_txg ||
|
||||
if (BP_IS_HOLE(bp) ||
|
||||
BP_GET_LOGICAL_BIRTH(bp) <= scn->scn_phys.scn_cur_min_txg ||
|
||||
(BP_GET_LEVEL(bp) == 0 && BP_GET_TYPE(bp) != DMU_OT_DNODE &&
|
||||
BP_GET_TYPE(bp) != DMU_OT_OBJSET))
|
||||
return;
|
||||
@@ -2174,7 +2177,7 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype,
|
||||
if (dnp != NULL &&
|
||||
dnp->dn_bonuslen > DN_MAX_BONUS_LEN(dnp)) {
|
||||
scn->scn_phys.scn_errors++;
|
||||
spa_log_error(spa, zb, &bp->blk_birth);
|
||||
spa_log_error(spa, zb, BP_GET_LOGICAL_BIRTH(bp));
|
||||
return (SET_ERROR(EINVAL));
|
||||
}
|
||||
|
||||
@@ -2270,7 +2273,7 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype,
|
||||
* by arc_read() for the cases above.
|
||||
*/
|
||||
scn->scn_phys.scn_errors++;
|
||||
spa_log_error(spa, zb, &bp->blk_birth);
|
||||
spa_log_error(spa, zb, BP_GET_LOGICAL_BIRTH(bp));
|
||||
return (SET_ERROR(EINVAL));
|
||||
}
|
||||
|
||||
@@ -2347,7 +2350,7 @@ dsl_scan_visitbp(const blkptr_t *bp, const zbookmark_phys_t *zb,
|
||||
if (f != SPA_FEATURE_NONE)
|
||||
ASSERT(dsl_dataset_feature_is_active(ds, f));
|
||||
|
||||
if (bp->blk_birth <= scn->scn_phys.scn_cur_min_txg) {
|
||||
if (BP_GET_LOGICAL_BIRTH(bp) <= scn->scn_phys.scn_cur_min_txg) {
|
||||
scn->scn_lt_min_this_txg++;
|
||||
return;
|
||||
}
|
||||
@@ -2373,7 +2376,7 @@ dsl_scan_visitbp(const blkptr_t *bp, const zbookmark_phys_t *zb,
|
||||
* Don't scan it now unless we need to because something
|
||||
* under it was modified.
|
||||
*/
|
||||
if (BP_PHYSICAL_BIRTH(bp) > scn->scn_phys.scn_cur_max_txg) {
|
||||
if (BP_GET_BIRTH(bp) > scn->scn_phys.scn_cur_max_txg) {
|
||||
scn->scn_gt_max_this_txg++;
|
||||
return;
|
||||
}
|
||||
@@ -4714,7 +4717,7 @@ dsl_scan_scrub_cb(dsl_pool_t *dp,
|
||||
{
|
||||
dsl_scan_t *scn = dp->dp_scan;
|
||||
spa_t *spa = dp->dp_spa;
|
||||
uint64_t phys_birth = BP_PHYSICAL_BIRTH(bp);
|
||||
uint64_t phys_birth = BP_GET_BIRTH(bp);
|
||||
size_t psize = BP_GET_PSIZE(bp);
|
||||
boolean_t needs_io = B_FALSE;
|
||||
int zio_flags = ZIO_FLAG_SCAN_THREAD | ZIO_FLAG_RAW | ZIO_FLAG_CANFAIL;
|
||||
|
||||
Reference in New Issue
Block a user