summaryrefslogtreecommitdiff
path: root/fs/logfs/dev_mtd.c
AgeCommit message (Collapse)Author
2012-02-01mtd: fix merge conflict resolution breakageArtem Bityutskiy
This patch fixes merge conflict resolution breakage introduced by merge d3712b9dfcf4 ("Merge tag 'for-linus' of git://github.com/prasad-joshi/logfs_upstream"). The commit changed 'mtd_can_have_bb()' function and made it always return zero, which is incorrect. Instead, we need it to return whether the underlying flash device can have bad eraseblocks or not. UBI needs this information because it affects how it handles the underlying flash. E.g., if the underlying flash is NOR, it cannot have bad blocks and any write or erase error is fatal, and all we can do is to switch to R/O mode. We do not need to reserve a pool of good eraseblocks for bad eraseblocks handling, and so on. This patch also removes 'mtd_can_have_bb()' invocations from Logfs to ensure correct Logfs behavior. I've tested that with this patch UBI works on top of NOR and NAND flashes emulated by mtdram and nandsim correspondingly. This patch is based on patch from Linus Torvalds. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Acked-by: Jörn Engel <joern@logfs.org> Acked-by: Prasad Joshi <prasadjoshi.linux@gmail.com> Acked-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-09logfs: do not use 'mtd->block_isbad' directlyArtem Bityutskiy
Instead, use the new 'mtd_can_have_bb()' helper. Cc: Jörn Engel <joern@logfs.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-01-09mtd: do not use mtd->sync directlyArtem Bityutskiy
This patch teaches 'mtd_sync()' to do nothing when the MTD driver does not have the '->sync()' method, which allows us to remove all direct 'mtd->sync' accesses. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-01-09mtd: introduce mtd_block_isbad interfaceArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-01-09mtd: introduce mtd_sync interfaceArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-01-09mtd: introduce mtd_write interfaceArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-01-09mtd: introduce mtd_read interfaceArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-01-09mtd: introduce mtd_erase interfaceArtem Bityutskiy
This patch is part of a patch-set which changes the MTD interface from 'mtd->func()' form to 'mtd_func()' form. We need this because we want to add common code to to all drivers in the mtd core level, which is impossible with the current interface when MTD clients call driver functions like 'read()' or 'write()' directly. At this point we just introduce a new inline wrapper function, but later some of them are expected to gain more code. E.g., the input parameters check should be moved to the wrappers rather than be duplicated at many drivers. This particular patch introduced the 'mtd_erase()' interface. The following patches add all the other interfaces one by one. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-01-09logfs: rename functions starting with mtd_Artem Bityutskiy
We are going to re-work the MTD interface and change 'mtd->write()' to 'mtd_write()', 'mtd->read()' to 'mtd_read()' and so forth for all functions in the 'struct mtd_info' structure. However, logfs has its own 'mtd_read()', 'mtd_write()', etc functions which collide with our changes. This patch renames these logfs functions to 'logfs_mtd_read()', 'logfs_mtd_write()', etc. Additionally, to make the 'fs/logfs/dev_mtd.c' file look consistent, rename similarly all the other functions starting with 'mtd_'. Cc: Jörn Engel <joern@logfs.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2011-03-31Fix common misspellingsLucas De Marchi
Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2010-10-29logfs: fix a leak in get_sbAl Viro
a) switch ->put_device() to logfs_super * b) actually call it on early failures in logfs_get_sb_device() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2010-10-29logfs get_sb, part 3Al Viro
take logfs_get_sb_device() calls to logfs_get_sb() itself Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2010-10-29logfs get_sb, part 2Al Viro
take setting s_bdev/s_mtd/s_devops to callers of logfs_get_sb_device(), don't bother passing them separately Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2010-10-29logfs get_sb massage, part 1Al Viro
move allocation of logfs_super to logfs_get_sb, pass it to logfs_get_sb_...(). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2010-05-07logfs: handle powerfail on NAND flashJoern Engel
The write buffer may not have been written and may no longer be written due to an interrupted write in the affected page. Signed-off-by: Joern Engel <joern@logfs.org>
2010-05-07logfs: handle errors from get_mtd_device()Dan Carpenter
The get_mtd_device() function returns error pointers on failure and if we don't handle it, it leads to a crash. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Joern Engel <joern@logfs.org>
2010-03-04[LogFS] Fix bdev erasesJoern Engel
Erases for block devices were always just emulated by writing 0xff. Some time back the write was removed and only the page cache was changed to 0xff. Superficialy a good idea with two problems: 1. Touching the page cache isn't necessary either. 2. However, writing out 0xff _is_ necessary for the journal. As the journal is scanned linearly, an old non-overwritten commit entry can be used on next mount and cause havoc. This should fix both aspects.
2009-11-20[LogFS] add new flash file systemJoern Engel
This is a new flash file system. See Documentation/filesystems/logfs.txt Signed-off-by: Joern Engel <joern@logfs.org>