]> git.baikalelectronics.ru Git - kernel.git/commit
sbitmap: add __sbitmap_queue_get_batch()
authorJens Axboe <axboe@kernel.dk>
Sat, 9 Oct 2021 19:02:23 +0000 (13:02 -0600)
committerJens Axboe <axboe@kernel.dk>
Mon, 18 Oct 2021 12:17:35 +0000 (06:17 -0600)
commit4abfce794cea833cb1368ae954d0c9713aab5f29
treecbf520eccf39ff3e23cde171496c6d382e280bfa
parentd319fbbf326f8974951608f7d018cf948b754f1b
sbitmap: add __sbitmap_queue_get_batch()

The block layer tag allocation batching still calls into sbitmap to get
each tag, but we can improve on that. Add __sbitmap_queue_get_batch(),
which returns a mask of tags all at once, along with an offset for
those tags.

An example return would be 0xff, where bits 0..7 are set, with
tag_offset == 128. The valid tags in this case would be 128..135.

A batch is specific to an individual sbitmap_map, hence it cannot be
larger than that. The requested number of tags is automatically reduced
to the max that can be satisfied with a single map.

On failure, 0 is returned. Caller should fall back to single tag
allocation at that point/

Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/sbitmap.h
lib/sbitmap.c