public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Studying MTD <studying_mtd@yahoo.com>
Cc: linux-mtd <linux-mtd@lists.infradead.org>
Subject: Re: why MTD model ?
Date: Fri, 14 Jun 2002 13:21:56 +0100	[thread overview]
Message-ID: <1358.1024057316@redhat.com> (raw)
In-Reply-To: <20020614095923.98432.qmail@web21502.mail.yahoo.com>

studying_mtd@yahoo.com said:
>  If some how i solve these issues :- 
> 1. sector size
> 2. erase/write
> 3. wear levelling

The core MTD API isn't there to solve those issues for you, only to
represent the raw hardware -- and we have existing drivers for many types of
raw hardware.

Those issues are solved by whatever _uses_ the MTD devices -- and there are 
a number of solutions already implemented in the MTD code base. The most
sensible way to put a file system on flash is to use a file system
especially designed for that purpose -- such as JFFS2. However, for legacy 
reasons we also have code which uses MTD devices to emulate hard drives, as 
for some strange and inexplicable reason you seem to want.

In the days of DOS, it was difficult to add a real file system, so instead 
people came up with a gross hack to make a flash device appear just like a 
normal BIOS-supported disk drive.

They designed a pseudo-filesystem which emulated a hard drive, and then
provided a BIOS extension which overrode the INT 13h (Disk BIOS) interrupt
handler. Then people would just use a FAT file system on it under DOS as if
it was a normal hard drive. 

When Windows started to gain its own 32-bit device drivers for hard drives, 
the pseudo-filesystems that emulated hard drives were rewritten to run 
under Windows, but people were so used to the idea of a pseudo-fs emulating 
a block device with a 'real' fs on top of that, that the opportunity wasn't 
taken to make the whole thing sane just by having a proper file system 
directly on the flash.

The only half-sane reason for using a translation layer to emulate a block 
device like this is on removable media -- if you need to be able to remove 
the flash device from your Linux box and read it in a DOS or Windows box. 

If your flash isn't going to be removable, then you really don't want to do 
it that way, for reasons which I've discussed at length quite recently.

You should be using a proper file system directly on the flash. This is not 
DOS, and you don't have to repeat DOS-based mistakes.

> Please let me know, which block device is closest to Flash memory :-
> 1. Hard Disk 2. Floppy drive 3. PCMCIA memory card 4. Ramdisk 5. or
> some other block device ? 

Your question is very ambiguous. You might as well ask which tropical fish 
is closest to flash memory. No block device is _similar_ to flash -- they are 
entirely different beasts.

I suppose the hard drive sitting on my desk with a pile of flash chips on 
top of it is 'closest to Flash memory' in one way, but I suspect that's not 
what you were asking.

If you mean which block device is most similar in performance and general 
operation to a system which uses flash to emulate a block device, then the 
answer would be PCMCIA-ATA or CompactFlash cards -- because they _are_ 
using precisely such a translation layer internally. The only difference is 
that they do it internally, in firmware (and generally quite unreliably).

If you mean which block device driver code is most similar to the code 
you'd have to write to implement yet another translation layer, then that 
would be something like the FTL or NFTL code -- they both use the 
underlying MTD drivers for the raw hardware, and perform their own magic 
to present a block device implementation to Linux.

--
dwmw2

  reply	other threads:[~2002-06-14 12:21 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-12 23:53 why MTD model ? Studying MTD
2002-06-13 10:34 ` David Woodhouse
2002-06-13 16:19   ` Studying MTD
2002-06-13 16:39     ` Gregg C Levine
2002-06-13 17:13     ` Howto create a new jffs2 Krypton
2002-06-14  2:22       ` Steve Tsai
2002-06-14  3:20         ` Problem putting JFFS on MTD Clifford Loo
2002-06-14  7:33           ` David Woodhouse
2002-06-14  8:46             ` Clifford Loo
2002-06-14  8:50               ` David Woodhouse
2002-06-14  9:18                 ` Clifford Loo
2002-06-14  9:17                   ` David Woodhouse
2002-06-14  9:39                     ` Clifford Loo
2002-06-14  6:22         ` Howto create a new jffs2 Krypton
2002-06-14  6:55           ` Studying MTD
2002-06-14  7:46             ` Krypton
2002-06-14  7:47               ` David Woodhouse
2002-06-14  9:52                 ` Krypton
2002-06-13 21:34     ` why MTD model ? David Woodhouse
2002-06-14  4:29       ` Studying MTD
2002-06-14  7:54         ` David Woodhouse
2002-06-14  9:01           ` Studying MTD
2002-06-14  9:23             ` David Woodhouse
2002-06-14  9:59               ` Studying MTD
2002-06-14 12:21                 ` David Woodhouse [this message]
2002-06-14 12:36                   ` Gregg C Levine
2002-06-19 14:28                 ` Eric W. Biederman
     [not found] <4611.1024058858@redhat.com>
2002-06-14 23:39 ` Gregg C Levine
2002-06-15  7:34   ` David Woodhouse

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=1358.1024057316@redhat.com \
    --to=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=studying_mtd@yahoo.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