@@ -999,7 +999,12 @@ zio_create(zio_t *pio, spa_t *spa, uint64_t txg, const blkptr_t *bp,
999
999
} else {
1000
1000
zio -> io_bp = (blkptr_t * )bp ;
1001
1001
}
1002
- zio -> io_bp_orig = * bp ;
1002
+ if (type == ZIO_TYPE_WRITE &&
1003
+ zio -> io_child_type != ZIO_CHILD_VDEV ) {
1004
+ zio -> io_bp_orig =
1005
+ kmem_cache_alloc (zio_bp_cache , KM_SLEEP );
1006
+ * zio -> io_bp_orig = * bp ;
1007
+ }
1003
1008
if (zio -> io_child_type == ZIO_CHILD_LOGICAL )
1004
1009
zio -> io_logical = zio ;
1005
1010
if (zio -> io_child_type > ZIO_CHILD_GANG && BP_IS_GANG (bp ))
@@ -1058,6 +1063,8 @@ zio_destroy(zio_t *zio)
1058
1063
cv_destroy (& zio -> io_cv );
1059
1064
if (zio -> io_bp_copy != NULL )
1060
1065
kmem_cache_free (zio_bp_cache , zio -> io_bp_copy );
1066
+ if (zio -> io_bp_orig != NULL )
1067
+ kmem_cache_free (zio_bp_cache , zio -> io_bp_orig );
1061
1068
kmem_cache_free (zio_cache , zio );
1062
1069
}
1063
1070
@@ -1927,7 +1934,7 @@ zio_write_bp_init(zio_t *zio)
1927
1934
* it as a regular write I/O.
1928
1935
*/
1929
1936
zio -> io_bp_override = NULL ;
1930
- * bp = zio -> io_bp_orig ;
1937
+ * bp = * zio -> io_bp_orig ;
1931
1938
zio -> io_pipeline = zio -> io_orig_pipeline ;
1932
1939
}
1933
1940
@@ -2059,7 +2066,7 @@ zio_write_compress(zio_t *zio)
2059
2066
* it as a regular write I/O.
2060
2067
*/
2061
2068
zio -> io_bp_override = NULL ;
2062
- * bp = zio -> io_bp_orig ;
2069
+ * bp = * zio -> io_bp_orig ;
2063
2070
zio -> io_pipeline = zio -> io_orig_pipeline ;
2064
2071
2065
2072
} else if ((zio -> io_flags & ZIO_FLAG_RAW_ENCRYPT ) != 0 &&
@@ -2121,7 +2128,7 @@ zio_write_compress(zio_t *zio)
2121
2128
}
2122
2129
2123
2130
if (psize == 0 ) {
2124
- if (BP_GET_LOGICAL_BIRTH (& zio -> io_bp_orig ) != 0 &&
2131
+ if (BP_GET_LOGICAL_BIRTH (zio -> io_bp_orig ) != 0 &&
2125
2132
spa_feature_is_active (spa , SPA_FEATURE_HOLE_BIRTH )) {
2126
2133
BP_SET_LSIZE (bp , lsize );
2127
2134
BP_SET_TYPE (bp , zp -> zp_type );
@@ -3136,7 +3143,7 @@ zio_write_gang_member_ready(zio_t *zio)
3136
3143
* If we're getting direct-invoked from zio_write_gang_block(),
3137
3144
* the bp_orig will be set.
3138
3145
*/
3139
- ASSERT (BP_IS_HOLE (& zio -> io_bp_orig ) ||
3146
+ ASSERT (BP_IS_HOLE (zio -> io_bp_orig ) ||
3140
3147
zio -> io_flags & ZIO_FLAG_PREALLOCATED );
3141
3148
3142
3149
ASSERT (zio -> io_child_type == ZIO_CHILD_GANG );
@@ -3316,7 +3323,7 @@ zio_write_gang_block(zio_t *pio, metaslab_class_t *mc)
3316
3323
if (allocated ) {
3317
3324
metaslab_trace_move (& cio_list , & cio -> io_alloc_list );
3318
3325
metaslab_group_alloc_increment_all (spa ,
3319
- & cio -> io_bp_orig , zio -> io_allocator , flags , psize ,
3326
+ cio -> io_bp_orig , zio -> io_allocator , flags , psize ,
3320
3327
cio );
3321
3328
}
3322
3329
/*
@@ -3385,7 +3392,7 @@ static zio_t *
3385
3392
zio_nop_write (zio_t * zio )
3386
3393
{
3387
3394
blkptr_t * bp = zio -> io_bp ;
3388
- blkptr_t * bp_orig = & zio -> io_bp_orig ;
3395
+ blkptr_t * bp_orig = zio -> io_bp_orig ;
3389
3396
zio_prop_t * zp = & zio -> io_prop ;
3390
3397
3391
3398
ASSERT (BP_IS_HOLE (bp ));
@@ -3957,9 +3964,9 @@ zio_ddt_write(zio_t *zio)
3957
3964
*/
3958
3965
if (zp -> zp_rewrite ) {
3959
3966
uint64_t orig_logical_birth =
3960
- BP_GET_LOGICAL_BIRTH (& zio -> io_bp_orig );
3967
+ BP_GET_LOGICAL_BIRTH (zio -> io_bp_orig );
3961
3968
ddt_bp_fill (ddp , v , bp , orig_logical_birth );
3962
- if (BP_EQUAL (bp , & zio -> io_bp_orig )) {
3969
+ if (BP_EQUAL (bp , zio -> io_bp_orig )) {
3963
3970
/* We can skip accounting. */
3964
3971
zio -> io_flags |= ZIO_FLAG_NOPWRITE ;
3965
3972
ddt_exit (ddt );
@@ -4267,12 +4274,12 @@ zio_dva_allocate(zio_t *zio)
4267
4274
}
4268
4275
if (zio -> io_flags & ZIO_FLAG_PREALLOCATED ) {
4269
4276
ASSERT3U (zio -> io_child_type , = = , ZIO_CHILD_GANG );
4270
- memcpy (zio -> io_bp -> blk_dva , zio -> io_bp_orig . blk_dva ,
4277
+ memcpy (zio -> io_bp -> blk_dva , zio -> io_bp_orig -> blk_dva ,
4271
4278
3 * sizeof (dva_t ));
4272
4279
BP_SET_LOGICAL_BIRTH (zio -> io_bp ,
4273
- BP_GET_LOGICAL_BIRTH (& zio -> io_bp_orig ));
4280
+ BP_GET_LOGICAL_BIRTH (zio -> io_bp_orig ));
4274
4281
BP_SET_PHYSICAL_BIRTH (zio -> io_bp ,
4275
- BP_GET_RAW_PHYSICAL_BIRTH (& zio -> io_bp_orig ));
4282
+ BP_GET_RAW_PHYSICAL_BIRTH (zio -> io_bp_orig ));
4276
4283
return (zio );
4277
4284
}
4278
4285
@@ -4404,7 +4411,7 @@ zio_dva_allocate(zio_t *zio)
4404
4411
* For rewrite operations, preserve the logical birth time
4405
4412
* but set the physical birth time to the current txg.
4406
4413
*/
4407
- uint64_t logical_birth = BP_GET_LOGICAL_BIRTH (& zio -> io_bp_orig );
4414
+ uint64_t logical_birth = BP_GET_LOGICAL_BIRTH (zio -> io_bp_orig );
4408
4415
ASSERT3U (logical_birth , <=, zio -> io_txg );
4409
4416
BP_SET_BIRTH (zio -> io_bp , logical_birth , zio -> io_txg );
4410
4417
BP_SET_REWRITE (zio -> io_bp , 1 );
@@ -5497,7 +5504,7 @@ zio_done(zio_t *zio)
5497
5504
BP_GET_NDVAS (zio -> io_bp )));
5498
5505
}
5499
5506
if (zio -> io_flags & ZIO_FLAG_NOPWRITE )
5500
- VERIFY (BP_EQUAL (zio -> io_bp , & zio -> io_bp_orig ));
5507
+ VERIFY (BP_EQUAL (zio -> io_bp , zio -> io_bp_orig ));
5501
5508
}
5502
5509
5503
5510
/*
0 commit comments