All of lore.kernel.org
 help / color / mirror / Atom feed
* (no subject)
@ 2011-02-14 14:16 Jarkko Lavinen
  2011-02-14 14:16 ` [PATCH 1/3] mtd_blkdevs: Add background processing support Jarkko Lavinen
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jarkko Lavinen @ 2011-02-14 14:16 UTC (permalink / raw)
  To: linux-mtd; +Cc: Jarkko Lavinen

Happy Valentine's day

Mtdswap is a volatile block driver on top flash partition meant to be
used as a swap.  Its like FTL but without stored mapping.

Use example. The header option will use builtin swap header, avoids mkswap and
saves 4KiB.
  modprobe onenand_sim
  modprobe mtdswap partitions=0 header=1
  swapon /dev/mtdswap0

Erase blocks have clean and dirty markers stored in the OOB.  Clean
markers contain an erase counter for wear leveling. The current
implementation assumes OOB can be written once before writing to main
area.

A new background method is added into struct mtd_blktrans_ops and
background support to mtd_blkdevs thread.  The idea is to allow
garbage collection to run as a background job when the request queue
is empty. This allows the mtdswap to be single threaded and avoids
messy locking. It also increases GC performance.

MTdswap tries to recover from read and write errors and erase
failures. Soft read error, write error and erase failures are normally
not returned to user. Only hard read errors cause data loss and an error
to be returned to the user.

Bitflips are considered normal behavior.  Erase blocks with read or
write errors schedule the erase block to be garbage collected. With
hard read error the GC may fail and data is lost. Hard read errors
cause the erase block to be pattern tested before taken back into use.

Write errors cause the erase block to marked bad immediately. Erase
failure tolerance is a compile time option. With strict handling the
erase block is marked bad immediately, otherwise after several
retries.

Potential improvements could be:
- Buffering for faster IO and and pages larger than 4KiB.
- Using device names rather than number as a module parameter.
- Erasing more than one erase block at a time.
- Scan the erase blocks after startup to make faster startup.
- Storing the mapping information to make it yet another FTL and allow
  hibernation into swap partition.

Jarkko Lavinen

 drivers/mtd/Kconfig          |   18 
 drivers/mtd/Makefile         |    1 
 drivers/mtd/mtd_blkdevs.c    |   33 
 drivers/mtd/mtdswap.c        | 1593 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/mtd/blktrans.h |    2 
 5 files changed, 1644 insertions(+), 3 deletions(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-03-09  8:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-14 14:16 Jarkko Lavinen
2011-02-14 14:16 ` [PATCH 1/3] mtd_blkdevs: Add background processing support Jarkko Lavinen
2011-02-14 14:16 ` [PATCH 2/3] mtd_blkdevs: Set the maximum discards size Jarkko Lavinen
2011-02-14 14:16 ` [PATCH 3/3] mtd: Add mtdswap block driver Jarkko Lavinen
2011-02-18 14:14   ` Artem Bityutskiy
2011-02-22 16:21     ` Jarkko Lavinen
2011-02-25 11:03       ` Artem Bityutskiy
2011-03-09  8:08         ` Artem Bityutskiy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.