Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
* read error with 64 byte erase counter header & 2048 Byte mtd->writesize
@ 2010-02-23  0:00 Shivdas Gujare
  2010-03-14  9:50 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Shivdas Gujare @ 2010-02-23  0:00 UTC (permalink / raw)
  To: linux-mtd

Hi all,
I am trying to use ubifs, but currently I am facing an issue as follows,

1) I tries to format a mtd device as, "ubiformat /dev/mtd0 -s 2048 -f
./ubi.img" while it return with an error of

ubiformat: mtd0 (nand), size 164757504 bytes (157.1 MiB), 1257
eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 0 --  0 % complete  libmtd: error!:
cannot read 64 bytes from mtd0 (eraseblock 0, offset 0)
        error 22 (Invalid argument)
ubiformat: error!: failed to scan mtd0 (/dev/mtd0)

I tried to understand what it is and came to know that, "ret =
mtd_read(mtd, fd, eb, 0, &hdr, sizeof(struct ubi_ec_hdr));" from
"ubi-utils/src/libscan.c"
tried to read 64 byte "struct ubi_ec_hdr - UBI erase counter header"
while our MTD driver has set "mtd->writesize = 2048"
So this mismatch between 64 Byte "erase counter header" and 2048 Byte
"mtd->writesize" returns with an error.

I would like to know, Is this a real issue or am I missing any layer
between ubifs & mtd driver which interfaces this 64 & 2048 Byte
differences.

Thanks a lot for any help.

Thanks and Regards,
Shivdas Gujare


2)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: read error with 64 byte erase counter header & 2048 Byte mtd->writesize
  2010-02-23  0:00 read error with 64 byte erase counter header & 2048 Byte mtd->writesize Shivdas Gujare
@ 2010-03-14  9:50 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2010-03-14  9:50 UTC (permalink / raw)
  To: Shivdas Gujare; +Cc: linux-mtd

Hi,

On Mon, 2010-02-22 at 16:00 -0800, Shivdas Gujare wrote:
> Hi all,
> I am trying to use ubifs, but currently I am facing an issue as follows,
> 
> 1) I tries to format a mtd device as, "ubiformat /dev/mtd0 -s 2048 -f
> ./ubi.img" while it return with an error of
> 
> ubiformat: mtd0 (nand), size 164757504 bytes (157.1 MiB), 1257
> eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
> libscan: scanning eraseblock 0 --  0 % complete  libmtd: error!:
> cannot read 64 bytes from mtd0 (eraseblock 0, offset 0)
>         error 22 (Invalid argument)
> ubiformat: error!: failed to scan mtd0 (/dev/mtd0)

Most probably your NAND driver is broken and is unable to read 64 bytes.

> I tried to understand what it is and came to know that, "ret =
> mtd_read(mtd, fd, eb, 0, &hdr, sizeof(struct ubi_ec_hdr));" from
> "ubi-utils/src/libscan.c"
> tried to read 64 byte "struct ubi_ec_hdr - UBI erase counter header"
> while our MTD driver has set "mtd->writesize = 2048"
> So this mismatch between 64 Byte "erase counter header" and 2048 Byte
> "mtd->writesize" returns with an error.

Your min. I/O unit is indeed 2048 bytes. However, MTD drivers are
supposed to be able to read any amount of bytes. In this case, your
driver should read 2048 bytes, then copy the requested 64 bytes to the
output buffer.

> I would like to know, Is this a real issue or am I missing any layer
> between ubifs & mtd driver which interfaces this 64 & 2048 Byte
> differences.

UBI/UBIFS write only in min. I/O size aligned units, but read in
arbitrary aligned units.

You should debug fix your driver.

And validate it with the mtd tests, just like it is requested here:

http://www.linux-mtd.infradead.org/doc/ubifs.html#L_how_send_bugreport

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-03-14  9:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-23  0:00 read error with 64 byte erase counter header & 2048 Byte mtd->writesize Shivdas Gujare
2010-03-14  9:50 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox