| Workaround the birth hole bug in OpenZFS. |
| Backported from r306425. |
| |
| diff -ru --exclude-from freebsd-src-diff-exclude-names /var/tmp/freebsd-src/usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c freebsd-10.3/usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c |
| --- /var/tmp/freebsd-src/usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c 2016-03-25 09:09:26.000000000 +0800 |
| +++ freebsd-10.3/usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c 2017-11-15 11:33:04.818845201 +0800 |
| @@ -40,6 +40,11 @@ |
| #include <sys/zfeature.h> |
| |
| int32_t zfs_pd_bytes_max = 50 * 1024 * 1024; /* 50MB */ |
| +boolean_t send_holes_without_birth_time = B_TRUE; |
| + |
| +SYSCTL_DECL(_vfs_zfs); |
| +SYSCTL_UINT(_vfs_zfs, OID_AUTO, send_holes_without_birth_time, CTLFLAG_RWTUN, |
| + &send_holes_without_birth_time, 0, "Send holes without birth time"); |
| |
| typedef struct prefetch_data { |
| kmutex_t pd_mtx; |
| @@ -254,7 +259,8 @@ |
| * |
| * Note that the meta-dnode cannot be reallocated. |
| */ |
| - if ((!td->td_realloc_possible || |
| + if (!send_holes_without_birth_time && |
| + (!td->td_realloc_possible || |
| zb->zb_object == DMU_META_DNODE_OBJECT) && |
| td->td_hole_birth_enabled_txg <= td->td_min_txg) |
| return (0); |