File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -4874,18 +4874,17 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
4874
4874
* and compare that answer with the max chunk size
4875
4875
*/
4876
4876
if (stripe_size * data_stripes > max_chunk_size ) {
4877
- u64 mask = (1ULL << 24 ) - 1 ;
4878
-
4879
4877
stripe_size = div_u64 (max_chunk_size , data_stripes );
4880
4878
4881
4879
/* bump the answer up to a 16MB boundary */
4882
- stripe_size = (stripe_size + mask ) & ~ mask ;
4880
+ stripe_size = round_up (stripe_size , SZ_16M ) ;
4883
4881
4884
- /* but don't go higher than the limits we found
4885
- * while searching for free extents
4882
+ /*
4883
+ * But don't go higher than the limits we found while searching
4884
+ * for free extents
4886
4885
*/
4887
- if ( stripe_size > devices_info [ndevs - 1 ].max_avail )
4888
- stripe_size = devices_info [ ndevs - 1 ]. max_avail ;
4886
+ stripe_size = min ( devices_info [ndevs - 1 ].max_avail ,
4887
+ stripe_size ) ;
4889
4888
}
4890
4889
4891
4890
/* align to BTRFS_STRIPE_LEN */
You can’t perform that action at this time.
0 commit comments