mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-26 20:22:14 +03:00
Illumos 4370, 4371
4370 avoid transmitting holes during zfs send 4371 DMU code clean up Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: George Wilson <george.wilson@delphix.com> Reviewed by: Christopher Siden <christopher.siden@delphix.com> Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net> Approved by: Garrett D'Amore <garrett@damore.org>a References: https://www.illumos.org/issues/4370 https://www.illumos.org/issues/4371 https://github.com/illumos/illumos-gate/commit/43466aa Ported by: Tim Chase <tim@chase2k.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #2529
This commit is contained in:
committed by
Brian Behlendorf
parent
fa86b5dbb6
commit
b0bc7a84d9
+14
-5
@@ -36,6 +36,7 @@
|
||||
#include <sys/dmu_objset.h>
|
||||
#include <sys/arc.h>
|
||||
#include <sys/ddt.h>
|
||||
#include <sys/zfeature.h>
|
||||
|
||||
/*
|
||||
* ==========================================================================
|
||||
@@ -1096,7 +1097,7 @@ zio_write_bp_init(zio_t *zio)
|
||||
BP_ZERO(bp);
|
||||
}
|
||||
|
||||
if (bp->blk_birth == zio->io_txg) {
|
||||
if (!BP_IS_HOLE(bp) && bp->blk_birth == zio->io_txg) {
|
||||
/*
|
||||
* We're rewriting an existing block, which means we're
|
||||
* working on behalf of spa_sync(). For spa_sync() to
|
||||
@@ -1140,7 +1141,8 @@ zio_write_bp_init(zio_t *zio)
|
||||
* spa_sync() to allocate new blocks, but force rewrites after that.
|
||||
* There should only be a handful of blocks after pass 1 in any case.
|
||||
*/
|
||||
if (bp->blk_birth == zio->io_txg && BP_GET_PSIZE(bp) == psize &&
|
||||
if (!BP_IS_HOLE(bp) && bp->blk_birth == zio->io_txg &&
|
||||
BP_GET_PSIZE(bp) == psize &&
|
||||
pass >= zfs_sync_pass_rewrite) {
|
||||
enum zio_stage gang_stages = zio->io_pipeline & ZIO_GANG_STAGES;
|
||||
ASSERT(psize != 0);
|
||||
@@ -1152,15 +1154,22 @@ zio_write_bp_init(zio_t *zio)
|
||||
}
|
||||
|
||||
if (psize == 0) {
|
||||
if (zio->io_bp_orig.blk_birth != 0 &&
|
||||
spa_feature_is_active(spa, SPA_FEATURE_HOLE_BIRTH)) {
|
||||
BP_SET_LSIZE(bp, lsize);
|
||||
BP_SET_TYPE(bp, zp->zp_type);
|
||||
BP_SET_LEVEL(bp, zp->zp_level);
|
||||
BP_SET_BIRTH(bp, zio->io_txg, 0);
|
||||
}
|
||||
zio->io_pipeline = ZIO_INTERLOCK_PIPELINE;
|
||||
} else {
|
||||
ASSERT(zp->zp_checksum != ZIO_CHECKSUM_GANG_HEADER);
|
||||
BP_SET_LSIZE(bp, lsize);
|
||||
BP_SET_TYPE(bp, zp->zp_type);
|
||||
BP_SET_LEVEL(bp, zp->zp_level);
|
||||
BP_SET_PSIZE(bp, psize);
|
||||
BP_SET_COMPRESS(bp, compress);
|
||||
BP_SET_CHECKSUM(bp, zp->zp_checksum);
|
||||
BP_SET_TYPE(bp, zp->zp_type);
|
||||
BP_SET_LEVEL(bp, zp->zp_level);
|
||||
BP_SET_DEDUP(bp, zp->zp_dedup);
|
||||
BP_SET_BYTEORDER(bp, ZFS_HOST_BYTEORDER);
|
||||
if (zp->zp_dedup) {
|
||||
@@ -2613,7 +2622,7 @@ zio_vdev_io_start(zio_t *zio)
|
||||
if (vd->vdev_ops->vdev_op_leaf &&
|
||||
(zio->io_type == ZIO_TYPE_READ || zio->io_type == ZIO_TYPE_WRITE)) {
|
||||
|
||||
if (zio->io_type == ZIO_TYPE_READ && vdev_cache_read(zio) == 0)
|
||||
if (zio->io_type == ZIO_TYPE_READ && vdev_cache_read(zio))
|
||||
return (ZIO_PIPELINE_CONTINUE);
|
||||
|
||||
if ((zio = vdev_queue_io(zio)) == NULL)
|
||||
|
||||
Reference in New Issue
Block a user