[PATCH] freevxfs: Convert vxfs_immed_read_folio to the new folio APIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use folio_fill_tail() and folio_end_read() instead of open-coding them.
Add a sanity check in case a folio is allocated above index 0.

Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
---
 fs/freevxfs/vxfs_immed.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/fs/freevxfs/vxfs_immed.c b/fs/freevxfs/vxfs_immed.c
index 9b49ec36e667..b9c6c7118e58 100644
--- a/fs/freevxfs/vxfs_immed.c
+++ b/fs/freevxfs/vxfs_immed.c
@@ -28,19 +28,16 @@
  * Locking status:
  *   @folio is locked and will be unlocked.
  */
-static int vxfs_immed_read_folio(struct file *fp, struct folio *folio)
+static int vxfs_immed_read_folio(struct file *file, struct folio *folio)
 {
 	struct vxfs_inode_info *vip = VXFS_INO(folio->mapping->host);
-	void *src = vip->vii_immed.vi_immed + folio_pos(folio);
-	unsigned long i;
+	size_t len = VXFS_NIMMED;
 
-	for (i = 0; i < folio_nr_pages(folio); i++) {
-		memcpy_to_page(folio_page(folio, i), 0, src, PAGE_SIZE);
-		src += PAGE_SIZE;
-	}
+	if (folio->index > 0)
+		len = 0;
 
-	folio_mark_uptodate(folio);
-	folio_unlock(folio);
+	folio_fill_tail(folio, 0, vip->vii_immed.vi_immed, len);
+	folio_end_read(folio, true);
 
 	return 0;
 }
-- 
2.42.0





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux