Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/623/?format=api
{ "id": 623, "url": "http://patchwork.ozlabs.org/api/patches/623/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-mtd/patch/30508484.52991221827822859.JavaMail.weblogic@epml16/", "project": { "id": 3, "url": "http://patchwork.ozlabs.org/api/projects/3/?format=api", "name": "Linux MTD development", "link_name": "linux-mtd", "list_id": "linux-mtd.lists.infradead.org", "list_email": "linux-mtd@lists.infradead.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<30508484.52991221827822859.JavaMail.weblogic@epml16>", "list_archive_url": null, "date": "2008-09-19T12:37:02", "name": "[1/2,MTD,JFFS2] MLC NAND support", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "eea5489fc6dceb5a6ab6bbd0869ac4992ea66652", "submitter": { "id": 305, "url": "http://patchwork.ozlabs.org/api/people/305/?format=api", "name": "AYYANARPONNUSAMY GANGHEYAMOORTHY", "email": "moorthy.apg@samsung.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-mtd/patch/30508484.52991221827822859.JavaMail.weblogic@epml16/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/623/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/623/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Received": [ "from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34])\n\t(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\n\t(Client did not present a certificate)\n\tby ozlabs.org (Postfix) with ESMTPS id B0CCDDE12B\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 20 Sep 2008 00:06:47 +1000 (EST)", "from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.68 #1 (Red Hat Linux))\n\tid 1KggbW-0007N0-9p; Fri, 19 Sep 2008 14:05:02 +0000", "from mailout1.samsung.com ([203.254.224.24])\n\tby bombadil.infradead.org with esmtp (Exim 4.68 #1 (Red Hat Linux))\n\tid 1KgfEO-00038O-Ur\n\tfor linux-mtd@lists.infradead.org; Fri, 19 Sep 2008 12:37:06 +0000", "from ep_ms13_bk (mailout1.samsung.com [203.254.224.24])\n\tby mailout1.samsung.com\n\t(iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004))\n\twith ESMTP id <0K7G0099S0DR00@mailout1.samsung.com> for\n\tlinux-mtd@lists.infradead.org; Fri, 19 Sep 2008 21:37:03 +0900 (KST)", "from ep_spt03 (ms13.samsung.com [203.254.225.109])\n\tby ms13.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul\n\t14 2004)) with ESMTP id <0K7G008U80DQVH@ms13.samsung.com> for\n\tlinux-mtd@lists.infradead.org; Fri, 19 Sep 2008 21:37:03 +0900 (KST)" ], "Content-return": "prohibited", "Date": "Fri, 19 Sep 2008 12:37:02 +0000 (GMT)", "From": "AYYANARPONNUSAMY GANGHEYAMOORTHY <moorthy.apg@samsung.com>", "Subject": "[PATCH 1/2] [MTD] [JFFS2] MLC NAND support", "To": "linux-mtd@lists.infradead.org", "Message-id": "<30508484.52991221827822859.JavaMail.weblogic@epml16>", "MIME-version": [ "1.0", "1.0" ], "X-Priority": "3", "Msgkey": "20080919123222645@moorthy.apg", "X-MTR": "20080919123222645@moorthy.apg", "X-EPLocale": "en_US.windows-1252", "X-EPWebmail-Msg-Type": "personal", "X-EPWebmail-Reply-Demand": "0", "X-EPApproval-Locale": "", "X-EPHeader": "ML", "X-EPTrCode": "", "X-EPTrName": "", "X-Spam-Score": "-1.2 (-)", "X-Spam-Report": "SpamAssassin version 3.2.5 on bombadil.infradead.org summary:\n\tContent analysis details: (-1.2 points)\n\tpts rule name description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-4.0 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\n\tmedium trust [203.254.224.24 listed in list.dnswl.org]\n\t0.0 MIME_BASE64_BLANKS RAW: Extra blank lines in base64 encoding\n\t2.8 MIME_BASE64_TEXT RAW: Message text disguised using base64\n\tencoding", "Cc": "David.Woodhouse@intel.com", "X-BeenThere": "linux-mtd@lists.infradead.org", "X-Mailman-Version": "2.1.9", "Precedence": "list", "Reply-To": "moorthy.apg@samsung.com", "List-Id": "Linux MTD discussion mailing list <linux-mtd.lists.infradead.org>", "List-Unsubscribe": "<http://lists.infradead.org/mailman/listinfo/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe>", "List-Archive": "<http://lists.infradead.org/pipermail/linux-mtd>", "List-Post": "<mailto:linux-mtd@lists.infradead.org>", "List-Help": "<mailto:linux-mtd-request@lists.infradead.org?subject=help>", "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Sender": "linux-mtd-bounces@lists.infradead.org", "Errors-To": "linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org" }, "content": "Currently JFFS2 writes twice to the first page of the block,\ncleanmarker in OOB area and data in main area, which prevents\nJFFS2 from being used on MLC devices which have NOP count 1.\nThis patch reserves the first page only for the cleanmarker.\n\nNote : With robustness testing, one test board out six has\ngiven a BUG. We are looking into it.\n\nSigned-off-by: Rajshekar H Payagond <rajshekar.hp@samsung.com>", "diff": "--- a/fs/jffs2/build.c\t2008-08-24 04:48:32.000000000 +0530\n+++ b/fs/jffs2/build.c\t2008-09-01 13:39:56.000000000 +0530\n@@ -330,7 +330,11 @@ int jffs2_do_mount_fs(struct jffs2_sb_in\n \tint i;\n \tint size;\n \n-\tc->free_size = c->flash_size;\n+\tif (c->mtd->flags == MTD_CAP_MLCNANDFLASH)\n+\t\tc->free_size = 0;\n+\telse\n+\t\tc->free_size = c->flash_size;\n+\n \tc->nr_blocks = c->flash_size / c->sector_size;\n \tsize = sizeof(struct jffs2_eraseblock) * c->nr_blocks;\n #ifndef __ECOS\n@@ -346,7 +350,14 @@ int jffs2_do_mount_fs(struct jffs2_sb_in\n \tfor (i=0; i<c->nr_blocks; i++) {\n \t\tINIT_LIST_HEAD(&c->blocks[i].list);\n \t\tc->blocks[i].offset = i * c->sector_size;\n-\t\tc->blocks[i].free_size = c->sector_size;\n+\t\tif (c->mtd->flags == MTD_CAP_MLCNANDFLASH) {\n+\t\t\tc->blocks[i].free_size =\n+\t\t\t\t\tc->sector_size - c->wbuf_pagesize;\n+\t\t\tc->blocks[i].used_size = c->wbuf_pagesize;\n+\t\t\tc->free_size += c->blocks[i].free_size;\n+\t\t\tc->used_size += c->blocks[i].used_size;\n+\t\t} else\n+\t\t\tc->blocks[i].free_size = c->sector_size;\n \t}\n \n \tINIT_LIST_HEAD(&c->clean_list);\n--- a/fs/jffs2/debug.c\t2008-08-24 04:48:32.000000000 +0530\n+++ b/fs/jffs2/debug.c\t2008-09-01 13:39:56.000000000 +0530\n@@ -307,6 +307,9 @@ __jffs2_dbg_acct_paranoia_check_nolock(s\n \tuint32_t my_dirty_size = 0;\n \tstruct jffs2_raw_node_ref *ref2 = jeb->first_node;\n \n+\tif (c->mtd->flags == MTD_CAP_MLCNANDFLASH)\n+\t\tmy_used_size = c->wbuf_pagesize;\n+\n \twhile (ref2) {\n \t\tuint32_t totlen = ref_totlen(c, jeb, ref2);\n \n--- a/fs/jffs2/erase.c\t2008-08-24 04:48:32.000000000 +0530\n+++ b/fs/jffs2/erase.c\t2008-09-01 13:39:56.000000000 +0530\n@@ -454,13 +454,21 @@ static void jffs2_mark_erased_block(stru\n \t\t}\n \t}\n \t/* Everything else got zeroed before the erase */\n-\tjeb->free_size = c->sector_size;\n+\tif (c->mtd->flags == MTD_CAP_MLCNANDFLASH) {\n+\t\tjeb->free_size = c->sector_size - c->wbuf_pagesize;\n+\t\tjeb->used_size = c->wbuf_pagesize;\n+\t} else\n+\t\tjeb->free_size = c->sector_size;\n \n \tmutex_lock(&c->erase_free_sem);\n \tspin_lock(&c->erase_completion_lock);\n \n \tc->erasing_size -= c->sector_size;\n-\tc->free_size += c->sector_size;\n+\tif (c->mtd->flags == MTD_CAP_MLCNANDFLASH) {\n+\t\tc->free_size += c->sector_size - c->wbuf_pagesize;\n+\t\tc->used_size += c->wbuf_pagesize;\n+\t} else\n+\t\tc->free_size += c->sector_size;\n \n \t/* Account for cleanmarker now, if it's in-band */\n \tif (c->cleanmarker_size && !jffs2_cleanmarker_oob(c))\n--- a/fs/jffs2/gc.c\t2008-08-24 04:48:32.000000000 +0530\n+++ b/fs/jffs2/gc.c\t2008-09-01 13:39:56.000000000 +0530\n@@ -237,9 +237,19 @@ int jffs2_garbage_collect_pass(struct jf\n \tD1(if (c->nextblock)\n \t printk(KERN_DEBUG \"Nextblock at %08x, used_size %08x, dirty_size %08x, wasted_size %08x, free_size %08x\\n\", c->nextblock->offset, c->nextblock->used_size, c->nextblock->dirty_size, c->nextblock->wasted_size, c->nextblock->free_size));\n \n-\tif (!jeb->used_size) {\n-\t\tmutex_unlock(&c->alloc_sem);\n-\t\tgoto eraseit;\n+\tif (c->mtd->flags == MTD_CAP_MLCNANDFLASH) {\n+\t\tif (jeb->used_size <= c->wbuf_pagesize) {\n+\t\t\tmutex_unlock(&c->alloc_sem);\n+\t\t\tgoto eraseit;\n+\t\t}\n+\n+\t}\n+\n+\telse{\n+\t\tif (!jeb->used_size) {\n+\t\t\tmutex_unlock(&c->alloc_sem);\n+\t\t\tgoto eraseit;\n+\t\t}\n \t}\n \n \traw = jeb->gc_node;\n@@ -429,13 +439,32 @@ int jffs2_garbage_collect_pass(struct jf\n \tspin_lock(&c->erase_completion_lock);\n \n eraseit:\n-\tif (c->gcblock && !c->gcblock->used_size) {\n-\t\tD1(printk(KERN_DEBUG \"Block at 0x%08x completely obsoleted by GC. Moving to erase_pending_list\\n\", c->gcblock->offset));\n-\t\t/* We're GC'ing an empty block? */\n-\t\tlist_add_tail(&c->gcblock->list, &c->erase_pending_list);\n-\t\tc->gcblock = NULL;\n-\t\tc->nr_erasing_blocks++;\n-\t\tjffs2_erase_pending_trigger(c);\n+\tif (c->mtd->flags == MTD_CAP_MLCNANDFLASH) {\n+\t\tif (c->gcblock && (c->gcblock->used_size <= c->wbuf_pagesize)) {\n+\t\t\tD1(printk(KERN_DEBUG \"Block at 0x%08x completely\"\n+\t\t\t\t\" obsoleted by GC. Moving to erase_pending_list\\n\"\n+\t\t\t\t, c->gcblock->offset));\n+\t\t\t/* We're GC'ing an empty block? */\n+\t\t\tlist_add_tail(&c->gcblock->list,\n+\t\t\t\t\t&c->erase_pending_list);\n+\t\t\tc->gcblock = NULL;\n+\t\t\tc->nr_erasing_blocks++;\n+\t\t\tjffs2_erase_pending_trigger(c);\n+\t\t}\n+\t}\n+\n+\telse{\n+\t\tif (c->gcblock && !c->gcblock->used_size) {\n+\t\t\tD1(printk(KERN_DEBUG \"Block at 0x%08x completely\"\n+\t\t\t\t\" obsoleted by GC. Moving to erase_pending_list\\n\"\n+\t\t\t\t, c->gcblock->offset));\n+\t\t\t/* We're GC'ing an empty block? */\n+\t\t\tlist_add_tail(&c->gcblock->list,\n+\t\t\t\t\t&c->erase_pending_list);\n+\t\t\tc->gcblock = NULL;\n+\t\t\tc->nr_erasing_blocks++;\n+\t\t\tjffs2_erase_pending_trigger(c);\n+\t\t}\n \t}\n \tspin_unlock(&c->erase_completion_lock);\n \n--- a/fs/jffs2/nodelist.c\t2008-08-24 04:48:32.000000000 +0530\n+++ b/fs/jffs2/nodelist.c\t2008-09-01 13:39:56.000000000 +0530\n@@ -634,7 +634,11 @@ struct jffs2_raw_node_ref *jffs2_link_no\n \n \tif (!jeb->first_node) {\n \t\tjeb->first_node = ref;\n-\t\tBUG_ON(ref_offset(ref) != jeb->offset);\n+\t\tif (c->mtd->flags == MTD_CAP_MLCNANDFLASH)\n+\t\t\tBUG_ON(ref_offset(ref) !=\n+\t\t\t\t\t\tjeb->offset + c->wbuf_pagesize);\n+\t\telse\n+\t\t\tBUG_ON(ref_offset(ref) != jeb->offset);\n \t} else if (unlikely(ref_offset(ref) != jeb->offset + c->sector_size - jeb->free_size)) {\n \t\tuint32_t last_len = ref_totlen(c, jeb, jeb->last_node);\n \n--- a/fs/jffs2/nodemgmt.c\t2008-08-24 04:48:32.000000000 +0530\n+++ b/fs/jffs2/nodemgmt.c\t2008-09-01 16:15:47.000000000 +0530\n@@ -362,16 +362,25 @@ static int jffs2_do_reserve_space(struct\n \t}\n \n \tif (!jeb) {\n-\n \t\tret = jffs2_find_nextblock(c);\n \t\tif (ret)\n \t\t\treturn ret;\n \n \t\tjeb = c->nextblock;\n+\t\tif (c->mtd->flags == MTD_CAP_MLCNANDFLASH) {\n+\t\t\tif (jeb->free_size != c->sector_size -\n+\t\t\t\tc->cleanmarker_size - c->wbuf_pagesize) {\n+\t\t\t\tprintk(KERN_WARNING \"Eep. Block 0x%08x taken from free_list had free_size of 0x%08x!!\\n\", jeb->offset, jeb->free_size);\n+\t\t\t\tgoto restart;\n+\t\t\t}\n+\t\t}\n \n-\t\tif (jeb->free_size != c->sector_size - c->cleanmarker_size) {\n-\t\t\tprintk(KERN_WARNING \"Eep. Block 0x%08x taken from free_list had free_size of 0x%08x!!\\n\", jeb->offset, jeb->free_size);\n-\t\t\tgoto restart;\n+\t\telse{\n+\t\t\tif (jeb->free_size != c->sector_size -\n+\t\t\t\t\tc->cleanmarker_size) {\n+\t\t\t\tprintk(KERN_WARNING \"Eep. Block 0x%08x taken from free_list had free_size of 0x%08x!!\\n\", jeb->offset, jeb->free_size);\n+\t\t\t\tgoto restart;\n+\t\t\t}\n \t\t}\n \t}\n \t/* OK, jeb (==c->nextblock) is now pointing at a block which definitely has\n--- a/fs/jffs2/scan.c\t2008-08-24 04:48:32.000000000 +0530\n+++ b/fs/jffs2/scan.c\t2008-09-01 13:39:56.000000000 +0530\n@@ -534,7 +534,10 @@ static int jffs2_scan_eraseblock (struct\n \t\t}\n \t}\n \n-\tbuf_ofs = jeb->offset;\n+\tif (c->mtd->flags == MTD_CAP_MLCNANDFLASH)\n+\t\tbuf_ofs = jeb->offset + c->wbuf_pagesize;\n+\telse\n+\t\tbuf_ofs = jeb->offset;\n \n \tif (!buf_size) {\n \t\t/* This is the XIP case -- we're reading _directly_ from the flash chip */\n@@ -582,7 +585,10 @@ static int jffs2_scan_eraseblock (struct\n \t}\n \n \t/* Now ofs is a complete physical flash offset as it always was... */\n-\tofs += jeb->offset;\n+\tif (c->mtd->flags == MTD_CAP_MLCNANDFLASH)\n+\t\tofs += jeb->offset + c->wbuf_pagesize;\n+\telse\n+\t\tofs += jeb->offset;\n \n \tnoise = 10;\n \n--- a/fs/jffs2/wbuf.c\t2008-08-24 04:48:32.000000000 +0530\n+++ b/fs/jffs2/wbuf.c\t2008-09-01 13:39:56.000000000 +0530\n@@ -873,6 +873,13 @@ int jffs2_flash_writev(struct jffs2_sb_i\n \t\t\tvlen -= wbuf_retlen;\n \t\t\toutvec_to += wbuf_retlen;\n \t\t\tc->wbuf_ofs = outvec_to;\n+\t\t\tif (c->mtd->flags == MTD_CAP_MLCNANDFLASH) {\n+\t\t\t\t/* adjust write buffer offset,\n+\t\t\t\t * else we get a non contiguous write bug\n+\t\t\t\t */\n+\t\t\t\tif (!(c->wbuf_ofs % c->sector_size))\n+\t\t\t\t\tc->wbuf_ofs = 0xffffffff;\n+\t\t\t}\n \t\t\tdonelen += wbuf_retlen;\n \t\t\tv += wbuf_retlen;\n \t\t}\n--- a/include/mtd/mtd-abi.h\t2008-09-02 13:51:09.000000000 +0530\n+++ b/include/mtd/mtd-abi.h\t2008-09-02 13:51:42.000000000 +0530\n@@ -28,12 +28,14 @@ struct mtd_oob_buf {\n #define MTD_BIT_WRITEABLE\t0x800\t/* Single bits can be flipped */\n #define MTD_NO_ERASE\t\t0x1000\t/* No erase necessary */\n #define MTD_POWERUP_LOCK\t0x2000\t/* Always locked after reset */\n+#define MTD_WRITABLE_ONCE\t0x4000\n \n // Some common devices / combinations of capabilities\n #define MTD_CAP_ROM\t\t0\n #define MTD_CAP_RAM\t\t(MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE)\n #define MTD_CAP_NORFLASH\t(MTD_WRITEABLE | MTD_BIT_WRITEABLE)\n #define MTD_CAP_NANDFLASH\t(MTD_WRITEABLE)\n+#define MTD_CAP_MLCNANDFLASH\t(MTD_WRITEABLE | MTD_WRITABLE_ONCE)\n \n /* ECC byte placement */\n #define MTD_NANDECC_OFF\t\t0\t// Switch off ECC (Not recommended)\n", "prefixes": [ "1/2", "MTD", "JFFS2" ] }