1. 15 12月, 2016 5 次提交
  2. 13 12月, 2016 1 次提交
  3. 26 9月, 2016 1 次提交
  4. 21 5月, 2016 8 次提交
    • M
      radix-tree: tidy up next_chunk · 8c1244de
      Matthew Wilcox 提交于
      Convert radix_tree_next_chunk to use 'child' instead of 'slot' as the
      name of the child node.  Also use node_maxindex() where it makes sense.
      
      The 'rnode' variable was unnecessary; it doesn't overlap in usage with
      'node', so we can just use 'node' the whole way through the function.
      
      Improve the testcase to start the walk from every index in the carefully
      constructed tree, and to accept any index within the range covered by
      the entry.
      Signed-off-by: NMatthew Wilcox <willy@linux.intel.com>
      Cc: Konstantin Khlebnikov <koct9i@gmail.com>
      Cc: Kirill Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Jan Kara <jack@suse.com>
      Cc: Neil Brown <neilb@suse.de>
      Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8c1244de
    • M
      radix-tree: fix radix_tree_range_tag_if_tagged() for multiorder entries · 070c5ac2
      Matthew Wilcox 提交于
      I had previously decided that tagging a single multiorder entry would
      count as tagging 2^order entries for the purposes of 'nr_to_tag'.  I now
      believe that decision to be a mistake, and it should count as a single
      entry.  That's more likely to be what callers expect.
      
      When walking back up the tree from a newly-tagged entry, the current
      code assumed we were starting from the lowest level of the tree; if we
      have a multiorder entry with an order at least RADIX_TREE_MAP_SHIFT in
      size then we need to shift the index by 'shift' before we start walking
      back up the tree, or we will end up not setting tags on higher entries,
      and then mistakenly thinking that entries below a certain point in the
      tree are not tagged.
      
      If the first index we examine is a sibling entry of a tagged multiorder
      entry, we were not tagging it.  We need to examine the canonical entry,
      and the easiest way to do that is to use radix_tree_descend().  We then
      have to skip over sibling slots when looking for the next entry in the
      tree or we will end up walking back to the canonical entry.
      
      Add several tests for radix_tree_range_tag_if_tagged().
      Signed-off-by: NMatthew Wilcox <willy@linux.intel.com>
      Reviewed-by: NRoss Zwisler <ross.zwisler@linux.intel.com>
      Cc: Konstantin Khlebnikov <koct9i@gmail.com>
      Cc: Kirill Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Jan Kara <jack@suse.com>
      Cc: Neil Brown <neilb@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      070c5ac2
    • M
      radix-tree: fix radix_tree_create for sibling entries · 8a14f4d8
      Matthew Wilcox 提交于
      If the radix tree user attempted to insert a colliding entry with an
      existing multiorder entry, then radix_tree_create() could encounter a
      sibling entry when walking down the tree to look for a slot.  Use
      radix_tree_descend() to fix the problem, and add a test-case to make
      sure the problem doesn't come back in future.
      Signed-off-by: NMatthew Wilcox <willy@linux.intel.com>
      Reviewed-by: NRoss Zwisler <ross.zwisler@linux.intel.com>
      Cc: Konstantin Khlebnikov <koct9i@gmail.com>
      Cc: Kirill Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Jan Kara <jack@suse.com>
      Cc: Neil Brown <neilb@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8a14f4d8
    • R
      radix-tree test suite: add multi-order tag test · 0fc9b8ca
      Ross Zwisler 提交于
      Add a generic test for multi-order tag verification, and call it using
      several different configurations.
      
      This test creates a multi-order radix tree using the given index and
      order, and then sets, checks and clears tags using the indices covered
      by the single multi-order radix tree entry.
      
      With the various calls done by this test we verify root multi-order
      entries without siblings, multi-order entries without siblings in a
      radix tree node, as well as multi-order entries with siblings of various
      sizes.
      Signed-off-by: NRoss Zwisler <ross.zwisler@linux.intel.com>
      Signed-off-by: NMatthew Wilcox <willy@linux.intel.com>
      Cc: Konstantin Khlebnikov <koct9i@gmail.com>
      Cc: Kirill Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Jan Kara <jack@suse.com>
      Cc: Neil Brown <neilb@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0fc9b8ca
    • R
      radix tree test suite: multi-order iteration test · 643b57d0
      Ross Zwisler 提交于
      Add a unit test to verify that we can iterate over multi-order entries
      properly via a radix_tree_for_each_slot() loop.
      
      This was done with a single, somewhat complicated configuration that was
      meant to test many of the various corner cases having to do with
      multi-order entries:
      
      - An iteration could begin at a sibling entry, and we need to return the
        canonical entry.
      - We could have entries of various orders in the same slots[] array.
      - We could have multi-order entries at a nonzero height, followed by
        indirect pointers to more radix tree nodes later in that same slots[]
        array.
      Signed-off-by: NRoss Zwisler <ross.zwisler@linux.intel.com>
      Signed-off-by: NMatthew Wilcox <willy@linux.intel.com>
      Cc: Konstantin Khlebnikov <koct9i@gmail.com>
      Cc: Kirill Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Jan Kara <jack@suse.com>
      Cc: Neil Brown <neilb@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      643b57d0
    • M
      radix-tree: fix multiorder BUG_ON in radix_tree_insert · 7b60e9ad
      Matthew Wilcox 提交于
      These BUG_ON tests are to ensure that all the tags are clear when
      inserting a new entry.  If we insert a multiorder entry, we'll end up
      looking at the tags for a different node, and so the BUG_ON can end up
      triggering spuriously.
      
      Also, we now have three tags, not two, so check all three are clear, and
      check all the root tags with a single call to BUG_ON since the bits are
      stored contiguously.
      
      Include a test-case to ensure this problem does not reoccur.
      Signed-off-by: NMatthew Wilcox <willy@linux.intel.com>
      Reviewed-by: NRoss Zwisler <ross.zwisler@linux.intel.com>
      Cc: Konstantin Khlebnikov <koct9i@gmail.com>
      Cc: Kirill Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Jan Kara <jack@suse.com>
      Cc: Neil Brown <neilb@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7b60e9ad
    • M
      radix-tree: fix several shrinking bugs with multiorder entries · afe0e395
      Matthew Wilcox 提交于
      Setting the indirect bit on the user data entry used to be unambiguous
      because the tree walking code knew not to expect internal nodes in the
      last level of the tree.  Multiorder entries can appear at any level of
      the tree, and a leaf with the indirect bit set is indistinguishable from
      a pointer to a node.
      
      Introduce a special entry (RADIX_TREE_RETRY) which is neither a valid
      user entry, nor a valid pointer to a node.  The radix_tree_deref_retry()
      function continues to work the same way, but tree walking code can
      distinguish it from a pointer to a node.
      
      Also fix the condition for setting slot->parent to NULL; it does not
      matter what height the tree is, it only matters whether slot is an
      indirect pointer.  Move this code above the comment which is referring
      to the assignment to root->rnode.
      
      Also fix the condition for preventing the tree from shrinking to a
      single entry if it's a multiorder entry.
      
      Add a test-case to the test suite that checks that the tree goes back
      down to its original height after an item is inserted & deleted from a
      higher index in the tree.
      Signed-off-by: NMatthew Wilcox <willy@linux.intel.com>
      Reviewed-by: NRoss Zwisler <ross.zwisler@linux.intel.com>
      Cc: Konstantin Khlebnikov <koct9i@gmail.com>
      Cc: Kirill Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Jan Kara <jack@suse.com>
      Cc: Neil Brown <neilb@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      afe0e395
    • M
      radix tree test suite: start adding multiorder tests · 4f3755d1
      Matthew Wilcox 提交于
      Test suite infrastructure for working with multiorder entries.
      
      The test itself is pretty basic: Add an entry, check that all expected
      indices return that entry and that indices around that entry don't
      return an entry.  Then delete the entry and check no index returns that
      entry.  Tests a few edge conditions including the multiorder entry at
      index 0 and at a higher index.  Also tests deleting through an alias as
      well as through the canonical index.
      Signed-off-by: NMatthew Wilcox <willy@linux.intel.com>
      Reviewed-by: NRoss Zwisler <ross.zwisler@linux.intel.com>
      Cc: Konstantin Khlebnikov <koct9i@gmail.com>
      Cc: Kirill Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Jan Kara <jack@suse.com>
      Cc: Neil Brown <neilb@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4f3755d1