mtd: add writebufsize field to mtd_info struct

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Thu Jan 6 10:59:04 EST 2011


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=0e4ca7e5101e7f4054452b8d71c535eec64a187b
Commit:     0e4ca7e5101e7f4054452b8d71c535eec64a187b
Parent:     9ac4e613a88d7f6a7a9651d863e9c8f63b582718
Author:     Anatolij Gustschin <agust at denx.de>
AuthorDate: Thu Dec 16 23:42:14 2010 +0100
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Thu Jan 6 15:35:50 2011 +0000

    mtd: add writebufsize field to mtd_info struct
    
    This field will be used to indicate the write buffer size
    of the MTD device. UBI will set it's minimal I/O unit size
    (min_io_size) to the indicated write buffer size. By this
    change we intend to fix failed recovery of UBIFS partitions
    we currently observe on NOR flash when mounting the partition
    after unclean unmount.
    
    Currently the min_io_size is set to mtd->writesize (which is 1
    byte for NOR flash). But flash programming is often done from
    prepared write buffer containing multiple bytes and is performed
    in one programming operation which could be interrupted by a power
    cut or a system reset causing corrupted (partially written) areas
    in a flash sector. Knowing the size of potentially corrupted areas
    UBIFS scanning and recovery algorithms are able to perform
    successful recovery.
    
    In case of NOR flash minimal I/O size must be equal to the
    maximal size of the write buffer used by embedded flash
    programming algorithm. In case of NAND flash mtd->writebufsize
    should be equivalent to mtd->writesize.
    
    The subsequent patches will add mtd->writebufsize initialization
    where needed.
    
    Signed-off-by: Anatolij Gustschin <agust at denx.de>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 include/linux/mtd/mtd.h |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index fe8d77e..9d5306b 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -144,6 +144,17 @@ struct mtd_info {
 	 */
 	uint32_t writesize;
 
+	/*
+	 * Size of the write buffer used by the MTD. MTD devices having a write
+	 * buffer can write multiple writesize chunks at a time. E.g. while
+	 * writing 4 * writesize bytes to a device with 2 * writesize bytes
+	 * buffer the MTD driver can (but doesn't have to) do 2 writesize
+	 * operations, but not 4. Currently, all NANDs have writebufsize
+	 * equivalent to writesize (NAND page size). Some NOR flashes do have
+	 * writebufsize greater than writesize.
+	 */
+	uint32_t writebufsize;
+
 	uint32_t oobsize;   // Amount of OOB data per block (e.g. 16)
 	uint32_t oobavail;  // Available OOB bytes per block
 



More information about the linux-mtd-cvs mailing list