xip: no struct pages -- direct_access
Subsystems (6)
RFC PATCH 2/3 xip: no struct pages -- direct_access
[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.
---
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(-)
arch/powerpc/sysdev/axonram.c +0 -0
@@ -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;
}
drivers/block/brd.c +1 -1
@@ -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;
}
drivers/s390/block/dcssblk.c +1 -1
@@ -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;
}
include/linux/fs.h +2 -1
@@ -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 *);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>