summaryrefslogtreecommitdiffstats
path: root/fs/jffs2/nodelist.h
diff options
context:
space:
mode:
authorArtem B. Bityuckiy <dedekind@infradead.org>2005-04-09 12:47:03 +0200
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-05-23 13:16:47 +0200
commit8557fd51c22e4c2109f062decd19de439061ceae (patch)
tree66884a832e912decd06a8441db05fd78ec8e3e6e /fs/jffs2/nodelist.h
parent[MTD] DiskOnChip: Add some comments (diff)
downloadlinux-8557fd51c22e4c2109f062decd19de439061ceae.tar.xz
linux-8557fd51c22e4c2109f062decd19de439061ceae.zip
[JFFS2] Fix race in garbage collector
Fix the race problem described here: http://lists.infradead.org/pipermail/linux-mtd/2005-April/012361.html Signed-off-by: Artem B. Bityuckiy <dedekind@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs/jffs2/nodelist.h')
-rw-r--r--fs/jffs2/nodelist.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h
index 57f675c2c97f..a65539f28b06 100644
--- a/fs/jffs2/nodelist.h
+++ b/fs/jffs2/nodelist.h
@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
- * $Id: nodelist.h,v 1.128 2005/02/27 23:01:32 dwmw2 Exp $
+ * $Id: nodelist.h,v 1.130 2005/04/09 10:46:59 dedekind Exp $
*
*/
@@ -363,6 +363,18 @@ static inline struct jffs2_node_frag *frag_first(struct rb_root *root)
node = node->rb_left;
return rb_entry(node, struct jffs2_node_frag, rb);
}
+
+static inline struct jffs2_node_frag *frag_last(struct rb_root *root)
+{
+ struct rb_node *node = root->rb_node;
+
+ if (!node)
+ return NULL;
+ while(node->rb_right)
+ node = node->rb_right;
+ return rb_entry(node, struct jffs2_node_frag, rb);
+}
+
#define rb_parent(rb) ((rb)->rb_parent)
#define frag_next(frag) rb_entry(rb_next(&(frag)->rb), struct jffs2_node_frag, rb)
#define frag_prev(frag) rb_entry(rb_prev(&(frag)->rb), struct jffs2_node_frag, rb)