From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Minchan Kim <minchan@kernel.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org
Subject: Re: [PATCH 09/16] zram: directly call zram_read_page in writeback_store
Date: Thu, 6 Apr 2023 11:56:22 +0900 [thread overview]
Message-ID: <20230406025622.GU12892@google.com> (raw)
In-Reply-To: <20230404150536.2142108-10-hch@lst.de>
On (23/04/04 17:05), Christoph Hellwig wrote:
>
> writeback_store always reads a full page, so just call zram_read_page
> directly and bypass the boune buffer handling.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
> ---
> drivers/block/zram/zram_drv.c | 16 +++++-----------
> 1 file changed, 5 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index 6187e41a346fd8..9d2b6ef4638903 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -54,9 +54,8 @@ static size_t huge_class_size;
> static const struct block_device_operations zram_devops;
>
> static void zram_free_page(struct zram *zram, size_t index);
> -static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec,
> - u32 index, int offset, struct bio *bio);
> -
> +static int zram_read_page(struct zram *zram, struct page *page, u32 index,
> + struct bio *bio, bool partial_io);
>
> static int zram_slot_trylock(struct zram *zram, u32 index)
> {
> @@ -671,10 +670,6 @@ static ssize_t writeback_store(struct device *dev,
> }
>
> for (; nr_pages != 0; index++, nr_pages--) {
> - struct bio_vec bvec;
> -
> - bvec_set_page(&bvec, page, PAGE_SIZE, 0);
> -
> spin_lock(&zram->wb_limit_lock);
> if (zram->wb_limit_enable && !zram->bd_wb_limit) {
> spin_unlock(&zram->wb_limit_lock);
> @@ -718,7 +713,7 @@ static ssize_t writeback_store(struct device *dev,
> /* Need for hugepage writeback racing */
> zram_set_flag(zram, index, ZRAM_IDLE);
> zram_slot_unlock(zram, index);
> - if (zram_bvec_read(zram, &bvec, index, 0, NULL)) {
> + if (zram_read_page(zram, page, index, NULL, false)) {
In theory we can call zram_read_from_zspool() here, but zram_read_page()
is fine with me.
> zram_slot_lock(zram, index);
> zram_clear_flag(zram, index, ZRAM_UNDER_WB);
> zram_clear_flag(zram, index, ZRAM_IDLE);
> @@ -729,9 +724,8 @@ static ssize_t writeback_store(struct device *dev,
> bio_init(&bio, zram->bdev, &bio_vec, 1,
> REQ_OP_WRITE | REQ_SYNC);
> bio.bi_iter.bi_sector = blk_idx * (PAGE_SIZE >> 9);
> -
> - bio_add_page(&bio, bvec.bv_page, bvec.bv_len,
> - bvec.bv_offset);
> + bio_add_page(&bio, page, PAGE_SIZE, 0);
> +
> /*
> * XXX: A single page IO would be inefficient for write
> * but it would be not bad as starter.
> --
> 2.39.2
>
next prev parent reply other threads:[~2023-04-06 2:57 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-04 15:05 zram I/O path cleanups and fixups Christoph Hellwig
2023-04-04 15:05 ` [PATCH 01/16] zram: remove valid_io_request Christoph Hellwig
2023-04-06 1:44 ` Sergey Senozhatsky
2023-04-06 5:39 ` Christoph Hellwig
2023-04-06 6:28 ` Sergey Senozhatsky
2023-04-04 15:05 ` [PATCH 02/16] zram: make zram_bio_discard more self-contained Christoph Hellwig
2023-04-06 1:45 ` Sergey Senozhatsky
2023-04-04 15:05 ` [PATCH 03/16] zram: implify bvec iteration in __zram_make_request Christoph Hellwig
2023-04-06 2:31 ` Sergey Senozhatsky
2023-04-06 5:40 ` Christoph Hellwig
2023-04-04 15:05 ` [PATCH 04/16] zram: move discard handling to zram_submit_bio Christoph Hellwig
2023-04-06 2:33 ` Sergey Senozhatsky
2023-04-04 15:05 ` [PATCH 05/16] zram: return early on error in zram_bvec_rw Christoph Hellwig
2023-04-06 2:38 ` Sergey Senozhatsky
2023-04-04 15:05 ` [PATCH 06/16] zram: refactor highlevel read and write handling Christoph Hellwig
2023-04-06 2:42 ` Sergey Senozhatsky
2023-04-04 15:05 ` [PATCH 07/16] zram: don't use highmem for the bounce buffer in zram_bvec_{read,write} Christoph Hellwig
2023-04-06 2:46 ` Sergey Senozhatsky
2023-04-04 15:05 ` [PATCH 08/16] zram: rename __zram_bvec_read to zram_read_page Christoph Hellwig
2023-04-06 2:47 ` Sergey Senozhatsky
2023-04-04 15:05 ` [PATCH 09/16] zram: directly call zram_read_page in writeback_store Christoph Hellwig
2023-04-06 2:56 ` Sergey Senozhatsky [this message]
2023-04-04 15:05 ` [PATCH 10/16] zram: refactor zram_bdev_read Christoph Hellwig
2023-04-06 2:58 ` Sergey Senozhatsky
2023-04-04 15:05 ` [PATCH 11/16] zram: don't pass a bvec to __zram_bvec_write Christoph Hellwig
2023-04-06 5:11 ` Sergey Senozhatsky
2023-04-04 15:05 ` [PATCH 12/16] zram: refactor zram_bdev_write Christoph Hellwig
2023-04-06 5:15 ` Sergey Senozhatsky
2023-04-06 5:45 ` Christoph Hellwig
2023-04-06 6:30 ` Sergey Senozhatsky
2023-04-04 15:05 ` [PATCH 13/16] zram: pass a page to read_from_bdev Christoph Hellwig
2023-04-06 5:28 ` Sergey Senozhatsky
2023-04-04 15:05 ` [PATCH 14/16] zram: don't return errors from read_from_bdev_async Christoph Hellwig
2023-04-06 5:24 ` Sergey Senozhatsky
2023-04-04 15:05 ` [PATCH 15/16] zram: fix synchronous reads Christoph Hellwig
2023-04-06 6:41 ` Sergey Senozhatsky
2023-04-04 15:05 ` [PATCH 16/16] zram: return errors from read_from_bdev_sync Christoph Hellwig
2023-04-06 5:36 ` Sergey Senozhatsky
2023-04-06 6:43 ` zram I/O path cleanups and fixups Sergey Senozhatsky
2023-04-06 6:46 ` Sergey Senozhatsky
2023-04-06 6:51 ` Sergey Senozhatsky
2023-04-06 6:55 ` Sergey Senozhatsky
-- strict thread matches above, loose matches on Subject: below --
2023-04-06 14:40 zram I/O path cleanups and fixups v2 Christoph Hellwig
2023-04-06 14:40 ` [PATCH 09/16] zram: directly call zram_read_page in writeback_store Christoph Hellwig
2023-04-06 21:19 ` Minchan Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230406025622.GU12892@google.com \
--to=senozhatsky@chromium.org \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=minchan@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.