summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJared Hulbert <jaredeh@gmail.com>2008-04-28 02:13:02 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-28 08:58:23 -0700
commit30afcb4bd2762fa4b87b17ada9500aa46dc10b1b (patch)
tree0920f491a37683a8784c146270b98f82a7e0aa2c /fs
parent423bad600443c590f34ed7ce357591f76f48f137 (diff)
return pfn from direct_access, for XIP
Alter the block device ->direct_access() API to work with the new get_xip_mem() API (that requires both kaddr and pfn are returned). Some architectures will not do the right thing in their virt_to_page() for use by XIP (to translate from the kernel virtual address returned by direct_access(), to a user mappable pfn in XIP's page fault handler. However, we can't switch it to just return the pfn and not the kaddr, because we have no good way to get a kva from a pfn, and XIP requires the kva for its read(2) and write(2) handlers. So we have to return both. Signed-off-by: Jared Hulbert <jaredeh@gmail.com> Signed-off-by: Nick Piggin <npiggin@suse.de> Cc: Carsten Otte <cotte@de.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: linux-mm@kvack.org Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext2/xip.c24
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 @@
static inline int
__inode_direct_access(struct inode *inode, sector_t sector,
- unsigned long *data)
+ void **kaddr, unsigned long *pfn)
{
- BUG_ON(!inode->i_sb->s_bdev->bd_disk->fops->direct_access);
- return inode->i_sb->s_bdev->bd_disk->fops
- ->direct_access(inode->i_sb->s_bdev,sector,data);
+ struct block_device *bdev = inode->i_sb->s_bdev;
+ struct block_device_operations *ops = bdev->bd_disk->fops;
+
+ BUG_ON(!ops->direct_access);
+ return ops->direct_access(bdev, sector, kaddr, pfn);
}
static inline int
@@ -48,12 +50,13 @@ int
ext2_clear_xip_target(struct inode *inode, int block)
{
sector_t sector = block * (PAGE_SIZE/512);
- unsigned long data;
+ void *kaddr;
+ unsigned long pfn;
int rc;
- rc = __inode_direct_access(inode, sector, &data);
+ rc = __inode_direct_access(inode, sector, &kaddr, &pfn);
if (!rc)
- clear_page((void*)data);
+ clear_page(kaddr);
return rc;
}
@@ -74,7 +77,8 @@ ext2_get_xip_page(struct address_space *mapping, sector_t offset,
int create)
{
int rc;
- unsigned long data;
+ void *kaddr;
+ unsigned long pfn;
sector_t sector;
/* first, retrieve the sector number */
@@ -84,9 +88,9 @@ ext2_get_xip_page(struct address_space *mapping, sector_t offset,
/* retrieve address of the target data */
rc = __inode_direct_access
- (mapping->host, sector * (PAGE_SIZE/512), &data);
+ (mapping->host, sector * (PAGE_SIZE/512), &kaddr, &pfn);
if (!rc)
- return virt_to_page(data);
+ return pfn_to_page(pfn);
error:
return ERR_PTR(rc);