What is subpage_sft??

Vinit Agnihotri vinit.agnihotri at gmail.com
Tue Jul 3 03:03:49 EDT 2007


Thanks Artem, That clears almost all confusion about min_io_size,
hdrs_min_io_size & writesize.

Regards,
Vinit.


On 7/3/07, Artem Bityutskiy <dedekind at infradead.org> wrote:
> 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 (Битюцкий Артём)
>
>


-- 
I feel free now


More information about the linux-mtd mailing list