]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fs: Remove page_mkwrite_check_truncate()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 21 Feb 2025 20:44:19 +0000 (20:44 +0000)
committerChristian Brauner <brauner@kernel.org>
Fri, 28 Feb 2025 10:21:31 +0000 (11:21 +0100)
All callers of this function have now been converted to use
folio_mkwrite_check_truncate().

Signed-off-by: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Link: https://lore.kernel.org/r/20250221204421.3590340-1-willy@infradead.org
Tested-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
include/linux/pagemap.h

index 47bfc6b1b632dc8812795825a5c1c0554ed10319..7fe82d43cf39adc795147e7f297d78640a926cbd 100644 (file)
@@ -1602,34 +1602,6 @@ static inline ssize_t folio_mkwrite_check_truncate(struct folio *folio,
        return offset;
 }
 
-/**
- * page_mkwrite_check_truncate - check if page was truncated
- * @page: the page to check
- * @inode: the inode to check the page against
- *
- * Returns the number of bytes in the page up to EOF,
- * or -EFAULT if the page was truncated.
- */
-static inline int page_mkwrite_check_truncate(struct page *page,
-                                             struct inode *inode)
-{
-       loff_t size = i_size_read(inode);
-       pgoff_t index = size >> PAGE_SHIFT;
-       int offset = offset_in_page(size);
-
-       if (page->mapping != inode->i_mapping)
-               return -EFAULT;
-
-       /* page is wholly inside EOF */
-       if (page->index < index)
-               return PAGE_SIZE;
-       /* page is wholly past EOF */
-       if (page->index > index || !offset)
-               return -EFAULT;
-       /* page is partially inside EOF */
-       return offset;
-}
-
 /**
  * i_blocks_per_folio - How many blocks fit in this folio.
  * @inode: The inode which contains the blocks.