Skip to content

Commit 8e3c15e

Browse files
Gou Haobrauner
authored andcommitted
iomap: skip unnecessary ifs_block_is_uptodate check
In iomap_adjust_read_range, i is either the first !uptodate block, or it is past last for the second loop looking for trailing uptodate blocks. Assuming there's no overflow (there's no combination of huge folios and tiny blksize) then yeah, there is no point in retesting that the same block pointed to by i is uptodate since we hold the folio lock so nobody else could have set it uptodate. Signed-off-by: Gou Hao <gouhao@uniontech.com> Link: https://lore.kernel.org/20250410071236.16017-1-gouhao@uniontech.com Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Suggested-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent b463d7f commit 8e3c15e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/iomap/buffered-io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ static void iomap_adjust_read_range(struct inode *inode, struct folio *folio,
259259
}
260260

261261
/* truncate len if we find any trailing uptodate block(s) */
262-
for ( ; i <= last; i++) {
262+
while (++i <= last) {
263263
if (ifs_block_is_uptodate(ifs, i)) {
264264
plen -= (last - i + 1) * block_size;
265265
last = i - 1;

0 commit comments

Comments
 (0)