@@ -1022,6 +1022,10 @@ zio_create(zio_t *pio, spa_t *spa, uint64_t txg, const blkptr_t *bp,
1022
1022
zio -> io_logical = zio ;
1023
1023
if (zio -> io_child_type > ZIO_CHILD_GANG && BP_IS_GANG (bp ))
1024
1024
pipeline |= ZIO_GANG_STAGES ;
1025
+ if (flags & ZIO_FLAG_PREALLOCATED ) {
1026
+ BP_ZERO_DVAS (zio -> io_bp );
1027
+ BP_SET_BIRTH (zio -> io_bp , 0 , 0 );
1028
+ }
1025
1029
}
1026
1030
1027
1031
zio -> io_spa = spa ;
@@ -1962,8 +1966,7 @@ zio_write_compress(zio_t *zio)
1962
1966
ASSERT (zio -> io_child_type != ZIO_CHILD_DDT );
1963
1967
ASSERT (zio -> io_bp_override == NULL );
1964
1968
1965
- if (!BP_IS_HOLE (bp ) && BP_GET_LOGICAL_BIRTH (bp ) == zio -> io_txg &&
1966
- !(zio -> io_flags & ZIO_FLAG_PREALLOCATED )) {
1969
+ if (!BP_IS_HOLE (bp ) && BP_GET_LOGICAL_BIRTH (bp ) == zio -> io_txg ) {
1967
1970
/*
1968
1971
* We're rewriting an existing block, which means we're
1969
1972
* working on behalf of spa_sync(). For spa_sync() to
@@ -2109,8 +2112,7 @@ zio_write_compress(zio_t *zio)
2109
2112
zio -> io_pipeline = ZIO_REWRITE_PIPELINE | gang_stages ;
2110
2113
zio -> io_flags |= ZIO_FLAG_IO_REWRITE ;
2111
2114
} else {
2112
- if (!(zio -> io_flags & ZIO_FLAG_PREALLOCATED ))
2113
- BP_ZERO (bp );
2115
+ BP_ZERO (bp );
2114
2116
zio -> io_pipeline = ZIO_WRITE_PIPELINE ;
2115
2117
}
2116
2118
@@ -3252,8 +3254,9 @@ zio_write_gang_block(zio_t *pio, metaslab_class_t *mc)
3252
3254
zio_gang_inherit_allocator (zio , cio );
3253
3255
if (allocated ) {
3254
3256
metaslab_trace_move (& cio_list , & cio -> io_alloc_list );
3255
- metaslab_group_alloc_increment_all (spa , bp ,
3256
- zio -> io_allocator , flags , psize , cio );
3257
+ metaslab_group_alloc_increment_all (spa ,
3258
+ & cio -> io_bp_orig , zio -> io_allocator , flags , psize ,
3259
+ cio );
3257
3260
}
3258
3261
/*
3259
3262
* We do not reserve for the child writes, since we already
@@ -4133,6 +4136,10 @@ zio_dva_allocate(zio_t *zio)
4133
4136
zio -> io_gang_leader = zio ;
4134
4137
}
4135
4138
if (zio -> io_flags & ZIO_FLAG_PREALLOCATED ) {
4139
+ memcpy (zio -> io_bp -> blk_dva , zio -> io_bp_orig .blk_dva ,
4140
+ 3 * sizeof (dva_t ));
4141
+ BP_SET_BIRTH (zio -> io_bp , BP_GET_LOGICAL_BIRTH (& zio -> io_bp_orig ),
4142
+ BP_GET_PHYSICAL_BIRTH (& zio -> io_bp_orig ));
4136
4143
ASSERT3U (zio -> io_child_type , = = , ZIO_CHILD_GANG );
4137
4144
return (zio );
4138
4145
}
@@ -5153,8 +5160,7 @@ zio_ready(zio_t *zio)
5153
5160
if (zio -> io_ready ) {
5154
5161
ASSERT (IO_IS_ALLOCATING (zio ));
5155
5162
ASSERT (BP_GET_LOGICAL_BIRTH (bp ) == zio -> io_txg ||
5156
- BP_IS_HOLE (bp ) || (zio -> io_flags & ZIO_FLAG_NOPWRITE ) ||
5157
- (zio -> io_flags & ZIO_FLAG_PREALLOCATED ));
5163
+ BP_IS_HOLE (bp ) || (zio -> io_flags & ZIO_FLAG_NOPWRITE ));
5158
5164
ASSERT (zio -> io_children [ZIO_CHILD_GANG ][ZIO_WAIT_READY ] == 0 );
5159
5165
5160
5166
zio -> io_ready (zio );
0 commit comments