[PATCH] xip: bdev: execute in place

This is the block device related part. The block device operation
direct_access now has a struct block_device as first parameter.

Signed-off-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Carsten Otte and committed by Linus Torvalds 420edbcc 3d41088f

+41 -4
+40 -4
drivers/s390/block/dcssblk.c
··· 35 static int dcssblk_open(struct inode *inode, struct file *filp); 36 static int dcssblk_release(struct inode *inode, struct file *filp); 37 static int dcssblk_make_request(struct request_queue *q, struct bio *bio); 38 39 static char dcssblk_segments[DCSSBLK_PARM_LEN] = "\0"; 40 41 static int dcssblk_major; 42 static struct block_device_operations dcssblk_devops = { 43 - .owner = THIS_MODULE, 44 - .open = dcssblk_open, 45 - .release = dcssblk_release, 46 }; 47 48 static ssize_t dcssblk_add_store(struct device * dev, struct device_attribute *attr, const char * buf, ··· 644 /* Request beyond end of DCSS segment. */ 645 goto fail; 646 } 647 index = (bio->bi_sector >> 3); 648 bio_for_each_segment(bvec, bio, i) { 649 page_addr = (unsigned long) ··· 678 bio_endio(bio, bytes_done, 0); 679 return 0; 680 fail: 681 - bio_io_error(bio, bytes_done); 682 return 0; 683 } 684
··· 35 static int dcssblk_open(struct inode *inode, struct file *filp); 36 static int dcssblk_release(struct inode *inode, struct file *filp); 37 static int dcssblk_make_request(struct request_queue *q, struct bio *bio); 38 + static int dcssblk_direct_access(struct block_device *bdev, sector_t secnum, 39 + unsigned long *data); 40 41 static char dcssblk_segments[DCSSBLK_PARM_LEN] = "\0"; 42 43 static int dcssblk_major; 44 static struct block_device_operations dcssblk_devops = { 45 + .owner = THIS_MODULE, 46 + .open = dcssblk_open, 47 + .release = dcssblk_release, 48 + .direct_access = dcssblk_direct_access, 49 }; 50 51 static ssize_t dcssblk_add_store(struct device * dev, struct device_attribute *attr, const char * buf, ··· 641 /* Request beyond end of DCSS segment. */ 642 goto fail; 643 } 644 + /* verify data transfer direction */ 645 + if (dev_info->is_shared) { 646 + switch (dev_info->segment_type) { 647 + case SEG_TYPE_SR: 648 + case SEG_TYPE_ER: 649 + case SEG_TYPE_SC: 650 + /* cannot write to these segments */ 651 + if (bio_data_dir(bio) == WRITE) { 652 + PRINT_WARN("rejecting write to ro segment %s\n", dev_info->dev.bus_id); 653 + goto fail; 654 + } 655 + } 656 + } 657 + 658 index = (bio->bi_sector >> 3); 659 bio_for_each_segment(bvec, bio, i) { 660 page_addr = (unsigned long) ··· 661 bio_endio(bio, bytes_done, 0); 662 return 0; 663 fail: 664 + bio_io_error(bio, bio->bi_size); 665 + return 0; 666 + } 667 + 668 + static int 669 + dcssblk_direct_access (struct block_device *bdev, sector_t secnum, 670 + unsigned long *data) 671 + { 672 + struct dcssblk_dev_info *dev_info; 673 + unsigned long pgoff; 674 + 675 + dev_info = bdev->bd_disk->private_data; 676 + if (!dev_info) 677 + return -ENODEV; 678 + if (secnum % (PAGE_SIZE/512)) 679 + return -EINVAL; 680 + pgoff = secnum / (PAGE_SIZE / 512); 681 + if ((pgoff+1)*PAGE_SIZE-1 > dev_info->end - dev_info->start) 682 + return -ERANGE; 683 + *data = (unsigned long) (dev_info->start+pgoff*PAGE_SIZE); 684 return 0; 685 } 686
+1
include/linux/fs.h
··· 885 int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long); 886 long (*unlocked_ioctl) (struct file *, unsigned, unsigned long); 887 long (*compat_ioctl) (struct file *, unsigned, unsigned long); 888 int (*media_changed) (struct gendisk *); 889 int (*revalidate_disk) (struct gendisk *); 890 struct module *owner;
··· 885 int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long); 886 long (*unlocked_ioctl) (struct file *, unsigned, unsigned long); 887 long (*compat_ioctl) (struct file *, unsigned, unsigned long); 888 + int (*direct_access) (struct block_device *, sector_t, unsigned long *); 889 int (*media_changed) (struct gendisk *); 890 int (*revalidate_disk) (struct gendisk *); 891 struct module *owner;