get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/1132/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1132,
    "url": "http://patchwork.ozlabs.org/api/patches/1132/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-mtd/patch/000001c91d9c$827a3300$3dd66c6b@sisodomain.com/",
    "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": "<000001c91d9c$827a3300$3dd66c6b@sisodomain.com>",
    "list_archive_url": null,
    "date": "2008-09-23T16:50:38",
    "name": "[1/2,MTD,JFFS2] MLC NAND support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "63dc7a47633456b26ec5f6a6c50cb5e0f7b3c065",
    "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/000001c91d9c$827a3300$3dd66c6b@sisodomain.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/1132/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1132/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 DE95FDE10D\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 24 Sep 2008 02:49:23 +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 1KiB3h-0000xy-UO; Tue, 23 Sep 2008 16:48:17 +0000",
            "from mailout2.samsung.com ([203.254.224.25])\n\tby bombadil.infradead.org with esmtp (Exim 4.68 #1 (Red Hat Linux))\n\tid 1KiB3g-0000xi-72\n\tfor linux-mtd@lists.infradead.org; Tue, 23 Sep 2008 16:48:16 +0000",
            "from epmmp2 (mailout2.samsung.com [203.254.224.25])\n\tby mailout2.samsung.com\n\t(iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004))\n\twith ESMTP id <0K7N000U0QOCB1@mailout2.samsung.com> for\n\tlinux-mtd@lists.infradead.org; Wed, 24 Sep 2008 01:48:12 +0900 (KST)",
            "from apgmoorthy ([107.108.214.61])\n\tby mmp2.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul\n\t14 2004)) with ESMTPA id <0K7N00E9RQOA56@mmp2.samsung.com> for\n\tlinux-mtd@lists.infradead.org; Wed, 24 Sep 2008 01:48:12 +0900 (KST)"
        ],
        "Date": "Tue, 23 Sep 2008 22:20:38 +0530",
        "From": "apgmoorthy <moorthy.apg@samsung.com>",
        "Subject": "RE: [PATCH 1/2] [MTD] [JFFS2] MLC NAND support",
        "In-reply-to": "<9c9fda240809212333n76fa6cc6jbf1025f4f272d3f4@mail.gmail.com>",
        "To": "'Kyungmin Park' <kmpark@infradead.org>",
        "Message-id": "<000001c91d9c$827a3300$3dd66c6b@sisodomain.com>",
        "MIME-version": "1.0",
        "X-MIMEOLE": "Produced By Microsoft MimeOLE V6.00.2900.3198",
        "X-Mailer": "Microsoft Office Outlook 11",
        "Thread-index": "AckcfRvRpHjbJTYxSBOldgVA0Q46NgBHtJlg",
        "References": "<30508484.52991221827822859.JavaMail.weblogic@epml16>\n\t<9c9fda240809212333n76fa6cc6jbf1025f4f272d3f4@mail.gmail.com>",
        "X-Spam-Score": "-4.0 (----)",
        "X-Spam-Report": "SpamAssassin version 3.2.5 on bombadil.infradead.org summary:\n\tContent analysis details:   (-4.0 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.25 listed in list.dnswl.org]",
        "Cc": "linux-mtd@lists.infradead.org, David.Woodhouse@intel.com",
        "X-BeenThere": "linux-mtd@lists.infradead.org",
        "X-Mailman-Version": "2.1.9",
        "Precedence": "list",
        "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": "Hi,\n\nKyungmin Park wrote:\n\n>> Currently JFFS2 writes twice to the first page of the block,\n>> cleanmarker in OOB area and data in main area, which prevents\n>> JFFS2 from being used on MLC devices which have NOP count 1.\n>> This patch reserves the first page only for the cleanmarker.\n\n>Is it reasonable to waste the first page at each blocks?\n>It wastes 1/128 storages e.g., 512MiB/128 = 4MiB.\n>How about to unuse the oob cleanmarker at previous email sent by me?\n\n        - I will look into this.\n     \n>And small coding synmatic problem at patche. See below.\n\n         - corrected those in the new patch \n\n \nSigned-off-by: Rajshekar H Payagond <rajshekar.hp@samsung.com>\n---\n #define MTD_NANDECC_OFF\t\t0\t// Switch off ECC (Not\nrecommended)",
    "diff": "--- a/fs/jffs2/build.c\t2008-09-16 20:48:12.000000000 +0530\n+++ b/fs/jffs2/build.c\t2008-09-19 17:07:48.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-09-16 20:48:12.000000000 +0530\n+++ b/fs/jffs2/debug.c\t2008-09-19 17:07:48.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-09-16 20:48:12.000000000 +0530\n+++ b/fs/jffs2/erase.c\t2008-09-19 17:07:48.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-09-16 20:48:12.000000000 +0530\n+++ b/fs/jffs2/gc.c\t2008-09-23 21:36:56.000000000 +0530\n@@ -237,9 +237,17 @@ 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\n%08x, wasted_size %08x, free_size %08x\\n\", c->nextblock->offset,\nc->nextblock->used_size, c->nextblock->dirty_size,\nc->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} else{\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 +437,30 @@ 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\nby 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 <=\nc->wbuf_pagesize)) {\n+\t\t\tD1(printk(KERN_DEBUG \"Block at 0x%08x completely\"\n+\t\t\t\t\" obsoleted by GC. Moving to\nerase_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} else{\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\nerase_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-09-16 20:48:12.000000000 +0530\n+++ b/fs/jffs2/nodelist.c\t2008-09-19 17:07:48.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 +\nc->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\n- jeb->free_size)) {\n \t\tuint32_t last_len = ref_totlen(c, jeb, jeb->last_node);\n \n--- a/fs/jffs2/nodemgmt.c\t2008-09-16 20:48:12.000000000 +0530\n+++ b/fs/jffs2/nodemgmt.c\t2008-09-19 17:07:48.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\nfrom 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{\n-\t\t\tprintk(KERN_WARNING \"Eep. Block 0x%08x taken from\nfree_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\nfrom 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\ndefinitely has\n--- a/fs/jffs2/scan.c\t2008-09-16 20:48:12.000000000 +0530\n+++ b/fs/jffs2/scan.c\t2008-09-19 17:07:48.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\nflash 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*/\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-09-16 20:48:12.000000000 +0530\n+++ b/fs/jffs2/wbuf.c\t2008-09-19 17:07:48.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-16 20:48:12.000000000 +0530\n+++ b/include/mtd/mtd-abi.h\t2008-09-23 22:09:18.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_OOB_WRITEABLE\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 |\nMTD_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_OOB_WRITEABLE)\n \n /* ECC byte placement */\n",
    "prefixes": [
        "1/2",
        "MTD",
        "JFFS2"
    ]
}