* [PATCH] ext4: Don't use CR_BEST_AVAIL_LEN for non-regular files
@ 2023-07-16 14:03 Ritesh Harjani (IBM)
2023-07-16 15:37 ` Ojaswin Mujoo
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ritesh Harjani (IBM) @ 2023-07-16 14:03 UTC (permalink / raw)
To: linux-ext4; +Cc: Ojaswin Mujoo, Ritesh Harjani (IBM), Eric Whitney
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.
Fixes: 33122aa930f1 ("ext4: Add allocation criteria 1.5 (CR1_5)")
Reported-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
---
fs/ext4/mballoc.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 3ab37533349f..bc004f5d3f3c 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -975,7 +975,18 @@ static void ext4_mb_choose_next_group_goal_fast(struct ext4_allocation_context *
*group = grp->bb_group;
ac->ac_flags |= EXT4_MB_CR_GOAL_LEN_FAST_OPTIMIZED;
} else {
- *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;
}
}
--
2.40.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: Don't use CR_BEST_AVAIL_LEN for non-regular files
2023-07-16 14:03 [PATCH] ext4: Don't use CR_BEST_AVAIL_LEN for non-regular files Ritesh Harjani (IBM)
@ 2023-07-16 15:37 ` Ojaswin Mujoo
2023-07-17 21:28 ` Eric Whitney
2023-08-05 12:20 ` Theodore Ts'o
2 siblings, 0 replies; 4+ messages in thread
From: Ojaswin Mujoo @ 2023-07-16 15:37 UTC (permalink / raw)
To: Ritesh Harjani (IBM); +Cc: linux-ext4, Eric Whitney
On Sun, Jul 16, 2023 at 07:33:34PM +0530, Ritesh Harjani (IBM) wrote:
> 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.
>
> Fixes: 33122aa930f1 ("ext4: Add allocation criteria 1.5 (CR1_5)")
> Reported-by: Eric Whitney <enwlinux@gmail.com>
> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
> ---
Hi Ritesh,
patch looks good to me. Feel free to add:
Reviewed-by: Ojaswin Mujoo <ojaswin.linux.ibm.com>
Regards,
ojaswin
> fs/ext4/mballoc.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 3ab37533349f..bc004f5d3f3c 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -975,7 +975,18 @@ static void ext4_mb_choose_next_group_goal_fast(struct ext4_allocation_context *
> *group = grp->bb_group;
> ac->ac_flags |= EXT4_MB_CR_GOAL_LEN_FAST_OPTIMIZED;
> } else {
> - *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;
> }
> }
>
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: Don't use CR_BEST_AVAIL_LEN for non-regular files
2023-07-16 14:03 [PATCH] ext4: Don't use CR_BEST_AVAIL_LEN for non-regular files Ritesh Harjani (IBM)
2023-07-16 15:37 ` Ojaswin Mujoo
@ 2023-07-17 21:28 ` Eric Whitney
2023-08-05 12:20 ` Theodore Ts'o
2 siblings, 0 replies; 4+ messages in thread
From: Eric Whitney @ 2023-07-17 21:28 UTC (permalink / raw)
To: Ritesh Harjani (IBM); +Cc: linux-ext4, Ojaswin Mujoo, Eric Whitney
* Ritesh Harjani (IBM) <ritesh.list@gmail.com>:
> 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.
>
> Fixes: 33122aa930f1 ("ext4: Add allocation criteria 1.5 (CR1_5)")
> Reported-by: Eric Whitney <enwlinux@gmail.com>
> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
> ---
> fs/ext4/mballoc.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 3ab37533349f..bc004f5d3f3c 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -975,7 +975,18 @@ static void ext4_mb_choose_next_group_goal_fast(struct ext4_allocation_context *
> *group = grp->bb_group;
> ac->ac_flags |= EXT4_MB_CR_GOAL_LEN_FAST_OPTIMIZED;
> } else {
> - *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;
> }
> }
>
> --
> 2.40.1
>
Works for me on 6.5-rc2 with this patch applied - 500/500 generic/269 trials
passed on bigalloc_1k.
Tested-by: Eric Whitney <enwlinux@gmail.com>
Thanks!
Eric
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: Don't use CR_BEST_AVAIL_LEN for non-regular files
2023-07-16 14:03 [PATCH] ext4: Don't use CR_BEST_AVAIL_LEN for non-regular files Ritesh Harjani (IBM)
2023-07-16 15:37 ` Ojaswin Mujoo
2023-07-17 21:28 ` Eric Whitney
@ 2023-08-05 12:20 ` Theodore Ts'o
2 siblings, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2023-08-05 12:20 UTC (permalink / raw)
To: linux-ext4, Ritesh Harjani (IBM)
Cc: Theodore Ts'o, Ojaswin Mujoo, Eric Whitney
On Sun, 16 Jul 2023 19:33:34 +0530, Ritesh Harjani (IBM) wrote:
> 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.
>
> [...]
Applied, thanks!
[1/1] ext4: Don't use CR_BEST_AVAIL_LEN for non-regular files
commit: 772c9f691dcf3a487f29ddb90a5a15c78d7328e1
Best regards,
--
Theodore Ts'o <tytso@mit.edu>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-05 12:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-16 14:03 [PATCH] ext4: Don't use CR_BEST_AVAIL_LEN for non-regular files Ritesh Harjani (IBM)
2023-07-16 15:37 ` Ojaswin Mujoo
2023-07-17 21:28 ` Eric Whitney
2023-08-05 12:20 ` Theodore Ts'o
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.