Add tunable to ignore hole_birth (enabled by default)

Adds a module option which disables the hole_birth optimization
which has been responsible for several recent bugs, including
issue #4050.

Original-patch: https://gist.github.com/pcd1193182/2c0cd47211f3aee623958b4698836c48
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #4833
This commit is contained in:
Rich Ercolani 2016-07-08 16:51:50 -04:00 committed by Ned Bass
parent 4f96e68fad
commit 3a8e13688b
2 changed files with 18 additions and 1 deletions

View File

@ -24,6 +24,19 @@ Description of the different parameters to the ZFS module.
.sp .sp
.LP .LP
.sp
.ne 2
.na
\fBignore_hole_birth\fR (int)
.ad
.RS 12n
When set, the hole_birth optimization will not be used, and all holes will
always be sent on zfs send. Useful if you suspect your datasets are affected
by a bug in hole_birth.
.sp
Use \fB1\fR (default) for on and \fB0\fR for off.
.RE
.sp .sp
.ne 2 .ne 2
.na .na

View File

@ -39,6 +39,7 @@
#include <sys/zfeature.h> #include <sys/zfeature.h>
int32_t zfs_pd_bytes_max = 50 * 1024 * 1024; /* 50MB */ int32_t zfs_pd_bytes_max = 50 * 1024 * 1024; /* 50MB */
int32_t ignore_hole_birth = 1;
typedef struct prefetch_data { typedef struct prefetch_data {
kmutex_t pd_mtx; kmutex_t pd_mtx;
@ -250,7 +251,7 @@ traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp,
* *
* Note that the meta-dnode cannot be reallocated. * Note that the meta-dnode cannot be reallocated.
*/ */
if ((!td->td_realloc_possible || if (!ignore_hole_birth && (!td->td_realloc_possible ||
zb->zb_object == DMU_META_DNODE_OBJECT) && zb->zb_object == DMU_META_DNODE_OBJECT) &&
td->td_hole_birth_enabled_txg <= td->td_min_txg) td->td_hole_birth_enabled_txg <= td->td_min_txg)
return (0); return (0);
@ -692,4 +693,7 @@ EXPORT_SYMBOL(traverse_pool);
module_param(zfs_pd_bytes_max, int, 0644); module_param(zfs_pd_bytes_max, int, 0644);
MODULE_PARM_DESC(zfs_pd_bytes_max, "Max number of bytes to prefetch"); MODULE_PARM_DESC(zfs_pd_bytes_max, "Max number of bytes to prefetch");
module_param(ignore_hole_birth, int, 0644);
MODULE_PARM_DESC(ignore_hole_birth, "Ignore hole_birth txg for send");
#endif #endif