public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Alex Dubov <oakad@yahoo.com>
To: "Jörn" Engel <joern@logfs.org>
Cc: linux-mtd@lists.infradead.org
Subject: Re: Support of removable MTD devices and other advanced features (follow-up from lkml)
Date: Wed, 21 May 2008 18:30:44 -0700 (PDT)	[thread overview]
Message-ID: <612512.56176.qm@web36708.mail.mud.yahoo.com> (raw)
In-Reply-To: <20080521084144.GA20195@logfs.org>

> So here is a lightly modified version of your mtd_request bits.  Apart
> from reformatting and adding some documentation, the changes are:
> 
> - No flag for MTD_DATA, as this should be the default

# Nope. What about the case where you only want to read the oob (block scan) or
have no data to transfer (block invalidate)? Of course, this "flags" field may
be omitted outright, and the drivers could rely on error returned from
mtd_get_buf/mtd_get_oob, but this may turn out awkward.

> 
> enum mtd_command {
> 	MTD_READ,
> 	MTD_WRITE,
> 	MTD_ERASE,
> 	MTD_COPY,
> 	MTD_INVALIDATE
> };
> 
> /**
>  * @block_no:	physical eraseblock number
>  * @block_ofs:	offset within physical eraseblock
>  */
> struct mtd_address {
> 	u32	block_no;
> 	u32	block_ofs;
> };
> 
> #define MTD_FLAG_OOB	0x01
> /**
>  * @mtd:	underlying memory technology device
>  * @command:	read, write, erase, etc.
>  * @flags:	additional flags to modify commands
>  * @dst:	destination address
>  * @len:	length for read/write
>  * @src:	source address - only used for MTD_COPY
>  */
> struct mtd_request {
> 	struct mtd_device  *mtd;
> 	enum mtd_command   command;
> 	int		   flags;
>

        u32                log_block;

	struct mtd_address dst;

> 	u32		   len;

 	struct mtd_address src;
> };
> 

# You have to retain logical block address when using FTLs. This also makes
"struct mtd_address" confusing - the offset applies the same both to physical
and logical block. User level driver may want to fill in only logical block
address + offset, FTL will put in the actual physical block.

# And it's not clear to me why would you need pointer to data in the request
struct. Data is delivered through the additional (quite often more than one)
call to mtd_get_buf. I think, it's imperative to support fragmented buffers -
block device often submits requests that are larger than eraseblock (can be
read/written in one go) but fragmented across several memory buffers.


By the way, my bias toward block device emulation is caused by the obvious fact
that overwhelming majority of flash devices in existence are used as such, and
not without much success (I don't see many people complaining about their usb
sticks and mmc cards, and those may run linux inside one day).



      

  reply	other threads:[~2008-05-22  1:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-20 13:59 Support of removable MTD devices and other advanced features (follow-up from lkml) Alex Dubov
2008-05-21  6:47 ` Artem Bityutskiy
2008-05-21  8:41 ` Jörn Engel
2008-05-22  1:30   ` Alex Dubov [this message]
2008-05-22 15:10     ` Jörn Engel
2008-05-23  2:47       ` Alex Dubov
2008-05-23  5:50         ` Jörn Engel
2008-05-23  9:33           ` Alex Dubov
2008-05-23  9:59             ` Jörn Engel
2008-05-23 12:49               ` Alex Dubov
2008-05-23 13:28                 ` Jörn Engel
2008-05-24 13:12                   ` Alex Dubov
2008-05-24 17:56                     ` Jörn Engel
2008-05-25  3:41                       ` Alex Dubov
2008-05-25  7:25                         ` Jörn Engel
2008-05-25 13:30                           ` Jamie Lokier
2008-05-25 16:24                             ` Jörn Engel
2008-05-25 16:35                               ` Jamie Lokier
2008-05-25 16:55                                 ` Jörn Engel
2008-05-26  2:12                           ` Alex Dubov
2008-05-21  9:06 ` David Woodhouse
2008-05-21  9:29   ` Jörn Engel
2008-05-21 15:20     ` Alex Dubov
2008-05-21 15:22       ` David Woodhouse
2008-05-21 15:41         ` Alex Dubov
2008-05-21 20:45           ` Jörn Engel

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=612512.56176.qm@web36708.mail.mud.yahoo.com \
    --to=oakad@yahoo.com \
    --cc=joern@logfs.org \
    --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