public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind@infradead.org>
To: Vinit Agnihotri <vinit.agnihotri@gmail.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: What is subpage_sft??
Date: Tue, 03 Jul 2007 09:55:25 +0300	[thread overview]
Message-ID: <1183445725.3531.23.camel@sauron> (raw)
In-Reply-To: <9b52d64c0707022335h35d4d5ddpd8bdf9b7031bfa21@mail.gmail.com>

On Tue, 2007-07-03 at 12:05 +0530, Vinit Agnihotri wrote:
> I am little bit confused with following UBI code.
> 
> My initial understandings are as follows, please correct me if I am wrong.
> 1. A flash device has "n" no. of eraseblocks.
> 2. A eraseblock contains "m" no. of pages.
> 3. A page contains "l" no. of  subpages.
> 4. Subpage support is dependent on underlying NAND, so every NAND cant
> have subpage access.
> 5. Concept of subpages only exists in NAND flash not NOR.
Right.

> UBI code:
>  ubi->min_io_size = ubi->mtd->writesize;
NAND page size.
>  ubi->hdrs_min_io_size =ubi->mtd->writesize >> ubi->mtd->subpage_sft;
Sub-page size.
>  ubi->ec_hdr_alsize = ALIGN(UBI_EC_HDR_SIZE, ubi->hdrs_min_io_size);
EC header size aligned to sub-page size.
>  ubi->vid_hdr_alsize = ALIGN(UBI_VID_HDR_SIZE, ubi->hdrs_min_io_size);
VID header size aligned to sub-page size

> 6. min_io_size: is minimal i/o that can be performed on flash.
Yes, NAND page in case of NAND
> 7. writesize: is indeed a page size.
Right.
> 8. If subpages are not supported then hdrs_min_io_size == writesize
Right,
> 9. So if writesize is 2048 bytes & if subpage_sft is 0, then ec & vid
> headers will be of 1 NAND page. So here in this case: min_io_size ==
> writesize == hdrs_min_io_size.
Right.
> 10. Now if subpages are supported, then min_io_size !=
> hdrs_min_io_size. Now if we can write in alignment of hdrs_min_io_size
> which is less that min_io_size , then what is significance of
> min_io_size.
We use sub-page only for EC and VID headers. For UBI users we report
min_io_size, i.e. they do not know about sub-pages. Users have to submit
only min_io_size-aligned writes. Sub-page is used _only_ as an internal
optimization.

> i.e.
> If writesize = 2048
>   subpage_sft = 2
>   min_io_size = writesize = 2048
>   hdrs_min_io_size = writesize >> subpage_sft = 512
>   hdrs_min_io_size < min_io_size
> 
> Now if we can write hdrs_min_io_size of data to flash then what is
> notion of min_io_size???

See above.

The main reason why we do not make min_io_size = sub-page, but still
expose whole NAND page size as the minimal Input/Output unit is because
sub-page stuff is kinda tricky and hacky.

If you glance to nand_base.c how sub-page write is implemented, you'll
notice that if you wanna write a sub-page, it still writes whole NAND
page, but data in the sub-pages other then the one you are writing to
are set to 0xFF. IOW, sub-page write takes as much time as whole page
write.

If we'd expose sub-page as minimal I/O unit (which we actually used to
do!), JFFS2'd become slower (when it is used on top of UBI). Indeed,
compare 512bytes which is flushed as slow as 2KiB write-buffer - 4x I/O
speed regression.

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

  reply	other threads:[~2007-07-03  6:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-03  5:28 What is subpage_sft?? Vinit Agnihotri
2007-07-03  5:34 ` Kyungmin Park
2007-07-03  5:46   ` Artem Bityutskiy
2007-07-03  5:54     ` Vinit Agnihotri
2007-07-03  6:35       ` Vinit Agnihotri
2007-07-03  6:55         ` Artem Bityutskiy [this message]
2007-07-03  7:03           ` Vinit Agnihotri
2007-07-03  5:44 ` Artem Bityutskiy

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=1183445725.3531.23.camel@sauron \
    --to=dedekind@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=vinit.agnihotri@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox