Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fab2c399129273713b7dcc6a54cef17ca124a47f
Commit:     fab2c399129273713b7dcc6a54cef17ca124a47f
Parent:     7eafaed55f4b8599cfe55449a6ed88d3693954de
Author:     Joakim Tjernlund <[EMAIL PROTECTED]>
AuthorDate: Fri Jun 1 15:14:09 2007 +0200
Committer:  David Woodhouse <[EMAIL PROTECTED]>
CommitDate: Thu Jun 28 18:41:22 2007 +0100

    [JFFS2] Use point(), if available, to check newly erased blocks.
    
    Faster and won't trash the D-cache.
    
    Signed-off-by: Joakim Tjernlund <[EMAIL PROTECTED]>
    Signed-off-by: David Woodhouse <[EMAIL PROTECTED]>
---
 fs/jffs2/erase.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
index bdab9bc..e9e3c2c 100644
--- a/fs/jffs2/erase.c
+++ b/fs/jffs2/erase.c
@@ -317,6 +317,33 @@ static int jffs2_block_check_erase(struct jffs2_sb_info 
*c, struct jffs2_erasebl
        size_t retlen;
        int ret = -EIO;
 
+       if (c->mtd->point) {
+               unsigned long *wordebuf;
+
+               ret = c->mtd->point(c->mtd, jeb->offset, c->sector_size, 
&retlen, (unsigned char **)&ebuf);
+               if (ret) {
+                       D1(printk(KERN_DEBUG "MTD point failed %d\n", ret));
+                       goto do_flash_read;
+               }
+               if (retlen < c->sector_size) {
+                       /* Don't muck about if it won't let us point to the 
whole erase sector */
+                       D1(printk(KERN_DEBUG "MTD point returned len too short: 
0x%zx\n", retlen));
+                       c->mtd->unpoint(c->mtd, ebuf, jeb->offset, 
c->sector_size);
+                       goto do_flash_read;
+               }
+               wordebuf = ebuf-sizeof(*wordebuf);
+               retlen /= sizeof(*wordebuf);
+               do {
+                  if (*++wordebuf != ~0)
+                          break;
+               } while(--retlen);
+               c->mtd->unpoint(c->mtd, ebuf, jeb->offset, c->sector_size);
+               if (retlen)
+                       printk(KERN_WARNING "Newly-erased block contained word 
0x%lx at offset 0x%08x\n",
+                              *wordebuf, jeb->offset + 
c->sector_size-retlen*sizeof(*wordebuf));
+               return 0;
+       }
+ do_flash_read:
        ebuf = kmalloc(PAGE_SIZE, GFP_KERNEL);
        if (!ebuf) {
                printk(KERN_WARNING "Failed to allocate page buffer for 
verifying erase at 0x%08x. Refiling\n", jeb->offset);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to