1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * Copyright (c) 2000-2001 Christoph Hellwig. 4 */ 5 6 /* 7 * Veritas filesystem driver - support for 'immed' inodes. 8 */ 9 #include <linux/fs.h> 10 #include <linux/pagemap.h> 11 12 #include "vxfs.h" 13 #include "vxfs_extern.h" 14 #include "vxfs_inode.h" 15 16 /** 17 * vxfs_immed_read_folio - read part of an immed inode into pagecache 18 * @file: file context (unused) 19 * @folio: folio to fill in. 20 * 21 * Description: 22 * vxfs_immed_read_folio reads a part of the immed area of the 23 * file that hosts @folio into the pagecache. 24 * 25 * Returns: 26 * Zero on success, else a negative error code. 27 * 28 * Locking status: 29 * @folio is locked and will be unlocked. 30 */ vxfs_immed_read_folio(struct file * fp,struct folio * folio)31static int vxfs_immed_read_folio(struct file *fp, struct folio *folio) 32 { 33 struct vxfs_inode_info *vip = VXFS_INO(folio->mapping->host); 34 void *src = vip->vii_immed.vi_immed + folio_pos(folio); 35 unsigned long i; 36 37 for (i = 0; i < folio_nr_pages(folio); i++) { 38 memcpy_to_page(folio_page(folio, i), 0, src, PAGE_SIZE); 39 src += PAGE_SIZE; 40 } 41 42 folio_mark_uptodate(folio); 43 folio_unlock(folio); 44 45 return 0; 46 } 47 48 /* 49 * Address space operations for immed files and directories. 50 */ 51 const struct address_space_operations vxfs_immed_aops = { 52 .read_folio = vxfs_immed_read_folio, 53 }; 54