]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ext4/move_extent: use folio_next_pos()
authorJulia Lawall <Julia.Lawall@inria.fr>
Sun, 22 Feb 2026 12:50:49 +0000 (13:50 +0100)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 9 Apr 2026 14:40:31 +0000 (10:40 -0400)
A series of patches such as commit 60a70e61430b ("mm: Use
folio_next_pos()") replace folio_pos() + folio_size() by
folio_next_pos().  The former performs x << z + y << z while
the latter performs (x + y) << z, which is slightly more
efficient. This case was not taken into account, perhaps
because the argument is not named folio.

The change was performed using the following Coccinelle
semantic patch:

@@
expression folio;
@@

- folio_pos(folio) + folio_size(folio)
+ folio_next_pos(folio)

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Link: https://patch.msgid.link/20260222125049.1309075-1-Julia.Lawall@inria.fr
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/move_extent.c

index ce1f738dff938c5685ef87099df4c87702657a39..78569ed91b97da01b7232174e2a47f1c0a8c7b11 100644 (file)
@@ -224,8 +224,8 @@ static int mext_move_begin(struct mext_data *mext, struct folio *folio[2],
        }
 
        /* Adjust the moving length according to the length of shorter folio. */
-       move_len = umin(folio_pos(folio[0]) + folio_size(folio[0]) - orig_pos,
-                       folio_pos(folio[1]) + folio_size(folio[1]) - donor_pos);
+       move_len = umin(folio_next_pos(folio[0]) - orig_pos,
+                       folio_next_pos(folio[1]) - donor_pos);
        move_len >>= blkbits;
        if (move_len < mext->orig_map.m_len)
                mext->orig_map.m_len = move_len;