Skip to contentSkip to conversation

FAILED: patch "[PATCH] ext4: don't use CR_BEST_AVAIL_LEN for non-regular files" failed to apply to 6.5-stable tree

PATCH [email protected] 1 participant 1 message Sep 16, 2023

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.5-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.5.y
git checkout FETCH_HEAD
git cherry-pick -x 772c9f691dcf3a487f29ddb90a5a15c78d7328e1
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023091649-ember-remindful-28e0@gregkh' --subject-prefix 'PATCH 6.5.y' HEAD^..

Possible dependencies:

772c9f691dcf ("ext4: don't use CR_BEST_AVAIL_LEN for non-regular files") b50675a4a6a6 ("ext4: return found group directly in ext4_mb_choose_next_group_goal_fast")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 772c9f691dcf3a487f29ddb90a5a15c78d7328e1 Mon Sep 17 00:00:00 2001
From: Ritesh Harjani <[email protected]>
Date: Sun, 16 Jul 2023 19:33:34 +0530
Subject: [PATCH] ext4: don't use CR_BEST_AVAIL_LEN for non-regular files

Using CR_BEST_AVAIL_LEN only make sense for regular files, as for non-regular files we never normalize the allocation request length i.e. goal len is same as original length (ac_g_ex.fe_len == ac_o_ex.fe_len).

Hence there is no scope of trimming the goal length to make it satisfy original request len. Thus this patch avoids using CR_BEST_AVAIL_LEN criteria for non-regular files request.

fs/ext4/mballoc.c +12 -1
index b89b5f0816e7..3d5b0b71d7f5 100644
@@ -966,7 +966,18 @@ static void ext4_mb_choose_next_group_goal_fast(struct ext4_allocation_context *
 		}
 	}
 
-	*new_cr = CR_BEST_AVAIL_LEN;
+	/*
+	 * CR_BEST_AVAIL_LEN works based on the concept that we have
+	 * a larger normalized goal len request which can be trimmed to
+	 * a smaller goal len such that it can still satisfy original
+	 * request len. However, allocation request for non-regular
+	 * files never gets normalized.
+	 * See function ext4_mb_normalize_request() (EXT4_MB_HINT_DATA).
+	 */
+	if (ac->ac_flags & EXT4_MB_HINT_DATA)
+		*new_cr = CR_BEST_AVAIL_LEN;
+	else
+		*new_cr = CR_GOAL_LEN_SLOW;
 }
 
 /*