Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ext4/move_extent: use folio_next_pos()

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>

authored by

Julia Lawall and committed by
Theodore Ts'o
a804ecc3 2f17d199

+2 -2
+2 -2
fs/ext4/move_extent.c
··· 224 224 } 225 225 226 226 /* Adjust the moving length according to the length of shorter folio. */ 227 - move_len = umin(folio_pos(folio[0]) + folio_size(folio[0]) - orig_pos, 228 - folio_pos(folio[1]) + folio_size(folio[1]) - donor_pos); 227 + move_len = umin(folio_next_pos(folio[0]) - orig_pos, 228 + folio_next_pos(folio[1]) - donor_pos); 229 229 move_len >>= blkbits; 230 230 if (move_len < mext->orig_map.m_len) 231 231 mext->orig_map.m_len = move_len;