brd: add support for rw_page()
authorMatthew Wilcox <matthew.r.wilcox@intel.com>
Wed, 4 Jun 2014 23:07:49 +0000 (16:07 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 4 Jun 2014 23:54:02 +0000 (16:54 -0700)
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Dheeraj Reddy <dheeraj.reddy@intel.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/block/brd.c

index e73b85cf0756876adbf4ad9b8220fc466bcdb412..807d3d5d2fe5da383d030e9b4743e1c24d760c99 100644 (file)
@@ -360,6 +360,15 @@ out:
        bio_endio(bio, err);
 }
 
+static int brd_rw_page(struct block_device *bdev, sector_t sector,
+                      struct page *page, int rw)
+{
+       struct brd_device *brd = bdev->bd_disk->private_data;
+       int err = brd_do_bvec(brd, page, PAGE_CACHE_SIZE, 0, rw, sector);
+       page_endio(page, rw & WRITE, err);
+       return err;
+}
+
 #ifdef CONFIG_BLK_DEV_XIP
 static int brd_direct_access(struct block_device *bdev, sector_t sector,
                        void **kaddr, unsigned long *pfn)
@@ -419,6 +428,7 @@ static int brd_ioctl(struct block_device *bdev, fmode_t mode,
 
 static const struct block_device_operations brd_fops = {
        .owner =                THIS_MODULE,
+       .rw_page =              brd_rw_page,
        .ioctl =                brd_ioctl,
 #ifdef CONFIG_BLK_DEV_XIP
        .direct_access =        brd_direct_access,