@@ -1734,8 +1734,8 @@ metaslab_block_picker(zfs_range_tree_t *rt, uint64_t *cursor, uint64_t size,
1734
1734
* cursor = rt -> rt_start ;
1735
1735
zfs_btree_t * bt = & rt -> rt_root ;
1736
1736
zfs_btree_index_t where ;
1737
- zfs_range_seg_t * rs = metaslab_block_find (bt , rt , * cursor , size , size ,
1738
- & where );
1737
+ zfs_range_seg_t * rs = metaslab_block_find (bt , rt , * cursor , size ,
1738
+ max_size , & where );
1739
1739
uint64_t first_found ;
1740
1740
int count_searched = 0 ;
1741
1741
@@ -1885,7 +1885,7 @@ metaslab_df_alloc(metaslab_t *msp, uint64_t size, uint64_t max_size,
1885
1885
align = size & - size ;
1886
1886
cursor = & msp -> ms_lbas [highbit64 (align ) - 1 ];
1887
1887
offset = metaslab_block_picker (rt , cursor , size ,
1888
- size , metaslab_df_max_search , found_size );
1888
+ max_size , metaslab_df_max_search , found_size );
1889
1889
}
1890
1890
}
1891
1891
@@ -5164,16 +5164,17 @@ metaslab_group_alloc(metaslab_group_t *mg, zio_alloc_list_t *zal,
5164
5164
5165
5165
offset = metaslab_block_alloc (msp , asize , max_asize , txg ,
5166
5166
actual_asize );
5167
- metaslab_trace_add (zal , mg , msp , * actual_asize , d , offset ,
5168
- allocator );
5169
5167
5170
5168
if (offset != -1ULL ) {
5169
+ metaslab_trace_add (zal , mg , msp , * actual_asize , d ,
5170
+ offset , allocator );
5171
5171
/* Proactively passivate the metaslab, if needed */
5172
5172
if (activated )
5173
5173
metaslab_segment_may_passivate (msp );
5174
5174
mutex_exit (& msp -> ms_lock );
5175
5175
break ;
5176
5176
}
5177
+ metaslab_trace_add (zal , mg , msp , asize , d , offset , allocator );
5177
5178
next :
5178
5179
ASSERT (msp -> ms_loaded );
5179
5180
@@ -5399,10 +5400,11 @@ metaslab_alloc_dva_range(spa_t *spa, metaslab_class_t *mc, uint64_t psize,
5399
5400
uint64_t offset = metaslab_group_alloc (mg , zal , asize ,
5400
5401
max_asize , txg , dva , d , allocator , try_hard ,
5401
5402
& asize );
5402
- if (actual_psize )
5403
- * actual_psize = vdev_asize_to_psize_txg (vd , asize , txg );
5404
5403
5405
5404
if (offset != -1ULL ) {
5405
+ if (actual_psize )
5406
+ * actual_psize = vdev_asize_to_psize_txg (vd ,
5407
+ asize , txg );
5406
5408
metaslab_class_rotate (mg , allocator , psize , B_TRUE );
5407
5409
5408
5410
DVA_SET_VDEV (& dva [d ], vd -> vdev_id );
0 commit comments