Skip to content

Commit 4511fd8

Browse files
Matthew Wilcox (Oracle)brauner
authored andcommitted
filemap: Add folio_next_pos()
Replace the open-coded implementation in ocfs2 (which loses the top 32 bits on 32-bit architectures) with a helper in pagemap.h. Fixes: 35edec1 (ocfs2: update truncate handling of partial clusters) Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Link: https://patch.msgid.link/20251024170822.1427218-2-willy@infradead.org Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: Mark Fasheh <mark@fasheh.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Joseph Qi <joseph.qi@linux.alibaba.com> Cc: ocfs2-devel@lists.linux.dev Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 3a86608 commit 4511fd8

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

fs/ocfs2/alloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6892,7 +6892,7 @@ static void ocfs2_zero_cluster_folios(struct inode *inode, loff_t start,
68926892
ocfs2_map_and_dirty_folio(inode, handle, from, to, folio, 1,
68936893
&phys);
68946894

6895-
start = folio_next_index(folio) << PAGE_SHIFT;
6895+
start = folio_next_pos(folio);
68966896
}
68976897
out:
68986898
if (folios)

include/linux/pagemap.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,17 @@ static inline pgoff_t folio_next_index(const struct folio *folio)
941941
return folio->index + folio_nr_pages(folio);
942942
}
943943

944+
/**
945+
* folio_next_pos - Get the file position of the next folio.
946+
* @folio: The current folio.
947+
*
948+
* Return: The position of the folio which follows this folio in the file.
949+
*/
950+
static inline loff_t folio_next_pos(const struct folio *folio)
951+
{
952+
return (loff_t)folio_next_index(folio) << PAGE_SHIFT;
953+
}
954+
944955
/**
945956
* folio_file_page - The page for a particular index.
946957
* @folio: The folio which contains this index.

0 commit comments

Comments
 (0)