]> git.hungrycats.org Git - linux/commitdiff
btrfs: use BTRFS_MAX_EXTENT_SIZE in prealloc 6.18/topics/prealloc-size
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sat, 21 Dec 2024 15:48:03 +0000 (10:48 -0500)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Wed, 16 Sep 2026 21:39:57 +0000 (17:39 -0400)
The prealloc size limit of 256M was set in
commit 24542bf7ea5e ("btrfs: limit fallocate extent reservation to 256MB")
while the 128M extent size limit used everywhere else was set in
commit b888db2bd7b6 ("Btrfs: Add delayed allocation to the extent based
page tree code"), i.e. since the beginning of btrfs.

Excessively large extents cause problems for relocations already, and
there is no need for prealloc to create any more.  Bring the prealloc size
down to the same size used by normal write allocations.

Zoned devices can't use prealloc, so we don't need to do anything special
for them like we do for normal writes.

Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
fs/btrfs/inode.c

index cca9840bee8966e9c4a0bea9dbf4b98001dbfe3f..8de931e771b1cf233905d666a283488e6db3931b 100644 (file)
@@ -9148,7 +9148,7 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode,
        if (trans)
                own_trans = false;
        while (num_bytes > 0) {
-               cur_bytes = min_t(u64, num_bytes, SZ_256M);
+               cur_bytes = min_t(u64, num_bytes, BTRFS_MAX_EXTENT_SIZE);
                cur_bytes = max(cur_bytes, min_size);
                /*
                 * If we are severely fragmented we could end up with really