aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorkaram.lee <karam.lee@lge.com>2014-12-12 19:56:47 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-13 15:42:49 -0500
commitb627cff3d308d3ccb3ec73a89260f5c7872e46a4 (patch)
tree9b97db382c8467564528cad4503e369f45a0cc55 /drivers/block
parent9eec4cd53f9865b733dc78cf5f6465871beed014 (diff)
zram: remove bio parameter from zram_bvec_rw()
Recently rw_page block device operation has been added. This patchset implements rw_page operation for zram block device and does some clean-up. This patch (of 3): Remove an unnecessary parameter(bio) from zram_bvec_rw() and zram_bvec_read(). zram_bvec_read() doesn't use a bio parameter, so remove it. zram_bvec_rw() calls a read/write operation not using bio, so a rw parameter replaces a bio parameter. Signed-off-by: karam.lee <karam.lee@lge.com> Acked-by: Minchan Kim <minchan@kernel.org> Acked-by: Jerome Marchand <jmarchan@redhat.com> Cc: Matthew Wilcox <matthew.r.wilcox@intel.com> Cc: Nitin Gupta <ngupta@vflare.org> Cc: <seungho1.park@lge.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/zram/zram_drv.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 3920ee45aa59..ac5be75c013f 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -453,7 +453,7 @@ static int zram_decompress_page(struct zram *zram, char *mem, u32 index)
453} 453}
454 454
455static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec, 455static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec,
456 u32 index, int offset, struct bio *bio) 456 u32 index, int offset)
457{ 457{
458 int ret; 458 int ret;
459 struct page *page; 459 struct page *page;
@@ -645,14 +645,13 @@ out:
645} 645}
646 646
647static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index, 647static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index,
648 int offset, struct bio *bio) 648 int offset, int rw)
649{ 649{
650 int ret; 650 int ret;
651 int rw = bio_data_dir(bio);
652 651
653 if (rw == READ) { 652 if (rw == READ) {
654 atomic64_inc(&zram->stats.num_reads); 653 atomic64_inc(&zram->stats.num_reads);
655 ret = zram_bvec_read(zram, bvec, index, offset, bio); 654 ret = zram_bvec_read(zram, bvec, index, offset);
656 } else { 655 } else {
657 atomic64_inc(&zram->stats.num_writes); 656 atomic64_inc(&zram->stats.num_writes);
658 ret = zram_bvec_write(zram, bvec, index, offset); 657 ret = zram_bvec_write(zram, bvec, index, offset);
@@ -853,7 +852,7 @@ out:
853 852
854static void __zram_make_request(struct zram *zram, struct bio *bio) 853static void __zram_make_request(struct zram *zram, struct bio *bio)
855{ 854{
856 int offset; 855 int offset, rw;
857 u32 index; 856 u32 index;
858 struct bio_vec bvec; 857 struct bio_vec bvec;
859 struct bvec_iter iter; 858 struct bvec_iter iter;
@@ -868,6 +867,7 @@ static void __zram_make_request(struct zram *zram, struct bio *bio)
868 return; 867 return;
869 } 868 }
870 869
870 rw = bio_data_dir(bio);
871 bio_for_each_segment(bvec, bio, iter) { 871 bio_for_each_segment(bvec, bio, iter) {
872 int max_transfer_size = PAGE_SIZE - offset; 872 int max_transfer_size = PAGE_SIZE - offset;
873 873
@@ -882,15 +882,15 @@ static void __zram_make_request(struct zram *zram, struct bio *bio)
882 bv.bv_len = max_transfer_size; 882 bv.bv_len = max_transfer_size;
883 bv.bv_offset = bvec.bv_offset; 883 bv.bv_offset = bvec.bv_offset;
884 884
885 if (zram_bvec_rw(zram, &bv, index, offset, bio) < 0) 885 if (zram_bvec_rw(zram, &bv, index, offset, rw) < 0)
886 goto out; 886 goto out;
887 887
888 bv.bv_len = bvec.bv_len - max_transfer_size; 888 bv.bv_len = bvec.bv_len - max_transfer_size;
889 bv.bv_offset += max_transfer_size; 889 bv.bv_offset += max_transfer_size;
890 if (zram_bvec_rw(zram, &bv, index + 1, 0, bio) < 0) 890 if (zram_bvec_rw(zram, &bv, index + 1, 0, rw) < 0)
891 goto out; 891 goto out;
892 } else 892 } else
893 if (zram_bvec_rw(zram, &bvec, index, offset, bio) < 0) 893 if (zram_bvec_rw(zram, &bvec, index, offset, rw) < 0)
894 goto out; 894 goto out;
895 895
896 update_position(&index, &offset, &bvec); 896 update_position(&index, &offset, &bvec);