]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ublk: replace xarray with IDA for shmem buffer index allocation
authorMing Lei <tom.leiming@gmail.com>
Thu, 9 Apr 2026 13:30:16 +0000 (21:30 +0800)
committerJens Axboe <axboe@kernel.dk>
Fri, 10 Apr 2026 01:08:35 +0000 (19:08 -0600)
commit5e864438e2853ef5112d7905fadcc3877e2be70a
tree67892d9b5b56f49704135e0338124257cff450bd
parent8ea8566a9aeef746699d8c84bed3ac44edbfaa0e
ublk: replace xarray with IDA for shmem buffer index allocation

Remove struct ublk_buf which only contained nr_pages that was never
read after registration. Use IDA for pure index allocation instead
of xarray. Make __ublk_ctrl_unreg_buf() return int so the caller
can detect invalid index without a separate lookup.

Simplify ublk_buf_cleanup() to walk the maple tree directly and
unpin all pages in one pass, instead of iterating the xarray by
buffer index.

Suggested-by: Caleb Sander Mateos <csander@purestorage.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20260409133020.3780098-5-tom.leiming@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/ublk_drv.c