fs/fs_context: Mark an unlikely if condition with unlikely() in vfs_parse_monolithic_...
authorZijun Hu <quic_zijuhu@quicinc.com>
Thu, 10 Apr 2025 11:45:31 +0000 (19:45 +0800)
committerChristian Brauner <brauner@kernel.org>
Mon, 14 Apr 2025 11:05:59 +0000 (13:05 +0200)
There is no mount option with pattern "...,=key_or_value,...", so the if
condition '(value == key)' in while loop of vfs_parse_monolithic_sep() is
is unlikely true.

Mark the condition with unlikely() to improve both performance and
readability.

Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/20250410-fix_fs-v1-5-7c14ccc8ebaa@quicinc.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/fs_context.c

index 2877d9dec0753a5f03e0a54fa7b8d25072ea7b4d..666e61753aed177ec03dd403df8828e510a91a60 100644 (file)
@@ -222,7 +222,7 @@ int vfs_parse_monolithic_sep(struct fs_context *fc, void *data,
                        char *value = strchr(key, '=');
 
                        if (value) {
-                               if (value == key)
+                               if (unlikely(value == key))
                                        continue;
                                *value++ = 0;
                                v_len = strlen(value);