diff options
author | Jérôme Glisse <jglisse@redhat.com> | 2019-04-08 14:01:43 -0400 |
---|---|---|
committer | Jérôme Glisse <jglisse@redhat.com> | 2019-04-10 17:06:19 -0400 |
commit | 83691c86a6c8f560b5b78f3f57fcd62c0f3f1c7a (patch) | |
tree | 6c2c26f43dcb5fb99f180d915c76de22019bb185 | |
parent | b070348d0e1fd9397eb8d0e97b4c89f1d04d5a0a (diff) |
zram: pass down the bvec we need to read into in the work struct
When scheduling work item to read page we need to pass down the proper
bvec struct which point to the page to read into. Before this patch it
uses randomly initialized bvec (only if PAGE_SIZE != 4096) which is
wrong.
Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: linux-kernel@vger.kernel.org
-rw-r--r-- | drivers/block/zram/zram_drv.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 399cad7daae7..d58a359a6622 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -774,18 +774,18 @@ struct zram_work { struct zram *zram; unsigned long entry; struct bio *bio; + struct bio_vec bvec; }; #if PAGE_SIZE != 4096 static void zram_sync_read(struct work_struct *work) { - struct bio_vec bvec; struct zram_work *zw = container_of(work, struct zram_work, work); struct zram *zram = zw->zram; unsigned long entry = zw->entry; struct bio *bio = zw->bio; - read_from_bdev_async(zram, &bvec, entry, bio); + read_from_bdev_async(zram, &zw->bvec, entry, bio); } /* @@ -798,6 +798,7 @@ static int read_from_bdev_sync(struct zram *zram, struct bio_vec *bvec, { struct zram_work work; + work.bvec = *bvec; work.zram = zram; work.entry = entry; work.bio = bio; |