From 174cb748d88819d8a6420aa5040f9f065fcbdbab Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Tue, 24 Jan 2023 12:29:57 +0100 Subject: [PATCH] udf: Move udf_adinicb_readpage() to inode.c udf_adinicb_readpage() is only called from aops functions, move it to the same file as its callers and also drop the stale comment - invalidate_lock is protecting us against races with truncate. Reviewed-by: Christoph Hellwig Signed-off-by: Jan Kara --- fs/udf/file.c | 19 ------------------- fs/udf/inode.c | 15 +++++++++++++++ fs/udf/udfdecl.h | 1 - 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/fs/udf/file.c b/fs/udf/file.c index 84e0b24..2659257 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c @@ -38,25 +38,6 @@ #include "udf_i.h" #include "udf_sb.h" -void udf_adinicb_readpage(struct page *page) -{ - struct inode *inode = page->mapping->host; - char *kaddr; - struct udf_inode_info *iinfo = UDF_I(inode); - loff_t isize = i_size_read(inode); - - /* - * We have to be careful here as truncate can change i_size under us. - * So just sample it once and use the same value everywhere. - */ - kaddr = kmap_atomic(page); - memcpy(kaddr, iinfo->i_data + iinfo->i_lenEAttr, isize); - memset(kaddr + isize, 0, PAGE_SIZE - isize); - flush_dcache_page(page); - SetPageUptodate(page); - kunmap_atomic(kaddr); -} - static vm_fault_t udf_page_mkwrite(struct vm_fault *vmf) { struct vm_area_struct *vma = vmf->vma; diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 084b1f3..b2bad81 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -215,6 +215,21 @@ static int udf_writepages(struct address_space *mapping, return write_cache_pages(mapping, wbc, udf_adinicb_writepage, NULL); } +static void udf_adinicb_readpage(struct page *page) +{ + struct inode *inode = page->mapping->host; + char *kaddr; + struct udf_inode_info *iinfo = UDF_I(inode); + loff_t isize = i_size_read(inode); + + kaddr = kmap_atomic(page); + memcpy(kaddr, iinfo->i_data + iinfo->i_lenEAttr, isize); + memset(kaddr + isize, 0, PAGE_SIZE - isize); + flush_dcache_page(page); + SetPageUptodate(page); + kunmap_atomic(kaddr); +} + static int udf_read_folio(struct file *file, struct folio *folio) { struct udf_inode_info *iinfo = UDF_I(file_inode(file)); diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h index 337daf9..8869251 100644 --- a/fs/udf/udfdecl.h +++ b/fs/udf/udfdecl.h @@ -137,7 +137,6 @@ static inline unsigned int udf_dir_entry_len(struct fileIdentDesc *cfi) /* file.c */ extern long udf_ioctl(struct file *, unsigned int, unsigned long); -void udf_adinicb_readpage(struct page *page); /* inode.c */ extern struct inode *__udf_iget(struct super_block *, struct kernel_lb_addr *, -- 2.7.4