+ lib-radix-tree-radix_tree_delete_item.patch added to -mm tree
[email protected]
maintainerSubject: + lib-radix-tree-radix_tree_delete_item.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Tue, 04 Feb 2014 15:14:42 -0800
The patch titled
Subject: lib: radix-tree: add radix_tree_delete_item()
has been added to the -mm tree. Its filename is
lib-radix-tree-radix_tree_delete_item.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/lib-radix-tree-radix_tree_delete_item.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/lib-radix-tree-radix_tree_delete_item.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Johannes Weiner <[email protected]>
Subject: lib: radix-tree: add radix_tree_delete_item()
Provide a function that does not just delete an entry at a given index, but also allows passing in an expected item. Delete only if that item is still located at the specified index.
This is handy when lockless tree traversals want to delete entries as well because they don't have to do an second, locked lookup to verify the slot has not changed under them before deleting the entry.
---
include/linux/radix-tree.h | 1 + lib/radix-tree.c | 31 +++++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-)
include/linux/radix-tree.h renamed from include/linux/radix-tree.h~lib-radix-tree-radix_tree_delete_item +1 -0
@@ -219,6 +219,7 @@ static inline void radix_tree_replace_slint radix_tree_insert (struct radix_tree_root *,unsigned long ,void *);void *radix_tree_lookup (struct radix_tree_root *,unsigned long );void **radix_tree_lookup_slot (struct radix_tree_root *,unsigned long ); +void *radix_tree_delete_item (struct radix_tree_root *,unsigned long ,void *);void *radix_tree_delete (struct radix_tree_root *,unsigned long ); unsigned int radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
lib/radix-tree.c renamed from lib/radix-tree.c~lib-radix-tree-radix_tree_delete_item +27 -4
@@ -1335,15 +1335,18 @@ static inline void radix_tree_shrink(str }/** -* radix_tree_delete - delete an item from a radix tree +* radix_tree_delete_item - delete an item from a radix tree * @root: radix tree root * @index: index key +* @item: expected item * -* Remove the item at @index from the radix tree rooted at @root. +* Remove @item at @index from the radix tree rooted at @root. * -* Returns the address of the deleted item, or NULL if it was not present. +* Returns the address of the deleted item, or NULL if it was not present +* or the entry at the given @index was not @item. */ -void *radix_tree_delete (struct radix_tree_root *root,unsigned long index) +void *radix_tree_delete_item (struct radix_tree_root *root, +unsigned long index,void *item) {struct radix_tree_node *node =NULL ;struct radix_tree_node *slot =NULL ;
@@ -1378,6 +1381,11 @@ void *radix_tree_delete(struct radix_treif (slot ==NULL ) goto out; +if (item && slot != item) { + slot =NULL ; + goto out; + } +/* * Clear all tags associated with the item to be deleted. * This way of doing it would be inefficient, but seldom is any set.
@@ -1422,6 +1430,21 @@ void *radix_tree_delete(struct radix_tre out:return slot; } +EXPORT_SYMBOL (radix_tree_delete_item); + +/** +* radix_tree_delete - delete an item from a radix tree +* @root: radix tree root +* @index: index key +* +* Remove the item at @index from the radix tree rooted at @root. +* +* Returns the address of the deleted item, or NULL if it was not present. +*/ +void *radix_tree_delete (struct radix_tree_root *root,unsigned long index) +{ +return radix_tree_delete_item (root, index,NULL ); +}EXPORT_SYMBOL (radix_tree_delete);/**
_
Patches currently in -mm which might be from [email protected] are
mm-vmscan-respect-numa-policy-mask-when-shrinking-slab-on-direct-reclaim.patch mm-vmscan-move-call-to-shrink_slab-to-shrink_zones.patch mm-vmscan-remove-shrink_control-arg-from-do_try_to_free_pages.patch mm-vmstat-fix-up-zone-state-accounting.patch fs-cachefiles-use-add_to_page_cache_lru.patch lib-radix-tree-radix_tree_delete_item.patch mm-shmem-save-one-radix-tree-lookup-when-truncating-swapped-pages.patch mm-filemap-move-radix-tree-hole-searching-here.patch mm-fs-prepare-for-non-page-entries-in-page-cache-radix-trees.patch mm-fs-store-shadow-entries-in-page-cache.patch mm-thrash-detection-based-file-cache-sizing.patch lib-radix_tree-tree-node-interface.patch mm-keep-page-cache-radix-tree-nodes-in-check.patch linux-next.patch
debugging-keep-track-of-page-owners.patch