public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Block numbers of BEB
@ 2014-10-05  6:04 Woody Wu
  2014-10-05 15:41 ` Richard Weinberger
  0 siblings, 1 reply; 13+ messages in thread
From: Woody Wu @ 2014-10-05  6:04 UTC (permalink / raw)
  To: linux-mtd

Hi,

I can see how many bad erase blocks it had developed from the /proc directory, but where can I get know what block numbers these bad blocks on?

Any hint from you will be appreciated.

-- 
sent from mobile

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

* Re: Block numbers of BEB
  2014-10-05  6:04 Block numbers of BEB Woody Wu
@ 2014-10-05 15:41 ` Richard Weinberger
  2014-10-05 15:49   ` Woody Wu
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Weinberger @ 2014-10-05 15:41 UTC (permalink / raw)
  To: Woody Wu; +Cc: linux-mtd@lists.infradead.org

On Sun, Oct 5, 2014 at 8:04 AM, Woody Wu <narkewoody@gmail.com> wrote:
> Hi,
>
> I can see how many bad erase blocks it had developed from the /proc directory, but where can I get know what block numbers these bad blocks on?
>
> Any hint from you will be appreciated.

In case you're using UBI please see /sys/class/ubi/ubi0/

-- 
Thanks,
//richard

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

* Re: Block numbers of BEB
  2014-10-05 15:41 ` Richard Weinberger
@ 2014-10-05 15:49   ` Woody Wu
  2014-10-05 15:53     ` Richard Weinberger
  2014-10-06  7:53     ` Ricard Wanderlof
  0 siblings, 2 replies; 13+ messages in thread
From: Woody Wu @ 2014-10-05 15:49 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: linux-mtd@lists.infradead.org

What I said of checking /proc is wrong. What I indeed checked was /sys/class/ubi as you mentioned. The problem is, under the /sys/class/ubi, there is no information about what blocks are marked as bad, there is only information about the total number of bad blocks.


On October 5, 2014 10:41:50 PM GMT+07:00, Richard Weinberger <richard.weinberger@gmail.com> wrote:
>On Sun, Oct 5, 2014 at 8:04 AM, Woody Wu <narkewoody@gmail.com> wrote:
>> Hi,
>>
>> I can see how many bad erase blocks it had developed from the /proc
>directory, but where can I get know what block numbers these bad blocks
>on?
>>
>> Any hint from you will be appreciated.
>
>In case you're using UBI please see /sys/class/ubi/ubi0/

-- 
sent from mobile

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

* Re: Block numbers of BEB
  2014-10-05 15:49   ` Woody Wu
@ 2014-10-05 15:53     ` Richard Weinberger
  2014-10-05 15:58       ` Woody Wu
  2014-10-06  7:53     ` Ricard Wanderlof
  1 sibling, 1 reply; 13+ messages in thread
From: Richard Weinberger @ 2014-10-05 15:53 UTC (permalink / raw)
  To: Woody Wu; +Cc: linux-mtd@lists.infradead.org

Am 05.10.2014 17:49, schrieb Woody Wu:
> What I said of checking /proc is wrong. What I indeed checked was /sys/class/ubi as you mentioned. The problem is, under the /sys/class/ubi, there is no information about what blocks are marked as bad, there is only information about the total number of bad blocks.

Ah, you don't want the number of bad blocks, you want a map of bad blocks.
IIRC UBI does not expose this information.

Thanks,
//richard

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

* Re: Block numbers of BEB
  2014-10-05 15:53     ` Richard Weinberger
@ 2014-10-05 15:58       ` Woody Wu
  2014-10-05 16:00         ` Richard Weinberger
  0 siblings, 1 reply; 13+ messages in thread
From: Woody Wu @ 2014-10-05 15:58 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: linux-mtd@lists.infradead.org



On October 5, 2014 10:53:21 PM GMT+07:00, Richard Weinberger <richard@nod.at> wrote:
>Am 05.10.2014 17:49, schrieb Woody Wu:
>> What I said of checking /proc is wrong. What I indeed checked was
>/sys/class/ubi as you mentioned. The problem is, under the
>/sys/class/ubi, there is no information about what blocks are marked as
>bad, there is only information about the total number of bad blocks.
>
>Ah, you don't want the number of bad blocks, you want a map of bad
>blocks.

Yes, exactly!

>IIRC UBI does not expose this information.

I am afraid, some initial bad blocks actually came with the Flash manufacturer and recorded in some starting blocks of the Flash, is that right?

>
>Thanks,
>//richard

-- 
sent from mobile

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

