diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-04-30 03:51:12 +0200 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-04-30 03:51:12 +0200 |
commit | 049e351306c0769b21698da2e396d4153a146852 (patch) | |
tree | 7b5d1edb3e9be6ab43ca065f639c87aea1b2633b | |
parent | d60249a561b8d3079ab9cf94b80921063fa6d9d1 (diff) |
fix tmpfs-improve-diskfs_node_iterate.patch
-rw-r--r-- | debian/patches/tmpfs-improve-diskfs_node_iterate.patch | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/debian/patches/tmpfs-improve-diskfs_node_iterate.patch b/debian/patches/tmpfs-improve-diskfs_node_iterate.patch index fbb013bd..7b6c05b6 100644 --- a/debian/patches/tmpfs-improve-diskfs_node_iterate.patch +++ b/debian/patches/tmpfs-improve-diskfs_node_iterate.patch @@ -1,20 +1,21 @@ -commit 328d69406ec81b4b8248f46fafa205c6745ef083 +commit eeaf6d931ce4227c45188dc2b1a9b3ce5e8f10fb Author: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Wed Apr 30 02:08:41 2014 +0200 tmpfs: improve diskfs_node_iterate Currently, diskfs_node_iterate iterates twice over all nodes. The - first time only to determine the number of nodes currently in the - cache. Simply count them instead. + first time only to determine the number of nodes. Simply count them + instead. * tmpfs/node.c (all_nodes_nr_items): New variable. - (diskfs_node_norefs): Decrement all_nodes_nr_items. + (diskfs_free_node): Decrement all_nodes_nr_items. + (diskfs_node_norefs): Likewise. (diskfs_cached_lookup): Increment all_nodes_nr_items. - (diskfs_node_iterate): Fix the type of num_nodes, use all_nodes_nr_items. + (diskfs_node_iterate): Use all_nodes_nr_items. diff --git a/tmpfs/node.c b/tmpfs/node.c -index bc0ad64..3925d00 100644 +index bc0ad64..18b73be 100644 --- a/tmpfs/node.c +++ b/tmpfs/node.c @@ -30,6 +30,7 @@ unsigned int num_files; @@ -25,15 +26,23 @@ index bc0ad64..3925d00 100644 error_t diskfs_alloc_node (struct node *dp, mode_t mode, struct node **npp) -@@ -122,6 +123,7 @@ diskfs_node_norefs (struct node *np) +@@ -77,6 +78,7 @@ diskfs_free_node (struct node *np, mode_t mode) + *np->dn->hprevp = np->dn->hnext; + if (np->dn->hnext != 0) + np->dn->hnext->dn->hprevp = np->dn->hprevp; ++ all_nodes_nr_items -= 1; + free (np->dn); + np->dn = 0; + +@@ -120,6 +122,7 @@ diskfs_node_norefs (struct node *np) + *np->dn->hprevp = np->dn->hnext; + if (np->dn->hnext != 0) np->dn->hnext->dn->hprevp = np->dn->hprevp; ++ all_nodes_nr_items -= 1; np->dn->hnext = 0; np->dn->hprevp = 0; -+ all_nodes_nr_items -= 1; } - - free (np); -@@ -186,6 +188,7 @@ diskfs_cached_lookup (ino_t inum, struct node **npp) +@@ -186,6 +189,7 @@ diskfs_cached_lookup (ino_t inum, struct node **npp) dn->hnext->dn->hprevp = &dn->hnext; dn->hprevp = &all_nodes; all_nodes = np; @@ -41,7 +50,7 @@ index bc0ad64..3925d00 100644 pthread_spin_unlock (&diskfs_node_refcnt_lock); st = &np->dn_stat; -@@ -233,8 +236,7 @@ diskfs_node_iterate (error_t (*fun) (struct node *)) +@@ -233,8 +237,7 @@ diskfs_node_iterate (error_t (*fun) (struct node *)) diskfs_node_refcnt_lock, but we can't hold this while locking the individual node locks). */ |