diff options
author | Jens Axboe <axboe@fb.com> | 2016-08-05 17:11:04 +0300 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2016-08-07 23:41:02 +0300 |
commit | c11f0c0b5bb949673e4fc16c742f0316ae4ced20 (patch) | |
tree | 86b0c6102a4b01c4609a199b783f990e78959b72 /drivers/block/brd.c | |
parent | 52ddb7e9dd735c1a10722c58d3e069af4d3e6df2 (diff) | |
download | linux-c11f0c0b5bb949673e4fc16c742f0316ae4ced20.tar.xz |
block/mm: make bdev_ops->rw_page() take a bool for read/write
Commit abf545484d31 changed it from an 'rw' flags type to the
newer ops based interface, but now we're effectively leaking
some bdev internals to the rest of the kernel. Since we only
care about whether it's a read or a write at that level, just
pass in a bool 'is_write' parameter instead.
Then we can also move op_is_write() and friends back under
CONFIG_BLOCK protection.
Reviewed-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block/brd.c')
-rw-r--r-- | drivers/block/brd.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/block/brd.c b/drivers/block/brd.c index 3439b28cce8b..0c76d4016eeb 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c @@ -300,20 +300,20 @@ static void copy_from_brd(void *dst, struct brd_device *brd, * Process a single bvec of a bio. */ static int brd_do_bvec(struct brd_device *brd, struct page *page, - unsigned int len, unsigned int off, int op, + unsigned int len, unsigned int off, bool is_write, sector_t sector) { void *mem; int err = 0; - if (op_is_write(op)) { + if (is_write) { err = copy_to_brd_setup(brd, sector, len); if (err) goto out; } mem = kmap_atomic(page); - if (!op_is_write(op)) { + if (!is_write) { copy_from_brd(mem + off, brd, sector, len); flush_dcache_page(page); } else { @@ -350,8 +350,8 @@ static blk_qc_t brd_make_request(struct request_queue *q, struct bio *bio) unsigned int len = bvec.bv_len; int err; - err = brd_do_bvec(brd, bvec.bv_page, len, - bvec.bv_offset, bio_op(bio), sector); + err = brd_do_bvec(brd, bvec.bv_page, len, bvec.bv_offset, + op_is_write(bio_op(bio)), sector); if (err) goto io_error; sector += len >> SECTOR_SHIFT; @@ -366,11 +366,11 @@ io_error: } static int brd_rw_page(struct block_device *bdev, sector_t sector, - struct page *page, int op) + struct page *page, bool is_write) { struct brd_device *brd = bdev->bd_disk->private_data; - int err = brd_do_bvec(brd, page, PAGE_SIZE, 0, op, sector); - page_endio(page, op, err); + int err = brd_do_bvec(brd, page, PAGE_SIZE, 0, is_write, sector); + page_endio(page, is_write, err); return err; } |