* Re: Block numbers of BEB
  2014-10-05 15:58       ` Woody Wu
@ 2014-10-05 16:00         ` Richard Weinberger
  2014-10-05 16:17           ` Woody Wu
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Weinberger @ 2014-10-05 16:00 UTC (permalink / raw)
  To: Woody Wu; +Cc: linux-mtd@lists.infradead.org

Am 05.10.2014 17:58, schrieb Woody Wu:
> I am afraid, some initial bad blocks actually came with the Flash manufacturer and recorded in some starting blocks of the Flash, is that right?

You mean the BBT, yes.
But what has this to do with exposing this map to userspace?

Thanks,
//richard

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

* Re: Block numbers of BEB
  2014-10-05 16:00         ` Richard Weinberger
@ 2014-10-05 16:17           ` Woody Wu
  2014-10-05 16:21             ` Richard Weinberger
  0 siblings, 1 reply; 13+ messages in thread
From: Woody Wu @ 2014-10-05 16:17 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: linux-mtd@lists.infradead.org



On October 5, 2014 11:00:25 PM GMT+07:00, Richard Weinberger <richard@nod.at> wrote:
>Am 05.10.2014 17:58, schrieb Woody Wu:
>> I am afraid, some initial bad blocks actually came with the Flash
>manufacturer and recorded in some starting blocks of the Flash, is that
>right?
>
>You mean the BBT, yes.
>But what has this to do with exposing this map to userspace?

If I.know the location of the BBT, maybe I can read it out using a user space tool, right?

>
>Thanks,
>//richard

-- 
sent from mobile

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

* Re: Block numbers of BEB
  2014-10-05 16:17           ` Woody Wu
@ 2014-10-05 16:21             ` Richard Weinberger
  2014-10-05 16:40               ` Woody Wu
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Weinberger @ 2014-10-05 16:21 UTC (permalink / raw)
  To: Woody Wu; +Cc: linux-mtd@lists.infradead.org

Am 05.10.2014 18:17, schrieb Woody Wu:
> On October 5, 2014 11:00:25 PM GMT+07:00, Richard Weinberger <richard@nod.at> wrote:
>> Am 05.10.2014 17:58, schrieb Woody Wu:
>>> I am afraid, some initial bad blocks actually came with the Flash
>> manufacturer and recorded in some starting blocks of the Flash, is that
>> right?
>>
>> You mean the BBT, yes.
>> But what has this to do with exposing this map to userspace?
> 
> If I.know the location of the BBT, maybe I can read it out using a user space tool, right?

I'm not sure if this is what you want.
There are also bad block markers.
Please see http://wiki.openmoko.org/wiki/NAND_bad_blocks

Thanks,
//richard

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

* Re: Block numbers of BEB
  2014-10-05 16:21             ` Richard Weinberger
@ 2014-10-05 16:40               ` Woody Wu
  0 siblings, 0 replies; 13+ messages in thread
From: Woody Wu @ 2014-10-05 16:40 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: linux-mtd@lists.infradead.org



On October 5, 2014 11:21:59 PM GMT+07:00, Richard Weinberger <richard@nod.at> wrote:
>Am 05.10.2014 18:17, schrieb Woody Wu:
>> On October 5, 2014 11:00:25 PM GMT+07:00, Richard Weinberger
><richard@nod.at> wrote:
>>> Am 05.10.2014 17:58, schrieb Woody Wu:
>>>> I am afraid, some initial bad blocks actually came with the Flash
>>> manufacturer and recorded in some starting blocks of the Flash, is
>that
>>> right?
>>>
>>> You mean the BBT, yes.
>>> But what has this to do with exposing this map to userspace?
>> 
>> If I.know the location of the BBT, maybe I can read it out using a
>user space tool, right?
>
>I'm not sure if this is what you want.
>There are also bad block markers.
>Please see http://wiki.openmoko.org/wiki/NAND_bad_blocks

It looks very knowledgeable. I've marked it for later reading soon.  Thanks, Richard!

>
>Thanks,
>//richard

-- 
sent from mobile

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

* Re: Block numbers of BEB
  2014-10-05 15:49   ` Woody Wu
  2014-10-05 15:53     ` Richard Weinberger
@ 2014-10-06  7:53     ` Ricard Wanderlof
  2014-10-06  8:41       ` Woody Wu
  1 sibling, 1 reply; 13+ messages in thread
From: Ricard Wanderlof @ 2014-10-06  7:53 UTC (permalink / raw)
  To: Woody Wu; +Cc: Richard Weinberger, linux-mtd@lists.infradead.org


On Sun, 5 Oct 2014, Woody Wu wrote:

> What I said of checking /proc is wrong. What I indeed checked was 
> /sys/class/ubi as you mentioned. The problem is, under the 
> /sys/class/ubi, there is no information about what blocks are marked as 
> bad, there is only information about the total number of bad blocks.

I was thinking the mtd tool nanddump displayed which blocks were bad when 
dumping, but a quick test just now revealed that that doesn't seem to be 
the case.

The information is available to userspace though, so it's fairly easy to 
hack together a userspace tool that gets the bad block information via 
ioctls.

/Ricard
-- 
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30

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

* Re: Block numbers of BEB
  2014-10-06  7:53     ` Ricard Wanderlof
