mirror of
https://github.com/torvalds/linux.git
synced 2026-12-04 12:24:18 +00:00
mm: Use folio_next_pos()
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) <[email protected]> Link: https://patch.msgid.link/[email protected] Reviewed-by: David Hildenbrand <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Baolin Wang <[email protected]> Cc: Andrew Morton <[email protected]> Cc: [email protected] Signed-off-by: Christian Brauner <[email protected]>
This commit is contained in:
+1
-1
@@ -1133,7 +1133,7 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend,
|
||||
same_folio = (lstart >> PAGE_SHIFT) == (lend >> PAGE_SHIFT);
|
||||
folio = shmem_get_partial_folio(inode, lstart >> PAGE_SHIFT);
|
||||
if (folio) {
|
||||
same_folio = lend < folio_pos(folio) + folio_size(folio);
|
||||
same_folio = lend < folio_next_pos(folio);
|
||||
folio_mark_dirty(folio);
|
||||
if (!truncate_inode_partial_folio(folio, lstart, lend)) {
|
||||
start = folio_next_index(folio);
|
||||
|
||||
+1
-1
@@ -387,7 +387,7 @@ void truncate_inode_pages_range(struct address_space *mapping,
|
||||
same_folio = (lstart >> PAGE_SHIFT) == (lend >> PAGE_SHIFT);
|
||||
folio = __filemap_get_folio(mapping, lstart >> PAGE_SHIFT, FGP_LOCK, 0);
|
||||
if (!IS_ERR(folio)) {
|
||||
same_folio = lend < folio_pos(folio) + folio_size(folio);
|
||||
same_folio = lend < folio_next_pos(folio);
|
||||
if (!truncate_inode_partial_folio(folio, lstart, lend)) {
|
||||
start = folio_next_index(folio);
|
||||
if (same_folio)
|
||||
|
||||
Reference in New Issue
Block a user