* [RFC][PATCH 2/3] xip: no struct pages -- direct_access
@ 2008-03-08 4:33 Jared Hulbert
0 siblings, 0 replies; only message in thread
From: Jared Hulbert @ 2008-03-08 4:33 UTC (permalink / raw)
To: Nick Piggin, Linus Torvalds, Andrew Morton, Carsten Otte,
"Martin Schwidefsky
[RFC][PATCH 2/3] xip: no struct pages -- direct_access
Altering the block device ->direct_access() API to fix with the new
get_xip_mem() API. Allows devices to specify a kaddr and pfn.
Signed-off-by: Jared Hulbert <jaredeh@gmail.com>
---
arch/powerpc/sysdev/axonram.c | 5 +++--
drivers/block/brd.c | 5 +++--
drivers/s390/block/dcssblk.c | 7 +++++--
include/linux/fs.h | 3 ++-
4 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c
index d359d6e..7f59188 100644
--- a/arch/powerpc/sysdev/axonram.c
+++ b/arch/powerpc/sysdev/axonram.c
@@ -143,7 +143,7 @@ axon_ram_make_request(struct request_queue *queue,
struct bio *bio)
*/
static int
axon_ram_direct_access(struct block_device *device, sector_t sector,
- unsigned long *data)
+ void **kaddr, unsigned long *pfn)
{
struct axon_ram_bank *bank = device->bd_disk->private_data;
loff_t offset;
@@ -154,7 +154,8 @@ axon_ram_direct_access(struct block_device
*device, sector_t sector,
return -ERANGE;
}
- *data = bank->ph_addr + offset;
+ *kaddr = (void *)(bank->ph_addr + offset);
+ *pfn = virt_to_phys(kaddr) >> PAGE_SHIFT;
return 0;
}
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 8536480..ec56f3c 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -319,7 +319,7 @@ out:
#ifdef CONFIG_BLK_DEV_XIP
static int brd_direct_access (struct block_device *bdev, sector_t sector,
- unsigned long *data)
+ void **kaddr, unsigned long *pfn)
{
struct brd_device *brd = bdev->bd_disk->private_data;
struct page *page;
@@ -333,7 +333,8 @@ static int brd_direct_access (struct block_device
*bdev, sector_t sector,
page = brd_insert_page(brd, sector);
if (!page)
return -ENOMEM;
- *data = (unsigned long)page_address(page);
+ *kaddr = page_address(page);
+ *pfn = page_to_pfn(page);
return 0;
}
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index e6c94db..59c1949 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -687,7 +687,7 @@ fail:
static int
dcssblk_direct_access (struct block_device *bdev, sector_t secnum,
- unsigned long *data)
+ void **kaddr, unsigned long *pfn)
{
struct dcssblk_dev_info *dev_info;
unsigned long pgoff;
@@ -700,7 +700,10 @@ dcssblk_direct_access (struct block_device *bdev,
sector_t secnum,
pgoff = secnum / (PAGE_SIZE / 512);
if ((pgoff+1)*PAGE_SIZE-1 > dev_info->end - dev_info->start)
return -ERANGE;
- *data = (unsigned long) (dev_info->start+pgoff*PAGE_SIZE);
+
+ *kaddr = (void *)(dev_info->start + pgoff * PAGE_SIZE);
+ *pfn = virt_to_phys(*kaddr) >> PAGE_SHIFT;
+
return 0;
}
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b84b848..27f9a74 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1129,7 +1129,8 @@ struct block_device_operations {
int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long);
long (*unlocked_ioctl) (struct file *, unsigned, unsigned long);
long (*compat_ioctl) (struct file *, unsigned, unsigned long);
- int (*direct_access) (struct block_device *, sector_t, unsigned long *);
+ int (*direct_access) (struct block_device *, sector_t, void **,
+ unsigned long *);
int (*media_changed) (struct gendisk *);
int (*revalidate_disk) (struct gendisk *);
int (*getgeo)(struct block_device *, struct hd_geometry *);
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-03-08 4:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-08 4:33 [RFC][PATCH 2/3] xip: no struct pages -- direct_access Jared Hulbert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).