mirror of
https://gitee.com/openharmony/kernel_linux
synced 2025-02-25 06:02:34 +00:00
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>
This commit is contained in:
parent
9eec4cd53f
commit
b627cff3d3
@ -453,7 +453,7 @@ static int zram_decompress_page(struct zram *zram, char *mem, u32 index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec,
|
static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec,
|
||||||
u32 index, int offset, struct bio *bio)
|
u32 index, int offset)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct page *page;
|
struct page *page;
|
||||||
@ -645,14 +645,13 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index,
|
static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index,
|
||||||
int offset, struct bio *bio)
|
int offset, int rw)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int rw = bio_data_dir(bio);
|
|
||||||
|
|
||||||
if (rw == READ) {
|
if (rw == READ) {
|
||||||
atomic64_inc(&zram->stats.num_reads);
|
atomic64_inc(&zram->stats.num_reads);
|
||||||
ret = zram_bvec_read(zram, bvec, index, offset, bio);
|
ret = zram_bvec_read(zram, bvec, index, offset);
|
||||||
} else {
|
} else {
|
||||||
atomic64_inc(&zram->stats.num_writes);
|
atomic64_inc(&zram->stats.num_writes);
|
||||||
ret = zram_bvec_write(zram, bvec, index, offset);
|
ret = zram_bvec_write(zram, bvec, index, offset);
|
||||||
@ -853,7 +852,7 @@ out:
|
|||||||
|
|
||||||
static void __zram_make_request(struct zram *zram, struct bio *bio)
|
static void __zram_make_request(struct zram *zram, struct bio *bio)
|
||||||
{
|
{
|
||||||
int offset;
|
int offset, rw;
|
||||||
u32 index;
|
u32 index;
|
||||||
struct bio_vec bvec;
|
struct bio_vec bvec;
|
||||||
struct bvec_iter iter;
|
struct bvec_iter iter;
|
||||||
@ -868,6 +867,7 @@ static void __zram_make_request(struct zram *zram, struct bio *bio)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rw = bio_data_dir(bio);
|
||||||
bio_for_each_segment(bvec, bio, iter) {
|
bio_for_each_segment(bvec, bio, iter) {
|
||||||
int max_transfer_size = PAGE_SIZE - offset;
|
int max_transfer_size = PAGE_SIZE - offset;
|
||||||
|
|
||||||
@ -882,15 +882,15 @@ static void __zram_make_request(struct zram *zram, struct bio *bio)
|
|||||||
bv.bv_len = max_transfer_size;
|
bv.bv_len = max_transfer_size;
|
||||||
bv.bv_offset = bvec.bv_offset;
|
bv.bv_offset = bvec.bv_offset;
|
||||||
|
|
||||||
if (zram_bvec_rw(zram, &bv, index, offset, bio) < 0)
|
if (zram_bvec_rw(zram, &bv, index, offset, rw) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
bv.bv_len = bvec.bv_len - max_transfer_size;
|
bv.bv_len = bvec.bv_len - max_transfer_size;
|
||||||
bv.bv_offset += max_transfer_size;
|
bv.bv_offset += max_transfer_size;
|
||||||
if (zram_bvec_rw(zram, &bv, index + 1, 0, bio) < 0)
|
if (zram_bvec_rw(zram, &bv, index + 1, 0, rw) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
} else
|
} else
|
||||||
if (zram_bvec_rw(zram, &bvec, index, offset, bio) < 0)
|
if (zram_bvec_rw(zram, &bvec, index, offset, rw) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
update_position(&index, &offset, &bvec);
|
update_position(&index, &offset, &bvec);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user