1. 03 6月, 2019 1 次提交
  2. 22 2月, 2019 2 次提交
  3. 21 2月, 2019 1 次提交
    • M
      XArray: Fix xa_release in allocating arrays · b38f6c50
      Matthew Wilcox 提交于
      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: NJason Gunthorpe <jgg@ziepe.ca>
      Signed-off-by: NMatthew Wilcox <willy@infradead.org>
      b38f6c50
  4. 09 2月, 2019 1 次提交
  5. 07 2月, 2019 4 次提交
    • M
      XArray: Add cyclic allocation · 2fa044e5
      Matthew Wilcox 提交于
      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: NMatthew Wilcox <willy@infradead.org>
      2fa044e5
    • M
      XArray: Redesign xa_alloc API · a3e4d3f9
      Matthew Wilcox 提交于
      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: NMatthew Wilcox <willy@infradead.org>
      a3e4d3f9
    • M
      XArray: Add support for 1s-based allocation · 3ccaf57a
      Matthew Wilcox 提交于
      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: NMatthew Wilcox <willy@infradead.org>
      3ccaf57a
    • M
      XArray: Change xa_insert to return -EBUSY · fd9dc93e
      Matthew Wilcox 提交于
      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: NMatthew Wilcox <willy@infradead.org>
      fd9dc93e
  6. 05 2月, 2019 1 次提交
  7. 15 1月, 2019 1 次提交
  8. 07 1月, 2019 4 次提交
  9. 14 12月, 2018 1 次提交
  10. 06 12月, 2018 2 次提交
  11. 19 11月, 2018 1 次提交
  12. 17 11月, 2018 1 次提交
  13. 06 11月, 2018 2 次提交
    • M
      XArray: Regularise xa_reserve · 4c0608f4
      Matthew Wilcox 提交于
      The xa_reserve() function was a little unusual in that it attempted to
      be callable for all kinds of locking scenarios.  Make it look like the
      other APIs with __xa_reserve, xa_reserve_bh and xa_reserve_irq variants.
      Signed-off-by: NMatthew Wilcox <willy@infradead.org>
      4c0608f4
    • M
      XArray: Fix xa_for_each with a single element at 0 · 8229706e
      Matthew Wilcox 提交于
      The following sequence of calls would result in an infinite loop in
      xa_find_after():
      
      	xa_store(xa, 0, x, GFP_KERNEL);
      	index = 0;
      	xa_for_each(xa, entry, index, ULONG_MAX, XA_PRESENT) { }
      
      xa_find_after() was confusing the situation where we found no entry in
      the tree with finding a multiorder entry, so it would look for the
      successor entry forever.  Just check for this case explicitly.  Includes
      a few new checks in the test suite to be sure this doesn't reappear.
      Signed-off-by: NMatthew Wilcox <willy@infradead.org>
      8229706e
  14. 21 10月, 2018 18 次提交