Skip to content

Commit

Permalink
Add tunable to ignore hole_birth
Browse files Browse the repository at this point in the history
Adds a module option which disables the hole_birth optimization
which has been responsible for several recent bugs, including
issue openzfs#4050.

Original-patch: https://gist.github.com/pcd1193182/2c0cd47211f3aee623958b4698836c48
Signed-off-by: Rich Ercolani <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#4833
  • Loading branch information
rincebrain authored and Chunwei Chen committed Sep 7, 2016
1 parent c2e28ed commit afb3702
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions man/man5/zfs-module-parameters.5
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ Description of the different parameters to the ZFS module.
.sp
.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
.ne 2
.na
Expand Down
6 changes: 5 additions & 1 deletion module/zfs/dmu_traverse.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <sys/zfeature.h>

int32_t zfs_pd_bytes_max = 50 * 1024 * 1024; /* 50MB */
int32_t ignore_hole_birth = 1;

typedef struct prefetch_data {
kmutex_t pd_mtx;
Expand Down Expand Up @@ -259,7 +260,7 @@ traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp,
*
* 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) &&
td->td_hole_birth_enabled_txg <= td->td_min_txg)
return (0);
Expand Down Expand Up @@ -702,4 +703,7 @@ EXPORT_SYMBOL(traverse_pool);

module_param(zfs_pd_bytes_max, int, 0644);
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

0 comments on commit afb3702

Please sign in to comment.