10b1e987cSChristoph Hellwig // SPDX-License-Identifier: GPL-2.0-only 21da177e4SLinus Torvalds /* 31da177e4SLinus Torvalds * Copyright (c) 2000-2001 Christoph Hellwig. 41da177e4SLinus Torvalds */ 51da177e4SLinus Torvalds 61da177e4SLinus Torvalds /* 71da177e4SLinus Torvalds * Veritas filesystem driver - support for 'immed' inodes. 81da177e4SLinus Torvalds */ 91da177e4SLinus Torvalds #include <linux/fs.h> 101da177e4SLinus Torvalds #include <linux/pagemap.h> 111da177e4SLinus Torvalds 121da177e4SLinus Torvalds #include "vxfs.h" 138b1919a1SAdrian Bunk #include "vxfs_extern.h" 141da177e4SLinus Torvalds #include "vxfs_inode.h" 151da177e4SLinus Torvalds 161da177e4SLinus Torvalds /** 1742d7a524SMatthew Wilcox (Oracle) * vxfs_immed_read_folio - read part of an immed inode into pagecache 181da177e4SLinus Torvalds * @file: file context (unused) 1942d7a524SMatthew Wilcox (Oracle) * @folio: folio to fill in. 201da177e4SLinus Torvalds * 211da177e4SLinus Torvalds * Description: 2242d7a524SMatthew Wilcox (Oracle) * vxfs_immed_read_folio reads a part of the immed area of the 23*36a43502SMatthew Wilcox (Oracle) * file that hosts @folio into the pagecache. 241da177e4SLinus Torvalds * 251da177e4SLinus Torvalds * Returns: 261da177e4SLinus Torvalds * Zero on success, else a negative error code. 271da177e4SLinus Torvalds * 281da177e4SLinus Torvalds * Locking status: 2942d7a524SMatthew Wilcox (Oracle) * @folio is locked and will be unlocked. 301da177e4SLinus Torvalds */ vxfs_immed_read_folio(struct file * fp,struct folio * folio)31*36a43502SMatthew Wilcox (Oracle)static int vxfs_immed_read_folio(struct file *fp, struct folio *folio) 321da177e4SLinus Torvalds { 33*36a43502SMatthew Wilcox (Oracle) struct vxfs_inode_info *vip = VXFS_INO(folio->mapping->host); 34*36a43502SMatthew Wilcox (Oracle) void *src = vip->vii_immed.vi_immed + folio_pos(folio); 35*36a43502SMatthew Wilcox (Oracle) unsigned long i; 361da177e4SLinus Torvalds 37*36a43502SMatthew Wilcox (Oracle) for (i = 0; i < folio_nr_pages(folio); i++) { 38*36a43502SMatthew Wilcox (Oracle) memcpy_to_page(folio_page(folio, i), 0, src, PAGE_SIZE); 39*36a43502SMatthew Wilcox (Oracle) src += PAGE_SIZE; 40*36a43502SMatthew Wilcox (Oracle) } 411da177e4SLinus Torvalds 42*36a43502SMatthew Wilcox (Oracle) folio_mark_uptodate(folio); 43*36a43502SMatthew Wilcox (Oracle) folio_unlock(folio); 441da177e4SLinus Torvalds 451da177e4SLinus Torvalds return 0; 461da177e4SLinus Torvalds } 47*36a43502SMatthew Wilcox (Oracle) 48*36a43502SMatthew Wilcox (Oracle) /* 49*36a43502SMatthew Wilcox (Oracle) * Address space operations for immed files and directories. 50*36a43502SMatthew Wilcox (Oracle) */ 51*36a43502SMatthew Wilcox (Oracle) const struct address_space_operations vxfs_immed_aops = { 52*36a43502SMatthew Wilcox (Oracle) .read_folio = vxfs_immed_read_folio, 53*36a43502SMatthew Wilcox (Oracle) }; 54