]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gfs2: Use folio_next_pos()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 24 Oct 2025 17:08:14 +0000 (18:08 +0100)
committerChristian Brauner <brauner@kernel.org>
Fri, 31 Oct 2025 12:11:38 +0000 (13:11 +0100)
This is one instruction more efficient than open-coding folio_pos() +
folio_size().  It's the equivalent of (x + y) << z rather than
x << z + y << z.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Link: https://patch.msgid.link/20251024170822.1427218-7-willy@infradead.org
Cc: Andreas Gruenbacher <agruenba@redhat.com>
Cc: gfs2@lists.linux.dev
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/gfs2/aops.c

index 47d74afd63ac99e5db0ba548c103e2b2d968edff..d8ba97bad8bbefb64a2934cb7be925e1764a00ff 100644 (file)
@@ -81,8 +81,7 @@ static int gfs2_write_jdata_folio(struct folio *folio,
         * the page size, the remaining memory is zeroed when mapped, and
         * writes to that region are not written out to the file."
         */
-       if (folio_pos(folio) < i_size &&
-           i_size < folio_pos(folio) + folio_size(folio))
+       if (folio_pos(folio) < i_size && i_size < folio_next_pos(folio))
                folio_zero_segment(folio, offset_in_folio(folio, i_size),
                                folio_size(folio));