<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/lib/xarray.c, branch v5.1</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.1</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.1'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2019-02-21T22:54:44Z</updated>
<entry>
<title>XArray: Fix xa_reserve for 2-byte aligned entries</title>
<updated>2019-02-21T22:54:44Z</updated>
<author>
<name>Matthew Wilcox</name>
<email>willy@infradead.org</email>
</author>
<published>2019-02-21T22:54:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4a5c8d898948d1ac876522cdd62f07a78104bfe9'/>
<id>urn:sha1:4a5c8d898948d1ac876522cdd62f07a78104bfe9</id>
<content type='text'>
If we reserve index 0, the next entry to be stored there might be 2-byte
aligned.  That means we have to create the root xa_node at the time of
reserving the initial entry.

Signed-off-by: Matthew Wilcox &lt;willy@infradead.org&gt;
</content>
</entry>
<entry>
<title>XArray: Fix xa_erase of 2-byte aligned entries</title>
<updated>2019-02-21T22:36:45Z</updated>
<author>
<name>Matthew Wilcox</name>
<email>willy@infradead.org</email>
</author>
<published>2019-02-21T22:36:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2fbe967b3eb7466f679307b38564b8271c093241'/>
<id>urn:sha1:2fbe967b3eb7466f679307b38564b8271c093241</id>
<content type='text'>
xas_store() was interpreting the entry it found in the array as a node
entry if the bottom two bits had value 2.  That's only true if either
the entry is in the root node or in a non-leaf node.

Signed-off-by: Matthew Wilcox &lt;willy@infradead.org&gt;
</content>
</entry>
<entry>
<title>XArray: Use xa_cmpxchg to implement xa_reserve</title>
<updated>2019-02-20T22:08:54Z</updated>
<author>
<name>Matthew Wilcox</name>
<email>willy@infradead.org</email>
</author>
<published>2019-02-20T16:51:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=962033d55d0761e0716a01a715c6659c8c8dfc41'/>
<id>urn:sha1:962033d55d0761e0716a01a715c6659c8c8dfc41</id>
<content type='text'>
Jason feels this is clearer, and it saves a function and an exported
symbol.

Suggested-by: Jason Gunthorpe &lt;jgg@ziepe.ca&gt;
Signed-off-by: Matthew Wilcox &lt;willy@infradead.org&gt;
</content>
</entry>
<entry>
<title>XArray: Fix xa_release in allocating arrays</title>
<updated>2019-02-20T22:08:54Z</updated>
<author>
<name>Matthew Wilcox</name>
<email>willy@infradead.org</email>
</author>
<published>2019-02-20T16:30:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b38f6c50270683abf35a388f82cafecce971a003'/>
<id>urn:sha1:b38f6c50270683abf35a388f82cafecce971a003</id>
<content type='text'>
xa_cmpxchg() was a little too magic in turning ZERO entries into NULL,
and would leave the entry set to the ZERO entry instead of releasing
it for future use.  After careful review of existing users of
xa_cmpxchg(), change the semantics so that it does not translate either
incoming argument from NULL into ZERO entries.

Add several tests to the test-suite to make sure this problem doesn't
come back.

Reported-by: Jason Gunthorpe &lt;jgg@ziepe.ca&gt;
Signed-off-by: Matthew Wilcox &lt;willy@infradead.org&gt;
</content>
</entry>
<entry>
<title>XArray: Add cyclic allocation</title>
<updated>2019-02-06T18:32:25Z</updated>
<author>
<name>Matthew Wilcox</name>
<email>willy@infradead.org</email>
</author>
<published>2018-11-06T19:13:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2fa044e51a1f35d7b04cbde07ec513b0ba195e38'/>
<id>urn:sha1:2fa044e51a1f35d7b04cbde07ec513b0ba195e38</id>
<content type='text'>
This differs slightly from the IDR equivalent in five ways.

1. It can allocate up to UINT_MAX instead of being limited to INT_MAX,
   like xa_alloc().  Also like xa_alloc(), it will write to the 'id'
   pointer before placing the entry in the XArray.
2. The 'next' cursor is allocated separately from the XArray instead
   of being part of the IDR.  This saves memory for all the users which
   do not use the cyclic allocation API and suits some users better.
