aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2
diff options
context:
space:
mode:
authorArtem B. Bityutskiy <dedekind@infradead.org>2005-07-31 04:20:48 -0400
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-11-06 12:11:59 -0500
commit1e900979a7e6c2abbfd1b86bffd226d2d6115f66 (patch)
tree700fd63d312704da8ab58d9de842420bc192f013 /fs/jffs2
parent737b7661e059680a68afb3df0a088fd976f666b7 (diff)
[JFFS2] Move another fragtree-related function to nodelist.c
Signed-off-by: Artem B. Bityutskiy <dedekind@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs/jffs2')
-rw-r--r--fs/jffs2/nodelist.c26
-rw-r--r--fs/jffs2/nodelist.h4
-rw-r--r--fs/jffs2/readinode.c26
3 files changed, 28 insertions, 28 deletions
diff --git a/fs/jffs2/nodelist.c b/fs/jffs2/nodelist.c
index 7997f526c94b..0cf5e6f11989 100644
--- a/fs/jffs2/nodelist.c
+++ b/fs/jffs2/nodelist.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in this directory. 8 * For licensing information, see the file 'LICENCE' in this directory.
9 * 9 *
10 * $Id: nodelist.c,v 1.102 2005/07/28 12:45:10 dedekind Exp $ 10 * $Id: nodelist.c,v 1.103 2005/07/31 08:20:44 dedekind Exp $
11 * 11 *
12 */ 12 */
13 13
@@ -51,6 +51,30 @@ void jffs2_add_fd_to_list(struct jffs2_sb_info *c, struct jffs2_full_dirent *new
51 *prev = new; 51 *prev = new;
52} 52}
53 53
54void jffs2_truncate_fragtree(struct jffs2_sb_info *c, struct rb_root *list, uint32_t size)
55{
56 struct jffs2_node_frag *frag = jffs2_lookup_node_frag(list, size);
57
58 JFFS2_DBG_FRAGTREE("truncating fragtree to 0x%08x bytes\n", size);
59
60 /* We know frag->ofs <= size. That's what lookup does for us */
61 if (frag && frag->ofs != size) {
62 if (frag->ofs+frag->size >= size) {
63 JFFS2_DBG_FRAGTREE2("truncating frag 0x%08x-0x%08x\n", frag->ofs, frag->ofs+frag->size);
64 frag->size = size - frag->ofs;
65 }
66 frag = frag_next(frag);
67 }
68 while (frag && frag->ofs >= size) {
69 struct jffs2_node_frag *next = frag_next(frag);
70
71 JFFS2_DBG_FRAGTREE("removing frag 0x%08x-0x%08x\n", frag->ofs, frag->ofs+frag->size);
72 frag_erase(frag, list);
73 jffs2_obsolete_node_frag(c, frag);
74 frag = next;
75 }
76}
77
54void jffs2_obsolete_node_frag(struct jffs2_sb_info *c, struct jffs2_node_frag *this) 78void jffs2_obsolete_node_frag(struct jffs2_sb_info *c, struct jffs2_node_frag *this)
55{ 79{
56 if (this->node) { 80 if (this->node) {
diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h
index 452fc81f391a..53c12e4a337d 100644
--- a/fs/jffs2/nodelist.h
+++ b/fs/jffs2/nodelist.h
@@ -7,7 +7,7 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in this directory. 8 * For licensing information, see the file 'LICENCE' in this directory.
9 * 9 *
10 * $Id: nodelist.h,v 1.135 2005/07/27 14:46:11 dedekind Exp $ 10 * $Id: nodelist.h,v 1.136 2005/07/31 08:20:44 dedekind Exp $
11 * 11 *
12 */ 12 */
13 13
@@ -310,6 +310,7 @@ struct rb_node *rb_prev(struct rb_node *);
310void rb_replace_node(struct rb_node *victim, struct rb_node *new, struct rb_root *root); 310void rb_replace_node(struct rb_node *victim, struct rb_node *new, struct rb_root *root);
311void jffs2_obsolete_node_frag(struct jffs2_sb_info *c, struct jffs2_node_frag *this); 311void jffs2_obsolete_node_frag(struct jffs2_sb_info *c, struct jffs2_node_frag *this);
312int jffs2_add_full_dnode_to_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_full_dnode *fn); 312int jffs2_add_full_dnode_to_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_full_dnode *fn);
313void jffs2_truncate_fragtree (struct jffs2_sb_info *c, struct rb_root *list, uint32_t size);
313 314
314/* nodemgmt.c */ 315/* nodemgmt.c */
315int jffs2_thread_should_wake(struct jffs2_sb_info *c); 316int jffs2_thread_should_wake(struct jffs2_sb_info *c);
@@ -333,7 +334,6 @@ int jffs2_do_link (struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, uint
333 334
334 335
335/* readinode.c */ 336/* readinode.c */
336void jffs2_truncate_fragtree (struct jffs2_sb_info *c, struct rb_root *list, uint32_t size);
337int jffs2_do_read_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, 337int jffs2_do_read_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
338 uint32_t ino, struct jffs2_raw_inode *latest_node); 338 uint32_t ino, struct jffs2_raw_inode *latest_node);
339int jffs2_do_crccheck_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic); 339int jffs2_do_crccheck_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 8c6665d0e334..f3b12d7fe9ab 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in this directory. 8 * For licensing information, see the file 'LICENCE' in this directory.
9 * 9 *
10 * $Id: readinode.c,v 1.133 2005/07/30 15:28:24 lunn Exp $ 10 * $Id: readinode.c,v 1.134 2005/07/31 08:20:44 dedekind Exp $
11 * 11 *
12 */ 12 */
13 13
@@ -21,30 +21,6 @@
21#include <linux/compiler.h> 21#include <linux/compiler.h>
22#include "nodelist.h" 22#include "nodelist.h"
23 23
24void jffs2_truncate_fragtree (struct jffs2_sb_info *c, struct rb_root *list, uint32_t size)
25{
26 struct jffs2_node_frag *frag = jffs2_lookup_node_frag(list, size);
27
28 JFFS2_DBG_FRAGTREE("truncating fragtree to 0x%08x bytes\n", size);
29
30 /* We know frag->ofs <= size. That's what lookup does for us */
31 if (frag && frag->ofs != size) {
32 if (frag->ofs+frag->size >= size) {
33 JFFS2_DBG_FRAGTREE2("truncating frag 0x%08x-0x%08x\n", frag->ofs, frag->ofs+frag->size);
34 frag->size = size - frag->ofs;
35 }
36 frag = frag_next(frag);
37 }
38 while (frag && frag->ofs >= size) {
39 struct jffs2_node_frag *next = frag_next(frag);
40
41 JFFS2_DBG_FRAGTREE("removing frag 0x%08x-0x%08x\n", frag->ofs, frag->ofs+frag->size);
42 frag_erase(frag, list);
43 jffs2_obsolete_node_frag(c, frag);
44 frag = next;
45 }
46}
47
48/* 24/*
49 * Put a new tmp_dnode_info into the temporaty RB-tree, keeping the list in 25 * Put a new tmp_dnode_info into the temporaty RB-tree, keeping the list in
50 * order of increasing version. 26 * order of increasing version.