From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: linux-fsdevel@vger.kernel.org, Christian Brauner <brauner@kernel.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
Carlos Maiolino <cem@kernel.org>,
linux-xfs@vger.kernel.org
Subject: [PATCH 09/10] xfs: Use folio_next_pos()
Date: Fri, 24 Oct 2025 18:08:17 +0100 [thread overview]
Message-ID: <20251024170822.1427218-10-willy@infradead.org> (raw)
In-Reply-To: <20251024170822.1427218-1-willy@infradead.org>
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>
Cc: Carlos Maiolino <cem@kernel.org>
Cc: linux-xfs@vger.kernel.org
---
fs/xfs/scrub/xfarray.c | 2 +-
fs/xfs/xfs_aops.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/xfs/scrub/xfarray.c b/fs/xfs/scrub/xfarray.c
index cdd13ed9c569..ed2e8c64b1a8 100644
--- a/fs/xfs/scrub/xfarray.c
+++ b/fs/xfs/scrub/xfarray.c
@@ -834,7 +834,7 @@ xfarray_sort_scan(
si->first_folio_idx = xfarray_idx(si->array,
folio_pos(si->folio) + si->array->obj_size - 1);
- next_pos = folio_pos(si->folio) + folio_size(si->folio);
+ next_pos = folio_next_pos(si->folio);
si->last_folio_idx = xfarray_idx(si->array, next_pos - 1);
if (xfarray_pos(si->array, si->last_folio_idx + 1) > next_pos)
si->last_folio_idx--;
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index a26f79815533..ad76d5d01dd1 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -271,7 +271,7 @@ xfs_discard_folio(
* folio itself and not the start offset that is passed in.
*/
xfs_bmap_punch_delalloc_range(ip, XFS_DATA_FORK, pos,
- folio_pos(folio) + folio_size(folio), NULL);
+ folio_next_pos(folio), NULL);
}
/*
--
2.47.2
next prev parent reply other threads:[~2025-10-24 17:08 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-24 17:08 [PATCH 00/10] Add and use folio_next_pos() Matthew Wilcox (Oracle)
2025-10-24 17:08 ` [PATCH 01/10] filemap: Add folio_next_pos() Matthew Wilcox (Oracle)
2025-10-27 7:53 ` Christoph Hellwig
2025-10-27 8:33 ` Joseph Qi
2025-10-24 17:08 ` [PATCH 02/10] btrfs: Use folio_next_pos() Matthew Wilcox (Oracle)
2025-10-30 18:14 ` David Sterba
2025-10-24 17:08 ` [PATCH 03/10] buffer: " Matthew Wilcox (Oracle)
2025-10-27 7:54 ` Christoph Hellwig
2025-10-30 9:35 ` Jan Kara
2025-10-24 17:08 ` [PATCH 04/10] ext4: " Matthew Wilcox (Oracle)
2025-10-25 3:20 ` Zhang Yi
2025-10-27 7:54 ` Christoph Hellwig
2025-10-24 17:08 ` [PATCH 05/10] f2fs: " Matthew Wilcox (Oracle)
2025-10-27 11:57 ` Chao Yu
2025-10-24 17:08 ` [PATCH 06/10] gfs2: " Matthew Wilcox (Oracle)
2025-10-24 17:08 ` [PATCH 07/10] iomap: " Matthew Wilcox (Oracle)
2025-10-24 17:10 ` Darrick J. Wong
2025-10-27 7:53 ` Christoph Hellwig
2025-10-24 17:08 ` [PATCH 08/10] netfs: " Matthew Wilcox (Oracle)
2025-10-24 17:36 ` Paulo Alcantara
2025-10-24 17:08 ` Matthew Wilcox (Oracle) [this message]
2025-10-27 7:53 ` [PATCH 09/10] xfs: " Christoph Hellwig
2025-10-24 17:08 ` [PATCH 10/10] mm: " Matthew Wilcox (Oracle)
2025-10-27 7:54 ` Christoph Hellwig
2025-10-27 15:43 ` David Hildenbrand
2025-11-08 5:00 ` Matthew Wilcox
2025-10-27 14:16 ` [PATCH 08/10] netfs: " David Howells
2025-10-27 14:50 ` Matthew Wilcox
2025-10-31 12:12 ` [PATCH 00/10] Add and use folio_next_pos() Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251024170822.1427218-10-willy@infradead.org \
--to=willy@infradead.org \
--cc=brauner@kernel.org \
--cc=cem@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).