diff options
Diffstat (limited to 'fs/ext2')
-rw-r--r-- | fs/ext2/xip.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/fs/ext2/xip.c b/fs/ext2/xip.c index ca7f00312388..430b4c8ee971 100644 --- a/fs/ext2/xip.c +++ b/fs/ext2/xip.c | |||
@@ -16,11 +16,13 @@ | |||
16 | 16 | ||
17 | static inline int | 17 | static inline int |
18 | __inode_direct_access(struct inode *inode, sector_t sector, | 18 | __inode_direct_access(struct inode *inode, sector_t sector, |
19 | unsigned long *data) | 19 | void **kaddr, unsigned long *pfn) |
20 | { | 20 | { |
21 | BUG_ON(!inode->i_sb->s_bdev->bd_disk->fops->direct_access); | 21 | struct block_device *bdev = inode->i_sb->s_bdev; |
22 | return inode->i_sb->s_bdev->bd_disk->fops | 22 | struct block_device_operations *ops = bdev->bd_disk->fops; |
23 | ->direct_access(inode->i_sb->s_bdev,sector,data); | 23 | |
24 | BUG_ON(!ops->direct_access); | ||
25 | return ops->direct_access(bdev, sector, kaddr, pfn); | ||
24 | } | 26 | } |
25 | 27 | ||
26 | static inline int | 28 | static inline int |
@@ -48,12 +50,13 @@ int | |||
48 | ext2_clear_xip_target(struct inode *inode, int block) | 50 | ext2_clear_xip_target(struct inode *inode, int block) |
49 | { | 51 | { |
50 | sector_t sector = block * (PAGE_SIZE/512); | 52 | sector_t sector = block * (PAGE_SIZE/512); |
51 | unsigned long data; | 53 | void *kaddr; |
54 | unsigned long pfn; | ||
52 | int rc; | 55 | int rc; |
53 | 56 | ||
54 | rc = __inode_direct_access(inode, sector, &data); | 57 | rc = __inode_direct_access(inode, sector, &kaddr, &pfn); |
55 | if (!rc) | 58 | if (!rc) |
56 | clear_page((void*)data); | 59 | clear_page(kaddr); |
57 | return rc; | 60 | return rc; |
58 | } | 61 | } |
59 | 62 | ||
@@ -74,7 +77,8 @@ ext2_get_xip_page(struct address_space *mapping, sector_t offset, | |||
74 | int create) | 77 | int create) |
75 | { | 78 | { |
76 | int rc; | 79 | int rc; |
77 | unsigned long data; | 80 | void *kaddr; |
81 | unsigned long pfn; | ||
78 | sector_t sector; | 82 | sector_t sector; |
79 | 83 | ||
80 | /* first, retrieve the sector number */ | 84 | /* first, retrieve the sector number */ |
@@ -84,9 +88,9 @@ ext2_get_xip_page(struct address_space *mapping, sector_t offset, | |||
84 | 88 | ||
85 | /* retrieve address of the target data */ | 89 | /* retrieve address of the target data */ |
86 | rc = __inode_direct_access | 90 | rc = __inode_direct_access |
87 | (mapping->host, sector * (PAGE_SIZE/512), &data); | 91 | (mapping->host, sector * (PAGE_SIZE/512), &kaddr, &pfn); |
88 | if (!rc) | 92 | if (!rc) |
89 | return virt_to_page(data); | 93 | return pfn_to_page(pfn); |
90 | 94 | ||
91 | error: | 95 | error: |
92 | return ERR_PTR(rc); | 96 | return ERR_PTR(rc); |