2022-05-16 16:38:25 +03:00
// SPDX-License-Identifier: GPL-2.0-only
2005-04-17 02:20:36 +04: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 11:58:54 +04:00
# include "vxfs_extern.h"
2005-04-17 02:20:36 +04:00
# include "vxfs_inode.h"
/**
2022-04-29 18:12:16 +03:00
* vxfs_immed_read_folio - read part of an immed inode into pagecache
2005-04-17 02:20:36 +04:00
* @ file : file context ( unused )
2022-04-29 18:12:16 +03:00
* @ folio : folio to fill in .
2005-04-17 02:20:36 +04:00
*
* Description :
2022-04-29 18:12:16 +03:00
* vxfs_immed_read_folio reads a part of the immed area of the
2022-04-29 18:12:16 +03:00
* file that hosts @ folio into the pagecache .
2005-04-17 02:20:36 +04:00
*
* Returns :
* Zero on success , else a negative error code .
*
* Locking status :
2022-04-29 18:12:16 +03:00
* @ folio is locked and will be unlocked .
2005-04-17 02:20:36 +04:00
*/
2022-04-29 18:12:16 +03:00
static int vxfs_immed_read_folio ( struct file * fp , struct folio * folio )
2005-04-17 02:20:36 +04:00
{
2022-04-29 18:12:16 +03: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 02:20:36 +04:00
2022-04-29 18:12:16 +03: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 02:20:36 +04:00
return 0 ;
}
2022-04-29 18:12:16 +03:00
/*
* Address space operations for immed files and directories .
*/
const struct address_space_operations vxfs_immed_aops = {
. read_folio = vxfs_immed_read_folio ,
} ;