Skip to content

Commit a4069ee

Browse files
Prakash Suryabehlendorf
authored andcommitted
Illumos 5695 - dmu_sync'ed holes do not retain birth time
5695 dmu_sync'ed holes do not retain birth time Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: George Wilson <george@delphix.com> Reviewed by: Christopher Siden <christopher.siden@delphix.com> Reviewed by: Bayard Bell <buffer.g.overflow@gmail.com> Approved by: Dan McDonald <danmcd@omniti.com> References: https://www.illumos.org/issues/5695 illumos/illumos-gate@70163ac Ported-by: Chris Dunlop <chris@onthe.net.au> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #3229
1 parent 9540be9 commit a4069ee

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

cmd/zdb/zdb.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,9 @@ snprintf_blkptr_compact(char *blkbuf, size_t buflen, const blkptr_t *bp)
11151115

11161116
if (BP_IS_HOLE(bp)) {
11171117
(void) snprintf(blkbuf + strlen(blkbuf),
1118-
buflen - strlen(blkbuf), "B=%llu",
1118+
buflen - strlen(blkbuf),
1119+
"%llxL B=%llu",
1120+
(u_longlong_t)BP_GET_LSIZE(bp),
11191121
(u_longlong_t)bp->blk_birth);
11201122
} else {
11211123
(void) snprintf(blkbuf + strlen(blkbuf),

include/sys/spa.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -501,12 +501,13 @@ _NOTE(CONSTCOND) } while (0)
501501
if (bp == NULL) { \
502502
len += func(buf + len, size - len, "<NULL>"); \
503503
} else if (BP_IS_HOLE(bp)) { \
504-
len += func(buf + len, size - len, "<hole>"); \
505-
if (bp->blk_birth > 0) { \
506-
len += func(buf + len, size - len, \
507-
" birth=%lluL", \
508-
(u_longlong_t)bp->blk_birth); \
509-
} \
504+
len += func(buf + len, size - len, \
505+
"HOLE [L%llu %s] " \
506+
"size=%llxL birth=%lluL", \
507+
(u_longlong_t)BP_GET_LEVEL(bp), \
508+
type, \
509+
(u_longlong_t)BP_GET_LSIZE(bp), \
510+
(u_longlong_t)bp->blk_birth); \
510511
} else if (BP_IS_EMBEDDED(bp)) { \
511512
len = func(buf + len, size - len, \
512513
"EMBEDDED [L%llu %s] et=%u %s " \

module/zfs/dmu.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,19 @@ dmu_sync_done(zio_t *zio, arc_buf_t *buf, void *varg)
14721472
dr->dt.dl.dr_overridden_by = *zio->io_bp;
14731473
dr->dt.dl.dr_override_state = DR_OVERRIDDEN;
14741474
dr->dt.dl.dr_copies = zio->io_prop.zp_copies;
1475-
if (BP_IS_HOLE(&dr->dt.dl.dr_overridden_by))
1475+
1476+
/*
1477+
* Old style holes are filled with all zeros, whereas
1478+
* new-style holes maintain their lsize, type, level,
1479+
* and birth time (see zio_write_compress). While we
1480+
* need to reset the BP_SET_LSIZE() call that happened
1481+
* in dmu_sync_ready for old style holes, we do *not*
1482+
* want to wipe out the information contained in new
1483+
* style holes. Thus, only zero out the block pointer if
1484+
* it's an old style hole.
1485+
*/
1486+
if (BP_IS_HOLE(&dr->dt.dl.dr_overridden_by) &&
1487+
dr->dt.dl.dr_overridden_by.blk_birth == 0)
14761488
BP_ZERO(&dr->dt.dl.dr_overridden_by);
14771489
} else {
14781490
dr->dt.dl.dr_override_state = DR_NOT_OVERRIDDEN;

0 commit comments

Comments
 (0)