2022-05-16 21:38:25 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2000-2001 Christoph Hellwig.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Veritas filesystem driver - support for 'immed' inodes.
|
|
|
|
*/
|
|
|
|
#include <linux/fs.h>
|
|
|
|
#include <linux/pagemap.h>
|
|
|
|
|
|
|
|
#include "vxfs.h"
|
2008-04-29 15:58:54 +08:00
|
|
|
#include "vxfs_extern.h"
|
2005-04-17 06:20:36 +08:00
|
|
|
#include "vxfs_inode.h"
|
|
|
|
|
|
|
|
/**
|
2022-04-29 23:12:16 +08:00
|
|
|
* vxfs_immed_read_folio - read part of an immed inode into pagecache
|
2005-04-17 06:20:36 +08:00
|
|
|
* @file: file context (unused)
|
2022-04-29 23:12:16 +08:00
|
|
|
* @folio: folio to fill in.
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* Description:
|
2022-04-29 23:12:16 +08:00
|
|
|
* vxfs_immed_read_folio reads a part of the immed area of the
|
2022-04-29 23:12:16 +08:00
|
|
|
* file that hosts @folio into the pagecache.
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* Returns:
|
|
|
|
* Zero on success, else a negative error code.
|
|
|
|
*
|
|
|
|
* Locking status:
|
2022-04-29 23:12:16 +08:00
|
|
|
* @folio is locked and will be unlocked.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2022-04-29 23:12:16 +08:00
|
|
|
static int vxfs_immed_read_folio(struct file *fp, struct folio *folio)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2022-04-29 23:12:16 +08:00
|
|
|
struct vxfs_inode_info *vip = VXFS_INO(folio->mapping->host);
|
|
|
|
void *src = vip->vii_immed.vi_immed + folio_pos(folio);
|
|
|
|
unsigned long i;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2022-04-29 23:12:16 +08:00
|
|
|
for (i = 0; i < folio_nr_pages(folio); i++) {
|
|
|
|
memcpy_to_page(folio_page(folio, i), 0, src, PAGE_SIZE);
|
|
|
|
src += PAGE_SIZE;
|
|
|
|
}
|
|
|
|
|
|
|
|
folio_mark_uptodate(folio);
|
|
|
|
folio_unlock(folio);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2022-04-29 23:12:16 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Address space operations for immed files and directories.
|
|
|
|
*/
|
|
|
|
const struct address_space_operations vxfs_immed_aops = {
|
|
|
|
.read_folio = vxfs_immed_read_folio,
|
|
|
|
};
|