mtd/fs/jffs2 erase.c, 1.89, 1.90 nodelist.h, 1.144, 1.145 scan.c,
1.131, 1.132 summary.c, 1.8, 1.9 wbuf.c, 1.106, 1.107
Forrest Zhao
forrest.zhao at intel.com
Fri Nov 18 02:25:31 EST 2005
Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv20906/fs/jffs2
Modified Files:
erase.c nodelist.h scan.c summary.c wbuf.c
Log Message:
This patch provides the capability to tracking the erase count of each erase block. User can read the erase count by jffs2dump utility.
Index: erase.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/erase.c,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -r1.89 -r1.90
--- erase.c 13 Nov 2005 18:22:06 -0000 1.89
+++ erase.c 18 Nov 2005 07:25:27 -0000 1.90
@@ -165,7 +165,21 @@
list_del(&jeb->list);
list_add_tail(&jeb->list, &c->erase_complete_list);
spin_unlock(&c->erase_completion_lock);
- EBFLAGS_SET_EBH(jeb);
+ if (!EBFLAGS_HAS_EBH(jeb)) {
+ if (c->nr_blocks_with_ebh != 0) {
+ jeb->erase_count = c->total_erase_count/c->nr_blocks_with_ebh;
+ } else {
+ jeb->erase_count = 0;
+ }
+ EBFLAGS_SET_EBH(jeb);
+ c->nr_blocks_with_ebh++;
+ c->total_erase_count += jeb->erase_count;
+ }
+ jeb->erase_count++;
+ if (jeb->erase_count > c->max_erase_count) {
+ c->max_erase_count = jeb->erase_count;
+ }
+ c->total_erase_count++;
/* Ensure that kupdated calls us again to mark them clean */
jffs2_erase_pending_trigger(c);
}
Index: nodelist.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/nodelist.h,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -r1.144 -r1.145
--- nodelist.h 13 Nov 2005 18:22:07 -0000 1.144
+++ nodelist.h 18 Nov 2005 07:25:27 -0000 1.145
@@ -301,6 +301,15 @@
return rb_entry(node, struct jffs2_node_frag, rb);
}
+static inline void record_erase_count(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb)
+{
+ c->total_erase_count += jeb->erase_count;
+ c->nr_blocks_with_ebh++;
+ if (jeb->erase_count > c->max_erase_count) {
+ c->max_erase_count = jeb->erase_count;
+ }
+}
+
#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)
Index: scan.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/scan.c,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -r1.131 -r1.132
--- scan.c 13 Nov 2005 18:22:07 -0000 1.131
+++ scan.c 18 Nov 2005 07:25:27 -0000 1.132
@@ -938,6 +938,7 @@
EBFLAGS_SET_EBH(jeb);
jeb->erase_count = je32_to_cpu(eh->erase_count);
+ record_erase_count(c, jeb);
raw->next_in_ino = NULL;
raw->next_phys = NULL;
Index: summary.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/summary.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- summary.c 13 Nov 2005 18:22:07 -0000 1.8
+++ summary.c 18 Nov 2005 07:25:27 -0000 1.9
@@ -504,6 +504,8 @@
}
EBFLAGS_SET_EBH(jeb);
jeb->erase_count = je32_to_cpu(speh->erase_count);
+ record_erase_count(c, jeb);
+
raw->next_in_ino = NULL;
raw->next_phys = NULL;
raw->flash_offset = (jeb->offset + je32_to_cpu(speh->offset)) | REF_NORMAL;
Index: wbuf.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/wbuf.c,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -r1.106 -r1.107
--- wbuf.c 13 Nov 2005 18:22:07 -0000 1.106
+++ wbuf.c 18 Nov 2005 07:25:27 -0000 1.107
@@ -1072,6 +1072,7 @@
EBFLAGS_SET_EBH(jeb);
jeb->erase_count = je32_to_cpu(eh.erase_count);
+ record_erase_count(c, jeb);
*data_len = je32_to_cpu(eh.totlen);
ret = 0;
}else {
More information about the linux-mtd-cvs
mailing list