aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-08-02 17:08:53 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-08-02 17:08:53 -0400
commit7a883eaf62f4b943ebec738ce3b0796c67ef5d32 (patch)
tree8c7382552b62a8f1629ce77a2ababb99ebe95112 /fs
parent628506c8de058f94297dae1f8ef8caaea29c4369 (diff)
parent515495a1da9abf339b922b7919c4950e85b87b42 (diff)
Merge git://git.infradead.org/~dwmw2/mtd-2.6.23
* git://git.infradead.org/~dwmw2/mtd-2.6.23: [MTD] [NAND] nand_base.c: fix type of eccpos pointer [MTD] [NAND] at91_nand rdy_pin fix [MTD] [NAND] fix race in nand_base.c [MTD] [NAND] Fix refactoring of EDB7312 hwcontrol function. [MTD] Fix potential leak in rfd_ftl_add_mtd [JFFS2] Print correct node offset when complaining about broken data CRC [JFFS2] Fix suspend failure with JFFS2 GC thread. [JFFS2] Deletion dirents should be REF_NORMAL, not REF_PRISTINE. [JFFS2] Prevent oops after 'node added in wrong place' debug check
Diffstat (limited to 'fs')
-rw-r--r--fs/jffs2/background.c8
-rw-r--r--fs/jffs2/nodelist.h5
-rw-r--r--fs/jffs2/readinode.c4
-rw-r--r--fs/jffs2/scan.c3
-rw-r--r--fs/jffs2/write.c15
5 files changed, 27 insertions, 8 deletions
diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c
index 143c5530caf3..504643f2e98b 100644
--- a/fs/jffs2/background.c
+++ b/fs/jffs2/background.c
@@ -84,7 +84,7 @@ static int jffs2_garbage_collect_thread(void *_c)
84 set_freezable(); 84 set_freezable();
85 for (;;) { 85 for (;;) {
86 allow_signal(SIGHUP); 86 allow_signal(SIGHUP);
87 87 again:
88 if (!jffs2_thread_should_wake(c)) { 88 if (!jffs2_thread_should_wake(c)) {
89 set_current_state (TASK_INTERRUPTIBLE); 89 set_current_state (TASK_INTERRUPTIBLE);
90 D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread sleeping...\n")); 90 D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread sleeping...\n"));
@@ -95,9 +95,6 @@ static int jffs2_garbage_collect_thread(void *_c)
95 schedule(); 95 schedule();
96 } 96 }
97 97
98 if (try_to_freeze())
99 continue;
100
101 /* This thread is purely an optimisation. But if it runs when 98 /* This thread is purely an optimisation. But if it runs when
102 other things could be running, it actually makes things a 99 other things could be running, it actually makes things a
103 lot worse. Use yield() and put it at the back of the runqueue 100 lot worse. Use yield() and put it at the back of the runqueue
@@ -112,6 +109,9 @@ static int jffs2_garbage_collect_thread(void *_c)
112 siginfo_t info; 109 siginfo_t info;
113 unsigned long signr; 110 unsigned long signr;
114 111
112 if (try_to_freeze())
113 goto again;
114
115 signr = dequeue_signal_lock(current, &current->blocked, &info); 115 signr = dequeue_signal_lock(current, &current->blocked, &info);
116 116
117 switch(signr) { 117 switch(signr) {
diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h
index 25126a062cae..bc5509fe577b 100644
--- a/fs/jffs2/nodelist.h
+++ b/fs/jffs2/nodelist.h
@@ -139,6 +139,11 @@ static inline struct jffs2_inode_cache *jffs2_raw_ref_to_ic(struct jffs2_raw_nod
139#define ref_obsolete(ref) (((ref)->flash_offset & 3) == REF_OBSOLETE) 139#define ref_obsolete(ref) (((ref)->flash_offset & 3) == REF_OBSOLETE)
140#define mark_ref_normal(ref) do { (ref)->flash_offset = ref_offset(ref) | REF_NORMAL; } while(0) 140#define mark_ref_normal(ref) do { (ref)->flash_offset = ref_offset(ref) | REF_NORMAL; } while(0)
141 141
142/* Dirent nodes should be REF_PRISTINE only if they are not a deletion
143 dirent. Deletion dirents should be REF_NORMAL so that GC gets to
144 throw them away when appropriate */
145#define dirent_node_state(rd) ( (je32_to_cpu((rd)->ino)?REF_PRISTINE:REF_NORMAL) )
146
142/* NB: REF_PRISTINE for an inode-less node (ref->next_in_ino == NULL) indicates 147/* NB: REF_PRISTINE for an inode-less node (ref->next_in_ino == NULL) indicates
143 it is an unknown node of type JFFS2_NODETYPE_RWCOMPAT_COPY, so it'll get 148 it is an unknown node of type JFFS2_NODETYPE_RWCOMPAT_COPY, so it'll get
144 copied. If you need to do anything different to GC inode-less nodes, then 149 copied. If you need to do anything different to GC inode-less nodes, then
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 7b363786c2d2..b5baa356fed2 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -104,7 +104,7 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info
104 104
105 if (crc != tn->data_crc) { 105 if (crc != tn->data_crc) {
106 JFFS2_NOTICE("wrong data CRC in data node at 0x%08x: read %#08x, calculated %#08x.\n", 106 JFFS2_NOTICE("wrong data CRC in data node at 0x%08x: read %#08x, calculated %#08x.\n",
107 ofs, tn->data_crc, crc); 107 ref_offset(ref), tn->data_crc, crc);
108 return 1; 108 return 1;
109 } 109 }
110 110
@@ -613,7 +613,7 @@ static inline int read_direntry(struct jffs2_sb_info *c, struct jffs2_raw_node_r
613 jeb->unchecked_size -= len; 613 jeb->unchecked_size -= len;
614 c->used_size += len; 614 c->used_size += len;
615 c->unchecked_size -= len; 615 c->unchecked_size -= len;
616 ref->flash_offset = ref_offset(ref) | REF_PRISTINE; 616 ref->flash_offset = ref_offset(ref) | dirent_node_state(rd);
617 spin_unlock(&c->erase_completion_lock); 617 spin_unlock(&c->erase_completion_lock);
618 } 618 }
619 619
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index 2a1c976c7924..6c75cd433342 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -1049,7 +1049,8 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
1049 return -ENOMEM; 1049 return -ENOMEM;
1050 } 1050 }
1051 1051
1052 fd->raw = jffs2_link_node_ref(c, jeb, ofs | REF_PRISTINE, PAD(je32_to_cpu(rd->totlen)), ic); 1052 fd->raw = jffs2_link_node_ref(c, jeb, ofs | dirent_node_state(rd),
1053 PAD(je32_to_cpu(rd->totlen)), ic);
1053 1054
1054 fd->next = NULL; 1055 fd->next = NULL;
1055 fd->version = je32_to_cpu(rd->version); 1056 fd->version = je32_to_cpu(rd->version);
diff --git a/fs/jffs2/write.c b/fs/jffs2/write.c
index c9fe0ab3a329..bc6185933664 100644
--- a/fs/jffs2/write.c
+++ b/fs/jffs2/write.c
@@ -173,6 +173,12 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
173 flash_ofs |= REF_NORMAL; 173 flash_ofs |= REF_NORMAL;
174 } 174 }
175 fn->raw = jffs2_add_physical_node_ref(c, flash_ofs, PAD(sizeof(*ri)+datalen), f->inocache); 175 fn->raw = jffs2_add_physical_node_ref(c, flash_ofs, PAD(sizeof(*ri)+datalen), f->inocache);
176 if (IS_ERR(fn->raw)) {
177 void *hold_err = fn->raw;
178 /* Release the full_dnode which is now useless, and return */
179 jffs2_free_full_dnode(fn);
180 return ERR_PTR(PTR_ERR(hold_err));
181 }
176 fn->ofs = je32_to_cpu(ri->offset); 182 fn->ofs = je32_to_cpu(ri->offset);
177 fn->size = je32_to_cpu(ri->dsize); 183 fn->size = je32_to_cpu(ri->dsize);
178 fn->frags = 0; 184 fn->frags = 0;
@@ -290,7 +296,14 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
290 return ERR_PTR(ret?ret:-EIO); 296 return ERR_PTR(ret?ret:-EIO);
291 } 297 }
292 /* Mark the space used */ 298 /* Mark the space used */
293 fd->raw = jffs2_add_physical_node_ref(c, flash_ofs | REF_PRISTINE, PAD(sizeof(*rd)+namelen), f->inocache); 299 fd->raw = jffs2_add_physical_node_ref(c, flash_ofs | dirent_node_state(rd),
300 PAD(sizeof(*rd)+namelen), f->inocache);
301 if (IS_ERR(fd->raw)) {
302 void *hold_err = fd->raw;
303 /* Release the full_dirent which is now useless, and return */
304 jffs2_free_full_dirent(fd);
305 return ERR_PTR(PTR_ERR(hold_err));
306 }
294 307
295 if (retried) { 308 if (retried) {
296 jffs2_dbg_acct_sanity_check(c,NULL); 309 jffs2_dbg_acct_sanity_check(c,NULL);