4 * Copyright (C) 2005 IBM Corporation
5 * Author: Carsten Otte (cotte@de.ibm.com)
10 #include <linux/genhd.h>
11 #include <linux/buffer_head.h>
12 #include <linux/ext2_fs_sb.h>
13 #include <linux/ext2_fs.h>
18 __inode_direct_access(struct inode
*inode
, sector_t sector
,
19 void **kaddr
, unsigned long *pfn
)
21 struct block_device
*bdev
= inode
->i_sb
->s_bdev
;
22 struct block_device_operations
*ops
= bdev
->bd_disk
->fops
;
24 BUG_ON(!ops
->direct_access
);
25 return ops
->direct_access(bdev
, sector
, kaddr
, pfn
);
29 __ext2_get_sector(struct inode
*inode
, sector_t offset
, int create
,
32 struct buffer_head tmp
;
35 memset(&tmp
, 0, sizeof(struct buffer_head
));
36 rc
= ext2_get_block(inode
, offset
/ (PAGE_SIZE
/512), &tmp
,
38 *result
= tmp
.b_blocknr
;
40 /* did we get a sparse block (hole in the file)? */
41 if (!tmp
.b_blocknr
&& !rc
) {
50 ext2_clear_xip_target(struct inode
*inode
, int block
)
52 sector_t sector
= block
* (PAGE_SIZE
/512);
57 rc
= __inode_direct_access(inode
, sector
, &kaddr
, &pfn
);
63 void ext2_xip_verify_sb(struct super_block
*sb
)
65 struct ext2_sb_info
*sbi
= EXT2_SB(sb
);
67 if ((sbi
->s_mount_opt
& EXT2_MOUNT_XIP
) &&
68 !sb
->s_bdev
->bd_disk
->fops
->direct_access
) {
69 sbi
->s_mount_opt
&= (~EXT2_MOUNT_XIP
);
70 ext2_warning(sb
, __FUNCTION__
,
71 "ignoring xip option - not supported by bdev");
76 ext2_get_xip_page(struct address_space
*mapping
, sector_t offset
,
84 /* first, retrieve the sector number */
85 rc
= __ext2_get_sector(mapping
->host
, offset
, create
, §or
);
89 /* retrieve address of the target data */
90 rc
= __inode_direct_access
91 (mapping
->host
, sector
* (PAGE_SIZE
/512), &kaddr
, &pfn
);
93 return pfn_to_page(pfn
);
This page took 0.038695 seconds and 5 git commands to generate.