@@ -3240,7 +3240,6 @@ zio_write_gang_block(zio_t *pio, metaslab_class_t *mc)
3240
3240
zp .zp_encrypt = gio -> io_prop .zp_encrypt ;
3241
3241
zp .zp_byteorder = gio -> io_prop .zp_byteorder ;
3242
3242
zp .zp_direct_write = B_FALSE ;
3243
- zp .zp_must_gang = B_FALSE ;
3244
3243
memset (zp .zp_salt , 0 , ZIO_DATA_SALT_LEN );
3245
3244
memset (zp .zp_iv , 0 , ZIO_DATA_IV_LEN );
3246
3245
memset (zp .zp_mac , 0 , ZIO_DATA_MAC_LEN );
@@ -3944,18 +3943,21 @@ zio_ddt_write(zio_t *zio)
3944
3943
need_dvas -= parent_dvas ;
3945
3944
}
3946
3945
3946
+ if (gang_dvas > 0 && have_dvas > 0 ) {
3947
+ zp -> zp_dedup = B_FALSE ;
3948
+ BP_SET_DEDUP (bp , B_FALSE );
3949
+ zio -> io_pipeline = ZIO_WRITE_PIPELINE ;
3950
+ ddt_exit (ddt );
3951
+ return (zio );
3952
+ }
3953
+
3947
3954
/*
3948
3955
* We need to write. We will create a new write with the copies
3949
3956
* property adjusted to match the number of DVAs we need to need to
3950
3957
* grow the DDT entry by to satisfy the request.
3951
3958
*/
3952
3959
zio_prop_t czp = * zp ;
3953
- if (gang_dvas > 0 && have_dvas > 0 ) {
3954
- czp .zp_gang_copies = need_dvas +
3955
- (zp -> zp_gang_copies - zp -> zp_copies );
3956
- czp .zp_copies = need_dvas ;
3957
- czp .zp_must_gang = B_TRUE ;
3958
- } else if (gang_dvas == 0 && have_dvas > 0 ) {
3960
+ if (gang_dvas == 0 && have_dvas > 0 ) {
3959
3961
czp .zp_copies = need_dvas ;
3960
3962
czp .zp_gang_copies = 0 ;
3961
3963
} else {
@@ -4167,15 +4169,14 @@ zio_dva_allocate(zio_t *zio)
4167
4169
* back to spa_sync() which is abysmal for performance.
4168
4170
*/
4169
4171
ASSERT (ZIO_HAS_ALLOCATOR (zio ));
4170
- error = zio -> io_prop . zp_must_gang ? ENOSPC : metaslab_alloc ( spa ,
4171
- mc , zio -> io_size , bp , zio -> io_prop .zp_copies , zio -> io_txg , NULL ,
4172
- flags , & zio -> io_alloc_list , zio , zio -> io_allocator );
4172
+ error = metaslab_alloc ( spa , mc , zio -> io_size , bp ,
4173
+ zio -> io_prop .zp_copies , zio -> io_txg , NULL , flags ,
4174
+ & zio -> io_alloc_list , zio , zio -> io_allocator );
4173
4175
4174
4176
/*
4175
4177
* Fallback to normal class when an alloc class is full
4176
4178
*/
4177
- if (error == ENOSPC && mc != spa_normal_class (spa ) &&
4178
- !zio -> io_prop .zp_must_gang ) {
4179
+ if (error == ENOSPC && mc != spa_normal_class (spa )) {
4179
4180
/*
4180
4181
* When the dedup or special class is spilling into the normal
4181
4182
* class, there can still be significant space available due
@@ -4227,8 +4228,7 @@ zio_dva_allocate(zio_t *zio)
4227
4228
}
4228
4229
4229
4230
if (error == ENOSPC && zio -> io_size > SPA_MINBLOCKSIZE ) {
4230
- if (zfs_flags & ZFS_DEBUG_METASLAB_ALLOC &&
4231
- !zio -> io_prop .zp_must_gang ) {
4231
+ if (zfs_flags & ZFS_DEBUG_METASLAB_ALLOC ) {
4232
4232
zfs_dbgmsg ("%s: metaslab allocation failure, "
4233
4233
"trying ganging: zio %px, size %llu, error %d" ,
4234
4234
spa_name (spa ), zio , (u_longlong_t )zio -> io_size ,
0 commit comments