]> git.ipfire.org Git - thirdparty/linux.git/commit - lib/test_xarray.c
XArray: Redesign xa_alloc API
authorMatthew Wilcox <willy@infradead.org>
Mon, 31 Dec 2018 15:41:01 +0000 (10:41 -0500)
committerMatthew Wilcox <willy@infradead.org>
Wed, 6 Feb 2019 18:32:23 +0000 (13:32 -0500)
commita3e4d3f97ec844de005a679585c04c5c03dfbdb6
treec4cda3a98cba2d9923e7356e587f6a958b2971d7
parent3ccaf57a6a63ad171a951dcaddffc453b2414c7b
XArray: Redesign xa_alloc API

It was too easy to forget to initialise the start index.  Add an
xa_limit data structure which can be used to pass min & max, and
define a couple of special values for common cases.  Also add some
more tests cribbed from the IDR test suite.  Change the return value
from -ENOSPC to -EBUSY to match xa_insert().

Signed-off-by: Matthew Wilcox <willy@infradead.org>
include/linux/xarray.h
lib/test_xarray.c
lib/xarray.c