]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
btrfs: partially apply b8b93addde
authorHans van Kranenburg <hans.van.kranenburg@mendix.com>
Wed, 23 Jan 2019 19:03:49 +0000 (20:03 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 22 Nov 2019 15:57:32 +0000 (15:57 +0000)
Extracted from commit b8b93addde "btrfs: cleanup 64bit/32bit divs,
provably bounded values", to allow commits 793ff2c88c6 "btrfs:
volumes: Cleanup stripe size calculation" and baf92114c7 "btrfs:
alloc_chunk: fix more DUP stripe size handling" to apply cleanly.

[bwh: Add patch description]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/btrfs/volumes.c

index 4aa1a20fc5d71310d6d80ea9cf32ba77ccb24e1c..b4b98a75ca8bbaf61176439d0c2d89d6579d0a8a 100644 (file)
@@ -4274,8 +4274,8 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
         */
        if (stripe_size * data_stripes > max_chunk_size) {
                u64 mask = (1ULL << 24) - 1;
-               stripe_size = max_chunk_size;
-               do_div(stripe_size, data_stripes);
+
+               stripe_size = div_u64(max_chunk_size, data_stripes);
 
                /* bump the answer up to a 16MB boundary */
                stripe_size = (stripe_size + mask) & ~mask;