All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/7] Add a mtd raid layer
@ 2015-12-01 10:52 Dongsheng Yang
  2015-12-01 10:52 ` [PATCH v1 1/7] mtd: nandsim: remove the abuse of reference to globle variable Dongsheng Yang
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Dongsheng Yang @ 2015-12-01 10:52 UTC (permalink / raw)
  To: computersforpeace, richard.weinberger; +Cc: linux-mtd, Dongsheng Yang

Hi guys,
	I am here to release v1 of the mtd raid layer. It's a layer
shown as below:

---------      -------------
|  ubi  |      |  mtdchar  |
---------      -------------
   |                |
   v                v
----------------------------
|        MTD RAID          |    <----- a new layer here (drivers/mtd/mtd_raid/*)
----------------------------
           |
           v
   ----------------
   |   mtd driver |
   ---------------- 

Of course, that's optional.

There are two ways to use mtd raid.
(1). For multi-chips driver:

	   /dev/mtd0
|--------------------------------|
|  ----------------------------  |
|  |        MTD RAID          |  |
|  ----------------------------  |
|      |             |           |
|      v             v           |
|  -----------   -----------     |
|  | mtd_info|   | mtd_info|     |
|  -----------   -----------     |
|--------------------------------|

When a driver have multiple chips, we can use mtd raid framework to build
them into a raid array and expose a mtd device. There are some drivers
are using mtd_concat, we can do the same thing with mtd_single. At the same
time, mtd raid provides more choices to them, such as raid0 or raid1.

(2). For user:

           /dev/mtd2
|--------------------------------|
|  ----------------------------  |
|  |        MTD RAID          |  |
|  ----------------------------  |
|      |             |           |
|      v             v           |
|  -----------   -----------     |
|  |/dev/mtd0|   |/dev/mtd1|     |
|  -----------   -----------     |
|--------------------------------|

we have a user tool for mtd raid, and user can use it to build raid array.

Example:
	# mtd_raid create --level=0 /dev/mtd0 /dev/mtd1 /dev/mtd2 /dev/mtd3
	# mtdinfo /dev/mtd4
	mtd4
	Name:                           mtdraid0-1
	Type:                           nand
	Eraseblock size:                65536 bytes, 64.0 KiB
	Amount of eraseblocks:          8192 (536870912 bytes, 512.0 MiB)
	Minimum input/output unit size: 512 bytes
	Sub-page size:                  256 bytes
	OOB size:                       16 bytes
	Character device major/minor:   90:8
	Bad blocks are allowed:         true
	Device is writable:             true

There are 4 mtd devices simulated by nandsim, then we create a raid0 with
them.
---------------------------------------------------------------------------
| device| size |  throughput (dd if=/dev/mtdX of=/dev/null bs=1M count=10)|
|--------------------------------------------------------------------------
| mtd0  | 128M |  14.0 MB/s						  |
|--------------------------------------------------------------------------
| mtd1  | 128M |  14.0 MB/s						  |
|--------------------------------------------------------------------------
| mtd2  | 128M |  14.0 MB/s						  |
|--------------------------------------------------------------------------
| mtd3  | 128M |  14.0 MB/s						  |
|--------------------------------------------------------------------------
| mtd4  | 512M |  51.1 MB/s						  |
---------------------------------------------------------------------------

Also we can use raid1 to get a mirror for robustness.

TODO:
	In this framework, we can implement more raid levels. The most useful
one I think is raid5/6, which would do a parity and fixup work in reading. That's
important for MLC or TLC. Raid-level is refered to:

https://en.wikipedia.org/wiki/Standard_RAID_levels 


Code:
	kernel:  https://github.com/yangdongsheng/linux  mtd_raid_v1 
	user  :  https://github.com/yangdongsheng/mtd-utils mtd_raid_v1

Thanx
Yang

Dongsheng Yang (7):
  mtd: nandsim: remove the abuse of reference to globle variable.
  mtd: nansim: add support of multi devices.
  mtd: mtd_raid: Init a new layer of MTD RAID
  mtd: mtd_raid: introduce raid single implementation
  mtd: mtd_raid: introduce raid0 implementation
  mtd: mtd_raid: introduce raid1 implementation
  mtd: mtd_raid: implement ioctl for mtd raid

 Documentation/ioctl/ioctl-number.txt |    1 +
 drivers/mtd/Kconfig                  |    2 +
 drivers/mtd/Makefile                 |    1 +
 drivers/mtd/mtd_raid/Kconfig         |   12 +
 drivers/mtd/mtd_raid/Makefile        |    3 +
 drivers/mtd/mtd_raid/core.c          | 1000 ++++++++++++++++++++++++++++++++++
 drivers/mtd/mtd_raid/ioctl.c         |  137 +++++
 drivers/mtd/mtd_raid/mtd_raid.h      |  264 +++++++++
 drivers/mtd/mtd_raid/raid0.c         |  136 +++++
 drivers/mtd/mtd_raid/raid1.c         |  156 ++++++
 drivers/mtd/mtd_raid/raid_io.c       |  449 +++++++++++++++
 drivers/mtd/mtd_raid/raid_single.c   |  156 ++++++
 drivers/mtd/nand/nandsim.c           |  312 ++++++-----
 include/uapi/mtd/mtd-raid-user.h     |   33 ++
 14 files changed, 2518 insertions(+), 144 deletions(-)
 create mode 100644 drivers/mtd/mtd_raid/Kconfig
 create mode 100644 drivers/mtd/mtd_raid/Makefile
 create mode 100644 drivers/mtd/mtd_raid/core.c
 create mode 100644 drivers/mtd/mtd_raid/ioctl.c
 create mode 100644 drivers/mtd/mtd_raid/mtd_raid.h
 create mode 100644 drivers/mtd/mtd_raid/raid0.c
 create mode 100644 drivers/mtd/mtd_raid/raid1.c
 create mode 100644 drivers/mtd/mtd_raid/raid_io.c
 create mode 100644 drivers/mtd/mtd_raid/raid_single.c
 create mode 100644 include/uapi/mtd/mtd-raid-user.h

-- 
1.8.4.2

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

end of thread, other threads:[~2015-12-02  1:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-01 10:52 [PATCH v1 0/7] Add a mtd raid layer Dongsheng Yang
2015-12-01 10:52 ` [PATCH v1 1/7] mtd: nandsim: remove the abuse of reference to globle variable Dongsheng Yang
2015-12-01 10:52 ` [PATCH v1 2/7] mtd: nansim: add support of multi devices Dongsheng Yang
2015-12-01 10:52 ` [PATCH v1 3/7] mtd: mtd_raid: Init a new layer of MTD RAID Dongsheng Yang
2015-12-01 10:52 ` [PATCH v1 4/7] mtd: mtd_raid: introduce raid single implementation Dongsheng Yang
2015-12-01 10:52 ` [PATCH v1 5/7] mtd: mtd_raid: introduce raid0 implementation Dongsheng Yang
2015-12-01 10:52 ` [PATCH v1 6/7] mtd: mtd_raid: introduce raid1 implementation Dongsheng Yang
2015-12-01 10:52 ` [PATCH v1 7/7] mtd: mtd_raid: implement ioctl for mtd raid Dongsheng Yang
2015-12-01 10:53 ` [PATCH] mtd-utils: introduce mtd_raid tool Dongsheng Yang
2015-12-02  1:09 ` [PATCH v1 0/7] Add a mtd raid layer Dongsheng Yang

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.