3. It returns -EBUSY instead of -ENOSPC.
4. It will attempt to wrap back to the minimum value on memory allocation
   failure as well as on an -EBUSY error, assuming that a user would
   rather allocate a small ID than suffer an ID allocation failure.
5. It reports whether it has wrapped, which is important to some users.

Signed-off-by: Matthew Wilcox &lt;willy@infradead.org&gt;
</content>
</entry>
<entry>
<title>XArray: Redesign xa_alloc API</title>
<updated>2019-02-06T18:32:23Z</updated>
<author>
<name>Matthew Wilcox</name>
<email>willy@infradead.org</email>
</author>
<published>2018-12-31T15:41:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a3e4d3f97ec844de005a679585c04c5c03dfbdb6'/>
<id>urn:sha1:a3e4d3f97ec844de005a679585c04c5c03dfbdb6</id>
<content type='text'>
It was too easy to forget to initialise the start index.  Add an
xa_limit data structure which can be used to pass min &amp; 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 &lt;willy@infradead.org&gt;
</content>
</entry>
<entry>
<title>XArray: Add support for 1s-based allocation</title>
<updated>2019-02-06T18:13:24Z</updated>
<author>
<name>Matthew Wilcox</name>
<email>willy@infradead.org</email>
</author>
<published>2018-10-26T18:43:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3ccaf57a6a63ad171a951dcaddffc453b2414c7b'/>
<id>urn:sha1:3ccaf57a6a63ad171a951dcaddffc453b2414c7b</id>
<content type='text'>
A lot of places want to allocate IDs starting at 1 instead of 0.
While the xa_alloc() API supports this, it's not very efficient if lots
of IDs are allocated, due to having to walk down to the bottom of the
tree to see if ID 1 is available, then all the way over to the next
non-allocated ID.  This method marks ID 0 as being occupied which wastes
one slot in the XArray, but preserves xa_empty() as working.

Signed-off-by: Matthew Wilcox &lt;willy@infradead.org&gt;
</content>
</entry>
<entry>
<title>XArray: Change xa_insert to return -EBUSY</title>
<updated>2019-02-06T18:12:15Z</updated>
<author>
<name>Matthew Wilcox</name>
<email>willy@infradead.org</email>
</author>
<published>2019-02-06T18:07:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=fd9dc93e36231fb6d520e0edd467058fad4fd12d'/>
<id>urn:sha1:fd9dc93e36231fb6d520e0edd467058fad4fd12d</id>
<content type='text'>
Userspace translates EEXIST to "File exists" which isn't a very good
error message for the problem.  "Device or resource busy" is a better
indication of what went wrong.

Signed-off-by: Matthew Wilcox &lt;willy@infradead.org&gt;
</content>
</entry>
<entry>
<title>XArray: Update xa_erase family descriptions</title>
<updated>2019-02-05T04:16:58Z</updated>
<author>
<name>Matthew Wilcox</name>
<email>willy@infradead.org</email>
</author>
<published>2019-01-26T05:52:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=809ab9371ca0a96b44d9866ad82849410759a45b'/>
<id>urn:sha1:809ab9371ca0a96b44d9866ad82849410759a45b</id>
<content type='text'>
xa_erase does not allocate memory and doesn't have a gfp parameter.
Update the descriptions of all four variants to be more useful.

Signed-off-by: Matthew Wilcox &lt;willy@infradead.org&gt;
</content>
</entry>
<entry>
<title>XArray: Honour reserved entries in xa_insert</title>
<updated>2019-01-07T03:12:58Z</updated>
<author>
<name>Matthew Wilcox</name>
<email>willy@infradead.org</email>
</author>
<published>2019-01-02T18:57:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b0606fed6eece16a421034eca0bbea9a08b90e91'/>
<id>urn:sha1:b0606fed6eece16a421034eca0bbea9a08b90e91</id>
<content type='text'>
xa_insert() should treat reserved entries as occupied, not as available.
Also, it should treat requests to insert a NULL pointer as a request
to reserve the slot.  Add xa_insert_bh() and xa_insert_irq() for
completeness.

Signed-off-by: Matthew Wilcox &lt;willy@infradead.org&gt;
</content>
</entry>
</feed>
