Re: [PATCH] zram: Always expose rw_page
From: Sergey Senozhatsky
Date: Sun Oct 02 2022 - 22:59:49 EST
On (22/09/30 15:52), Brian Geffon wrote:
> Currently zram will adjust its fops to a version which does not
> contain rw_page when a backing device has been assigned. This is
> done to prevent upper layers from assuming a synchronous operation
> when a page may have been written back. This forces every operation
> through bio which has overhead associated with bio_alloc/frees.
>
> The code can be simplified to always expose a rw_page method and
> only in the rare event that a page is written back we instead will
> return -EOPNOTSUPP forcing the upper layer to fallback to bio.
Reviewed-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
> @@ -1267,6 +1253,9 @@ static int __zram_bvec_read(struct zram *zram, struct page *page, u32 index,
> struct bio_vec bvec;
>
> zram_slot_unlock(zram, index);
> + /* If we don't have a bio we came via rw_page, we must fallback to bio */
> + if (!bio)
> + return -EOPNOTSUPP;
The comment is above 80 cols.