@ 2014-10-06  8:41       ` Woody Wu
  2014-10-06  8:59         ` Ricard Wanderlof
  0 siblings, 1 reply; 13+ messages in thread
From: Woody Wu @ 2014-10-06  8:41 UTC (permalink / raw)
  To: Ricard Wanderlof; +Cc: Richard Weinberger, linux-mtd@lists.infradead.org



On October 6, 2014 2:53:01 PM GMT+07:00, Ricard Wanderlof <ricard.wanderlof@axis.com> wrote:
>
>On Sun, 5 Oct 2014, Woody Wu wrote:
>
>> What I said of checking /proc is wrong. What I indeed checked was 
>> /sys/class/ubi as you mentioned. The problem is, under the 
>> /sys/class/ubi, there is no information about what blocks are marked
>as 
>> bad, there is only information about the total number of bad blocks.
>
>I was thinking the mtd tool nanddump displayed which blocks were bad
>when 
>dumping, but a quick test just now revealed that that doesn't seem to
>be 
>the case.
>
>The information is available to userspace though, so it's fairly easy
>to 
>hack together a userspace tool that gets the bad block information via 
>ioctls.

Do you know in what kernel .c file that contain the information?  Is it in mtd or ubi?

>
>/Ricard

-- 
sent from mobile

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

* Re: Block numbers of BEB
  2014-10-06  8:41       ` Woody Wu
@ 2014-10-06  8:59         ` Ricard Wanderlof
  2014-10-06 11:25           ` Woody Wu
  0 siblings, 1 reply; 13+ messages in thread
From: Ricard Wanderlof @ 2014-10-06  8:59 UTC (permalink / raw)
  To: Woody Wu; +Cc: Richard Weinberger, linux-mtd@lists.infradead.org


On Mon, 6 Oct 2014, Woody Wu wrote:

> >The information is available to userspace though, so it's fairly easy
> >to 
> >hack together a userspace tool that gets the bad block information via 
> >ioctls.
> 
> Do you know in what kernel .c file that contain the information?  Is it 
> in mtd or ubi?

There is an ioctl called MEMGETBADBLOCK which returns information about 
the bad block status of a given (physical) flash block.

See include/uapi/mtd/mtd-api.h in the kernel for details.

/Ricard
-- 
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30

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

* Re: Block numbers of BEB
  2014-10-06  8:59         ` Ricard Wanderlof
@ 2014-10-06 11:25           ` Woody Wu
  0 siblings, 0 replies; 13+ messages in thread
From: Woody Wu @ 2014-10-06 11:25 UTC (permalink / raw)
  To: Ricard Wanderlof; +Cc: Richard Weinberger, linux-mtd@lists.infradead.org



On October 6, 2014 3:59:26 PM GMT+07:00, Ricard Wanderlof <ricard.wanderlof@axis.com> wrote:
>
>On Mon, 6 Oct 2014, Woody Wu wrote:
>
>> >The information is available to userspace though, so it's fairly
>easy
>> >to 
>> >hack together a userspace tool that gets the bad block information
>via 
>> >ioctls.
>> 
>> Do you know in what kernel .c file that contain the information?  Is
>it 
>> in mtd or ubi?
>
>There is an ioctl called MEMGETBADBLOCK which returns information about
>
>the bad block status of a given (physical) flash block.
>
>See include/uapi/mtd/mtd-api.h in the kernel for details.

Great! Thanks.

>/Ricard

-- 
sent from mobile

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

end of thread, other threads:[~2014-10-06 11:26 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-05  6:04 Block numbers of BEB Woody Wu
2014-10-05 15:41 ` Richard Weinberger
2014-10-05 15:49   ` Woody Wu
2014-10-05 15:53     ` Richard Weinberger
2014-10-05 15:58       ` Woody Wu
2014-10-05 16:00         ` Richard Weinberger
2014-10-05 16:17           ` Woody Wu
2014-10-05 16:21             ` Richard Weinberger
2014-10-05 16:40               ` Woody Wu
2014-10-06  7:53     ` Ricard Wanderlof
2014-10-06  8:41       ` Woody Wu
2014-10-06  8:59         ` Ricard Wanderlof
2014-10-06 11:25           ` Woody Wu

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