From: LiuShuo <b35362@freescale.com>
To: <dedekind1@gmail.com>
Cc: linuxppc-dev@linux.freescale.net, Li Yang <leoli@freescale.com>,
dwmw2@infradead.org, linux-mtd@lists.infradead.org,
linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] mtd-utils: fix corrupt cleanmarker with flash_erase -j command
Date: Wed, 17 Aug 2011 15:35:34 +0800 [thread overview]
Message-ID: <4E4B6F46.2050209@freescale.com> (raw)
In-Reply-To: <1313507201.2679.2.camel@sauron>
于 2011年08月16日 23:06, Artem Bityutskiy 写道:
> On Wed, 2011-08-03 at 13:50 +0800, b35362@freescale.com wrote:
>> From: Liu Shuo<b35362@freescale.com>
>>
>> Flash_erase -j should fill discrete freeoob areas with required bytes
>> of JFFS2 cleanmarker in jffs2_check_nand_cleanmarker(). Not just fill
>> the first freeoob area.
>>
>> Signed-off-by: Liu Shuo<b35362@freescale.com>
>> Signed-off-by: Li Yang<leoli@freescale.com>
> ...
>
>> /*
>> * Process user arguments
>> @@ -197,15 +198,40 @@ int main(int argc, char *argv[])
>> if (ioctl(fd, MEMGETOOBSEL,&oobinfo) != 0)
>> return sys_errmsg("%s: unable to get NAND oobinfo", mtd_device);
>>
>> + cleanmarker.totlen = cpu_to_je32(8);
>> /* Check for autoplacement */
>> if (oobinfo.useecc == MTD_NANDECC_AUTOPLACE) {
>> + struct nand_ecclayout_user ecclayout;
>> /* Get the position of the free bytes */
>> - if (!oobinfo.oobfree[0][1])
>> + if (ioctl(fd, ECCGETLAYOUT,&ecclayout) != 0)
>> + return sys_errmsg("%s: unable to get NAND ecclayout", mtd_device);
>> +
> Hmm, shouldn't we instead make MTD_OOB_AUTO be available for userspace
> via an ioctl instead and make flash_eraseall use it instead?
>
I think We can add a new ioctl MEMSETOOBMODE for selecting a mode to
access the OOB area.
Add new member into struct mtd_info:
struct mtd_info {
......
enum {
MTD_OOB_PLACE,
MTD_OOB_AUTO,
MTD_OOB_RAW,
} oob_mode;
}
In function mtd_do_writeoob() (in drivers/mtd/mtdchar.c) :
- ops.mode = MTD_OOB_PLACE;
+ ops.mode = mtd->oob_mode;
Could we do it like this ?
Thanks
-LiuShuo
WARNING: multiple messages have this Message-ID (diff)
From: LiuShuo <b35362@freescale.com>
To: <dedekind1@gmail.com>
Cc: linuxppc-dev@linux.freescale.net, dwmw2@infradead.org,
linux-mtd@lists.infradead.org, linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] mtd-utils: fix corrupt cleanmarker with flash_erase -j command
Date: Wed, 17 Aug 2011 15:35:34 +0800 [thread overview]
Message-ID: <4E4B6F46.2050209@freescale.com> (raw)
In-Reply-To: <1313507201.2679.2.camel@sauron>
=E4=BA=8E 2011=E5=B9=B408=E6=9C=8816=E6=97=A5 23:06, Artem Bityutskiy =E5=
=86=99=E9=81=93:
> On Wed, 2011-08-03 at 13:50 +0800, b35362@freescale.com wrote:
>> From: Liu Shuo<b35362@freescale.com>
>>
>> Flash_erase -j should fill discrete freeoob areas with required bytes
>> of JFFS2 cleanmarker in jffs2_check_nand_cleanmarker(). Not just fill
>> the first freeoob area.
>>
>> Signed-off-by: Liu Shuo<b35362@freescale.com>
>> Signed-off-by: Li Yang<leoli@freescale.com>
> ...
>
>> /*
>> * Process user arguments
>> @@ -197,15 +198,40 @@ int main(int argc, char *argv[])
>> if (ioctl(fd, MEMGETOOBSEL,&oobinfo) !=3D 0)
>> return sys_errmsg("%s: unable to get NAND oobinfo", mtd_device);
>>
>> + cleanmarker.totlen =3D cpu_to_je32(8);
>> /* Check for autoplacement */
>> if (oobinfo.useecc =3D=3D MTD_NANDECC_AUTOPLACE) {
>> + struct nand_ecclayout_user ecclayout;
>> /* Get the position of the free bytes */
>> - if (!oobinfo.oobfree[0][1])
>> + if (ioctl(fd, ECCGETLAYOUT,&ecclayout) !=3D 0)
>> + return sys_errmsg("%s: unable to get NAND ecclayout", mtd_device=
);
>> +
> Hmm, shouldn't we instead make MTD_OOB_AUTO be available for userspace
> via an ioctl instead and make flash_eraseall use it instead?
>
I think We can add a new ioctl MEMSETOOBMODE for selecting a mode to=20
access the OOB area.
Add new member into struct mtd_info:
struct mtd_info {
......
enum {
MTD_OOB_PLACE,
MTD_OOB_AUTO,
MTD_OOB_RAW,
} oob_mode;
}
In function mtd_do_writeoob() (in drivers/mtd/mtdchar.c) :
- ops.mode =3D MTD_OOB_PLACE;
+ ops.mode =3D mtd->oob_mode;
Could we do it like this ?
Thanks
-LiuShuo
next prev parent reply other threads:[~2011-08-17 7:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-03 5:50 [PATCH] mtd-utils: fix corrupt cleanmarker with flash_erase -j command b35362
2011-08-03 5:50 ` b35362
2011-08-16 15:06 ` Artem Bityutskiy
2011-08-16 15:06 ` Artem Bityutskiy
2011-08-16 19:42 ` Brian Norris
2011-08-16 19:42 ` Brian Norris
2011-08-17 7:35 ` LiuShuo [this message]
2011-08-17 7:35 ` LiuShuo
2011-08-17 7:39 ` Artem Bityutskiy
2011-08-17 7:39 ` Artem Bityutskiy
2011-08-18 1:20 ` Brian Norris
2011-08-18 1:20 ` Brian Norris
-- strict thread matches above, loose matches on Subject: below --
2011-08-08 8:16 b35362
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E4B6F46.2050209@freescale.com \
--to=b35362@freescale.com \
--cc=dedekind1@gmail.com \
--cc=dwmw2@infradead.org \
--cc=leoli@freescale.com \
--cc=linux-mtd@lists.infradead.org \
--cc=linuxppc-dev@linux.freescale.net \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.