]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
zram: rework bdev block allocation
authorSergey Senozhatsky <senozhatsky@chromium.org>
Sat, 22 Nov 2025 07:40:28 +0000 (16:40 +0900)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 24 Nov 2025 23:08:53 +0000 (15:08 -0800)
commite87ddea34567dd4e5cb1f2c9e02778485b3c9757
treeb453d0a74cdd6fd8e3c698c0be9d11b2b005ff5b
parenta4f506c569e1320c2db4a32955e47961fcf02b05
zram: rework bdev block allocation

First, writeback bdev ->bitmap bits are set only from one context, as we
can have only one single task performing writeback, so we cannot race with
anything else.  Remove retry path.

Second, we always check ZRAM_WB flag to distinguish writtenback slots, so
we should not confuse 0 bdev block index and 0 handle.  We can use first
bdev block (0 bit) for writeback as well.

While at it, give functions slightly more accurate names, as we don't
alloc/free anything there, we reserve a block for async writeback or
release the block.

Link: https://lkml.kernel.org/r/20251122074029.3948921-6-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Brian Geffon <bgeffon@google.com>
Cc: Minchan Kim <minchan@google.com>
Cc: Richard Chang <richardycc@google.com>
Cc: Yuwen Chen <ywen.chen@foxmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/block/zram/zram_drv.c