[PATCH 8/8] xarray: Don't clear marks in xas_store()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When storing NULL in xarray, xas_store() has been clearing all marks
because it could otherwise confuse xas_for_each_marked(). That is
however no longer true and no current user relies on this behavior.
Furthermore it seems as a cleaner API to not do clearing behind caller's
back in case we store NULL.

This provides a nice boost to truncate numbers due to saving unnecessary
tag initialization when clearing shadow entries. Sample benchmark
showing time to truncate 128 files 1GB each on machine with 64GB of RAM
(so about half of entries are shadow entries):

         AVG      STDDEV
Vanilla  4.825s   0.036
Patched  4.516s   0.014

So we can see about 6% reduction in overall truncate time.

Signed-off-by: Jan Kara <jack@xxxxxxx>
---
 lib/xarray.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/lib/xarray.c b/lib/xarray.c
index 4e32497c51bd..f165e83652f1 100644
--- a/lib/xarray.c
+++ b/lib/xarray.c
@@ -799,17 +799,8 @@ void *xas_store(struct xa_state *xas, void *entry)
 		if (xas->xa_sibs)
 			xas_squash_marks(xas);
 	}
-	if (!entry)
-		xas_init_marks(xas);
 
 	for (;;) {
-		/*
-		 * Must clear the marks before setting the entry to NULL,
-		 * otherwise xas_for_each_marked may find a NULL entry and
-		 * stop early.  rcu_assign_pointer contains a release barrier
-		 * so the mark clearing will appear to happen before the
-		 * entry is set to NULL.
-		 */
 		rcu_assign_pointer(*slot, entry);
 		if (xa_is_node(next) && (!node || node->shift))
 			xas_free_nodes(xas, xa_to_node(next));
-- 
2.16.4




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux