public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Seongsu Lee <senux@senux.com>
To: linux-mtd@lists.infradead.org
Cc: cgan@iders.ca
Subject: mounting yaffs2 on mtdconcat-ed partition
Date: Wed, 11 Oct 2006 09:03:58 +0900	[thread overview]
Message-ID: <20061011000358.GA21321@pooky.senux.com> (raw)

Hello,

The test machine is a small embedded box, 
labeled xhyper270a-nand6ea from HyBus, Korea. 
The version of Linux kernel that I used in the test is 
2.6.11.

I created two concatenated partition as the follow. 

[dmesg]
Concatenating MTD devices:
(0): "xhyper27x_Nand_Flash_A_128K"
(1): "xhyper27x_Nand_Flash_B_128K"
into device "posllayer0"
Concatenating MTD devices:
(0): "xhyper27x_Nand_Flash_C_128K"
into device "posllayer1"

[root@hybus tmp]# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00040000 "boot"
mtd1: 00180000 00040000 "kernel"
mtd2: 01e40000 00040000 "rootfs"
mtd3: 08000000 00020000 "xhyper27x_Nand_Flash_A_128K"
mtd4: 08000000 00020000 "xhyper27x_Nand_Flash_B_128K"
mtd5: 08000000 00020000 "xhyper27x_Nand_Flash_C_128K"
mtd6: 08000000 00020000 "xhyper27x_Nand_Flash_D_128K"
mtd7: 10000000 00020000 "posllayer0"
mtd8: 08000000 00020000 "posllayer1"

The problem is that I can't mount yaffs2 filesystem on
a partition that is concatenated by mtdconcat.c. Follow is
the message in mount command. (permission error was occured)

[root@hybus mnt]# eraseall /dev/mtd6
Erasing 128 Kibyte @ 0 --  0 % complete.
eraseall: /dev/mtd6: MTD Erase failure: Input/output error
Erasing 128 Kibyte @ c000000 -- 11 % complete.
eraseall: /dev/mtd6: MTD Erase failure: Input/output error
Erasing 128 Kibyte @ ffe0000 --  3 % complete.
[root@hybus mnt]# mount -t yaffs2 /dev/mtdblock6 /mnt/data6
mount: permission denied. (are you root?)

So, I looked the source code of yaffs2 and mtd. I found that
there is not bad block management support in mtdconcat. 
Am I right? I made follow simple patch for mtdconcat.c and 
it works. (mounting)

Index: mtdconcat.c
===================================================================
RCS file: /***/linux/drivers/mtd/mtdconcat.c,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 mtdconcat.c
639a640,687
> static int concat_block_isbad(struct mtd_info *mtd, loff_t ofs) {
>        struct mtd_concat *concat = CONCAT(mtd);
>        int i;
>        int err = 0;
>
>        if (ofs > mtd->size) {
>                return -EINVAL;
>        }
>
>        for (i = 0; i < concat->num_subdev; i++) {
>                struct mtd_info *subdev = concat->subdev[i];
>
>                if (ofs >= subdev->size) {
>                        ofs -= subdev->size;
>                        continue;
>                }
>
>                err = subdev->block_isbad(subdev, ofs);
>                break;
>        }
>
>        return err;
> }
>
> static int concat_block_markbad(struct mtd_info *mtd, loff_t ofs) {
>        struct mtd_concat *concat = CONCAT(mtd);
>        int i;
>        int err = 0;
>
>        if (ofs > mtd->size) {
>                return -EINVAL;
>        }
>
>        for (i = 0; i < concat->num_subdev; i++) {
>                struct mtd_info *subdev = concat->subdev[i];
>
>                if (ofs >= subdev->size) {
>                        ofs -= subdev->size;
>                        continue;
>                }
>
>                err = subdev->block_isbad(subdev, ofs);
>                break;
>        }
>
>        return err;
> }
>
754a803,806
>       /* bad block management */
>       concat->mtd.block_isbad   = concat_block_isbad;
>       concat->mtd.block_markbad = concat_block_markbad;
>

The result of mount test after patching mtdconcat.c.

[root@hybus mnt]# mount -t yaffs2 /dev/mtdblock7 /mnt/data7
[root@hybus mnt]# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/rom2                30.3M     15.3M     15.0M  51% /
/dev/mtdblock7          256.0M      1.0M    255.0M   0% /mnt/data7

I think bad block management is not supported in mtdconcat.
Is it right? If so, could you somebody add the support?

Let me know if something wrong in my posting. 
I am waiting for help.

-- 
Seongsu Lee - http://www.senux.com/
"World domination. Fast" (By Linus Torvalds)

                 reply	other threads:[~2006-10-11 13:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20061011000358.GA21321@pooky.senux.com \
    --to=senux@senux.com \
    --cc=cgan@iders.ca \
    --cc=linux-mtd@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox