History log of /drivers/mtd/devices/block2mtd.c
Revision Date Author Comments
ea6d833a3fddcd1d60414d48f34c7f4fbe88608f 06-Mar-2014 Fabian Frederick <fabf@skynet.be> mtd: block2mtd: check device size

fixme applied : check device size is a multiple of erasesize.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
4bed207cd0b2805b0afa3835a0803d2eb27cbc9e 25-Jan-2014 Fabian Frederick <fabf@skynet.be> mtd: block2mtd: Add mutex_destroy

mutex_destroy added on each device in block2mtd_exit and add_device failure

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
f83c3838b9146b891d0405d3a83660e8f6aed02f 13-Oct-2013 Ezequiel Garcia <ezequiel.garcia@free-electrons.com> mtd: Move major number definitions to major.h

This patch moves the char and block major number definitions
to major.h to be with the rest of the major numbers.
While doing this, include major.h in the files that need it.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
a1c06609b37c304c58f6d1d3b8e987edaf3391f3 19-Apr-2013 Joe Perches <joe@perches.com> mtd: Convert logging messages

Use a more current logging style.

Convert homegrown ERROR/INFO macros to pr_<level>.
Convert homegrown parse_err macros to pr_err and
expand hidden flow control.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
031da73fca29ebba3eea5a512746e01d52e542cd 12-Dec-2012 NeilBrown <neilb@suse.de> mtd: block2mtd: throttle writes by calling balance_dirty_pages_ratelimited.

If you create a block2mtd device that is larger than main memory,
and write to all of it, then lots of pages will be dirtied but
they will never be flushed out as nothing calls any variant of
balance_dirty_pages.

It would be nice to call set_page_dirty_balance(), but that isn't exported,
so just call balance_dirty_pages_ratelimited() directly.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
810b7e060c14110d8f580daaf77fab3a7d950483 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> mtd: remove use of __devexit

CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2e24e32e2759348c9290404abad4f729f791bfad 24-May-2012 Gabor Juhos <juhosg@openwrt.org> mtd: block2mtd: fix recursive call of mtd_writev

The 'mtd_writev' interface calls the function assigned
to the '_write' field of a given mtd device if that is
not NULL. The block2mtd driver sets the '_writev' field
to the 'mtd_writev' function itself and thus causes a
endless loop.

This is caused by 1dbebd32562b3c2caeca35960e5cb00bfcc12900
(mtd: harmonize mtd_writev usage).

Remove the assignment from the block2mtd driver to fix the
issue.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Cc: stable@kernel.org [3.3+]
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
39a5d0b93c244f40ee2e1502e4870685b7dcc1fa 23-Apr-2012 Ryosuke Saito <raitosyo@gmail.com> mtd: block2mtd: page_read() never returns NULL

page_read() never returns NULL, so we can remove the NULL check here.

Signed-off-by: Ryosuke Saito <raitosyo@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
bcb1d238716d138c9e16347fc32b3c1ae006339e 06-Feb-2012 Artem Bityutskiy <artem.bityutskiy@linux.intel.com> mtd: move zero length verification to MTD API functions

In many places in drivers we verify for the zero length, but this is very
inconsistent across drivers. This is obviously the right thing to do, though.
This patch moves the check to the MTD API functions instead and removes a lot
of duplication.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Reviewed-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
834247ec7e281dee839fe4a04bc1bbf0c7395172 05-Feb-2012 Artem Bityutskiy <artem.bityutskiy@linux.intel.com> mtd: remove retlen zeroing duplication

The MTD API function now zero the 'retlen' parameter before calling
the driver's method — do not do this again in drivers. This removes
duplicated '*retlen = 0' assignent from the following methods:

'mtd_point()'
'mtd_read()'
'mtd_write()'
'mtd_writev()'
'mtd_panic_write()'

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
5def48982b778aaebe201f85af7170b7d0a6619f 03-Feb-2012 Artem Bityutskiy <artem.bityutskiy@linux.intel.com> mtd: do not duplicate length and offset checks in drivers

We already verify that offset and length are within the MTD device size
in the MTD API functions. Let's remove the duplicated checks in drivers.
This patch only affects the following API's:

'mtd_erase()'
'mtd_point()'
'mtd_unpoint()'
'mtd_get_unmapped_area()'
'mtd_read()'
'mtd_write()'
'mtd_panic_write()'
'mtd_lock()'
'mtd_unlock()'
'mtd_is_locked()'
'mtd_block_isbad()'
'mtd_block_markbad()'

This patch adds a bit of noise by removing too sparse empty lines, but this is
not too bad.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
b604387411ec6a072e95910099262616edd2bd2f 03-Feb-2012 Artem Bityutskiy <artem.bityutskiy@linux.intel.com> mtd: block2mtd: initialize writebufsize

The writebufsize concept was introduce by commit
"0e4ca7e mtd: add writebufsize field to mtd_info struct" and it represents
the maximum amount of data the device writes to the media at a time. This is
an important parameter for UBIFS which is used during recovery and which
basically defines how big a corruption caused by a power cut can be.

However, we forgot to set this parameter for block2mtd. Set it to PAGE_SIZE
because this is actually the amount of data we write at a time.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Acked-by: Joern Engel <joern@lazybastard.org>
Cc: stable@kernel.org [2.6.38+]
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
3c3c10bba1e4ccb75b41442e45c1a072f6cded19 30-Jan-2012 Artem Bityutskiy <artem.bityutskiy@linux.intel.com> mtd: add leading underscore to all mtd functions

This patch renames all MTD functions by adding a "_" prefix:

mtd->erase -> mtd->_erase
mtd->read_oob -> mtd->_read_oob
...

The reason is that we are re-working the MTD API and from now on it is
an error to use MTD function pointers directly - we have a corresponding
API call for every pointer. By adding a leading "_" we achieve the following:

1. Make sure we convert every direct pointer users
2. A leading "_" suggests that this interface is internal and it becomes
less likely that people will use them directly
3. Make sure all the out-of-tree modules stop compiling and the owners
spot the big API change and amend them.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1dbebd32562b3c2caeca35960e5cb00bfcc12900 30-Dec-2011 Artem Bityutskiy <artem.bityutskiy@linux.intel.com> mtd: harmonize mtd_writev usage

This patch makes the 'mtd_writev()' function more usable and logical. We first
teach it to fall-back to the 'default_mtd_writev()' function if the MTD driver
does not define its own '->writev()' method. Then we make block2mtd and JFFS2
just 'mtd_writev()' instead of 'default_mtd_writev()' function. This means we
can now stop exporting 'default_mtd_writev()' and instead, export
'mtd_writev()'. This is much cleaner and more logical, as well as allows us to
get read of another direct 'mtd->writev' access in JFFS2.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
ff01bb4832651c6d25ac509a06a10fcbd75c461c 16-Sep-2011 Al Viro <viro@zeniv.linux.org.uk> fs: move code out of buffer.c

Move invalidate_bdev, block_sync_page into fs/block_dev.c. Export
kill_bdev as well, so brd doesn't have to open code it. Reduce
buffer_head.h requirement accordingly.

Removed a rather large comment from invalidate_bdev, as it looked a bit
obsolete to bother moving. The small comment replacing it says enough.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
ee0e87b174bb41f0310cf089262bf5dd8f95a212 23-May-2011 Jamie Iles <jamie@jamieiles.com> mtd: convert remaining users to mtd_device_register()

The older add_mtd_device()/add_mtd_partitions() and their removal
counterparts will soon be gone. Replace uses with mtd_device_register()
and mtd_device_unregister().

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
25985edcedea6396277003854657b5f3cb31a628 31-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi> Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
d4d77629953eabd3c14f6fa5746f6b28babfc55f 13-Nov-2010 Tejun Heo <tj@kernel.org> block: clean up blkdev_get() wrappers and their users

After recent blkdev_get() modifications, open_by_devnum() and
open_bdev_exclusive() are simple wrappers around blkdev_get().
Replace them with blkdev_get_by_dev() and blkdev_get_by_path().

blkdev_get_by_dev() is identical to open_by_devnum().
blkdev_get_by_path() is slightly different in that it doesn't
automatically add %FMODE_EXCL to @mode.

All users are converted. Most conversions are mechanical and don't
introduce any behavior difference. There are several exceptions.

* btrfs now sets FMODE_EXCL in btrfs_device->mode, so there's no
reason to OR it explicitly on blkdev_put().

* gfs2, nilfs2 and the generic mount_bdev() now set FMODE_EXCL in
sb->s_mode.

* With the above changes, sb->s_mode now always should contain
FMODE_EXCL. WARN_ON_ONCE() added to kill_block_super() to detect
errors.

The new blkdev_get_*() functions are with proper docbook comments.
While at it, add function description to blkdev_get() too.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Philipp Reisner <philipp.reisner@linbit.com>
Cc: Neil Brown <neilb@suse.de>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Joern Engel <joern@lazybastard.org>
Cc: Chris Mason <chris.mason@oracle.com>
Cc: Jan Kara <jack@suse.cz>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: KONISHI Ryusuke <konishi.ryusuke@lab.ntt.co.jp>
Cc: reiserfs-devel@vger.kernel.org
Cc: xfs-masters@oss.sgi.com
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
e525fd89d380c4a94c0d63913a1dd1a593ed25e7 13-Nov-2010 Tejun Heo <tj@kernel.org> block: make blkdev_get/put() handle exclusive access

Over time, block layer has accumulated a set of APIs dealing with bdev
open, close, claim and release.

* blkdev_get/put() are the primary open and close functions.

* bd_claim/release() deal with exclusive open.

* open/close_bdev_exclusive() are combination of open and claim and
the other way around, respectively.

* bd_link/unlink_disk_holder() to create and remove holder/slave
symlinks.

* open_by_devnum() wraps bdget() + blkdev_get().

The interface is a bit confusing and the decoupling of open and claim
makes it impossible to properly guarantee exclusive access as
in-kernel open + claim sequence can disturb the existing exclusive
open even before the block layer knows the current open if for another
exclusive access. Reorganize the interface such that,

* blkdev_get() is extended to include exclusive access management.
@holder argument is added and, if is @FMODE_EXCL specified, it will
gain exclusive access atomically w.r.t. other exclusive accesses.

* blkdev_put() is similarly extended. It now takes @mode argument and
if @FMODE_EXCL is set, it releases an exclusive access. Also, when
the last exclusive claim is released, the holder/slave symlinks are
removed automatically.

* bd_claim/release() and close_bdev_exclusive() are no longer
necessary and either made static or removed.

* bd_link_disk_holder() remains the same but bd_unlink_disk_holder()
is no longer necessary and removed.

* open_bdev_exclusive() becomes a simple wrapper around lookup_bdev()
and blkdev_get(). It also has an unexpected extra bdev_read_only()
test which probably should be moved into blkdev_get().

* open_by_devnum() is modified to take @holder argument and pass it to
blkdev_get().

Most of bdev open/close operations are unified into blkdev_get/put()
and most exclusive accesses are tested atomically at the open time (as
it should). This cleans up code and removes some, both valid and
invalid, but unnecessary all the same, corner cases.

open_bdev_exclusive() and open_by_devnum() can use further cleanup -
rename to blkdev_get_by_path() and blkdev_get_by_devt() and drop
special features. Well, let's leave them for another day.

Most conversions are straight-forward. drbd conversion is a bit more
involved as there was some reordering, but the logic should stay the
same.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Neil Brown <neilb@suse.de>
Acked-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Acked-by: Mike Snitzer <snitzer@redhat.com>
Acked-by: Philipp Reisner <philipp.reisner@linbit.com>
Cc: Peter Osterlund <petero2@telia.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <joel.becker@oracle.com>
Cc: Alex Elder <aelder@sgi.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: dm-devel@redhat.com
Cc: drbd-dev@lists.linbit.com
Cc: Leo Chen <leochen@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Cc: Chris Mason <chris.mason@oracle.com>
Cc: Steven Whitehouse <swhiteho@redhat.com>
Cc: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Cc: Joern Engel <joern@logfs.org>
Cc: reiserfs-devel@vger.kernel.org
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
731edacb7567c15f25b1fccac18a203bd432ae5e 13-Nov-2010 Tejun Heo <tj@kernel.org> mtd: fix bdev exclusive open bugs in block2mtd::add_device()

There are two bdev exclusive open bugs.

* open_bdev_exclusive() must not be called with NULL holder. Use dev
as the holder.

* open_by_devnum() doesn't open the bdev exclusively but
block2mtd_free_device() always assumes it. Explicitly claim the
bdev.

The latter is rather clumsy but will be simplified with future
blkdev_get/put() cleanups.

- Updated to use local variable @mode to cache FMODE_* masks as
suggested by Artem Bityutskiy.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: linux-mtd@lists.infradead.org
Cc: Artem Bityutskiy <dedekind1@gmail.com>
89a82280a8e632b7a5b0ce70dd5bccfa2d3bc2c5 22-Oct-2010 Nicolas Kaiser <nikai@nikai.net> block2mtd: dubious assignment

When block2mtd_erase fails, a duplicated assignment instantly
changes instr->state from MTD_ERASE_FAILED to MTD_ERASE_DONE.

It looks to me like this might not be intended, or is it?

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Acked-By: Joern Engel <joern@logfs.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
5a0e3ad6af8660be21ca98a971cd00f331318c05 24-Mar-2010 Tejun Heo <tj@kernel.org> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
4d682420cead1ce06d8cd44ae193414404f0e7f5 10-Mar-2010 Julia Lawall <julia@diku.dk> mtd: block2mtd: Use kasprintf

kasprintf combines kmalloc and sprintf, and takes care of the size
calculation itself.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression a,flag;
expression list args;
statement S;
@@

a =
- \(kmalloc\|kzalloc\)(...,flag)
+ kasprintf(flag,args)
<... when != a
if (a == NULL || ...) S
...>
- sprintf(a,args);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
30c40d2c01f68c7eb1a41ab3552bdaf5dbf300d4 23-Feb-2008 Al Viro <viro@zeniv.linux.org.uk> [PATCH] propagate mode through open_bdev_excl/close_bdev_excl

replace open_bdev_excl/close_bdev_excl with variants taking fmode_t.
superblock gets the value used to mount it stored in sb->s_mode

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
eadcf0d704a46979c29984fa05f1fc413c775bcb 02-Jul-2008 Greg Kroah-Hartman <gregkh@suse.de> MTD: handle pci_name() being const

This changes the MTD core to handle pci_name() now returning a constant
string.

Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
59018b6d2acabb114ab58637e6ab95ba424a89d0 20-May-2008 Adrian Bunk <bunk@kernel.org> MTD/JFFS2: remove CVS keywords

Once upon a time, the MTD repository was using CVS.

This patch therefore removes all usages of the no longer updated CVS
keywords from the MTD code.

This also includes code that printed them to the user.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
0bc88c59cc2f031a38ad5902d5764497549217c5 18-Apr-2008 Stephane Chazelas <stephane.chazelas@emerson.com> [MTD] block2mtd: logging typo fixes

Address a number of small issues mainly regarding the output made by this
driver to dmesg:

- Some of the blkmtd's had not been changed to block2mtd which caused
display problem

- the parse_err() macro was displaying "block2mtd: " twice

Signed-off-by: Stéphane Chazelas <stephane.chazelas@emerson.com>
Acked-by: Jörn Engel <joern@lazybastard.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2875fb65f8e40401c4b781ebc5002df10485f635 24-Mar-2008 Ingo van Lil <inguin@gmx.de> mtd: memory corruption in block2mtd.c

The block2mtd driver (drivers/mtd/devices/block2mtd.c) will kfree an on-stack
pointer when handling an invalid argument line (e.g.
block2mtd=/dev/loop0,xxx).

The kfree was added some time ago when "name" was dynamically allocated.

Signed-off-by: Ingo van Lil <inguin@gmx.de>
Acked-by: Joern Engel <joern@lazybastard.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: <stable@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2b54aaef7a3a77f208bc14f576010da4fb8dfe29 06-Feb-2008 Joern Engel <joern@lazybastard.org> Claim maintainership for block2mtd and update email addresses

I have been prime author and maintainer of block2mtd from day one, but
neither MAINTAINERS nor the module source makes this fact clear. And while
I'm at it, update my email addresses tree-wide, as the old address
currently bounces and change my name to "joern" as unicode will likely
continue to cause trouble until the end of this century.

Signed-off-by: Joern Engel <joern@lazybastard.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6fe6900e1e5b6fa9e5c59aa5061f244fe3f467e2 06-May-2007 Nick Piggin <npiggin@suse.de> mm: make read_cache_page synchronous

Ensure pages are uptodate after returning from read_cache_page, which allows
us to cut out most of the filesystem-internal PageUptodate calls.

I didn't have a great look down the call chains, but this appears to fixes 7
possible use-before uptodate in hfs, 2 in hfsplus, 1 in jfs, a few in
ecryptfs, 1 in jffs2, and a possible cleared data overwritten with readpage in
block2mtd. All depending on whether the filler is async and/or can return
with a !uptodate page.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Cc: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
4839f0481d8b985aabd6653ba42cf09e2abcc2bd 02-May-2007 Adrian Bunk <bunk@stusta.de> [MTD] block2mtd_paramline[] mustn't be __initdata

block2mtd_paramline[] is used in the non-__init block2mtd_setup()

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Acked-by: Joern Engel <joern@lazybastard.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
21d31f1f7c8f832324fb55eb4b1397b16258904e 20-Feb-2007 Joern Engel <joern@wh.fh-wedel.de> [PATCH] [MTD] block2mtd: remove readahead code

Over the years there was a slow trickle of complaints against the readahead
code. Most of them concerned performance, Peter Zijlstra stumbled over it
when working unrelated changes and I believe there was an actual bug report.
Oh, Andrew Morton also complained about duplicating code from mm/readahead.c.

It is just not worth it. On flash media like usb sticks, readahead will
make things go slow - very slow. On spinning disks, readahead may be a
win, but this is definitely not the place to add it.

Signed-off-by: Jörn Engel <joern@lazybastard.org>
8870530a4053add56a2c0eb90a3669facb9f7117 20-Feb-2007 Joern Engel <joern@wh.fh-wedel.de> [PATCH] [MTD] block2mtd: remove warning

drivers/mtd/devices/block2mtd.c:311:9: warning: symbol 'dev' shadows an earlier one
drivers/mtd/devices/block2mtd.c:294:23: originally declared here

Signed-off-by: Jörn Engel <joern@lazybastard.org>
0ffb74ccc06a112042adfaf8229684b78202bcae 20-Feb-2007 Joern Engel <joern@wh.fh-wedel.de> [PATCH] [MTD] block2mtd: remove casts

Remove two casts - they were not only pointless, but outright harmful.

Spotted by Felix Fietkau <nbd@openwrt.org>

Signed-off-by: Jörn Engel <joern@lazybastard.org>
fc0ecff698165ae8e178efa086e0dd1f385206b1 10-Feb-2007 Andrew Morton <akpm@osdl.org> [PATCH] remove invalidate_inode_pages()

Convert all calls to invalidate_inode_pages() into open-coded calls to
invalidate_mapping_pages().

Leave the invalidate_inode_pages() wrapper in place for now, marked as
deprecated.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
95b93a0cd46682c6d9e8eea803fda510cb6b863a 15-Nov-2006 Burman Yan <yan_952@hotmail.com> [MTD] replace kmalloc+memset with kzalloc

Signed-off-by: Yan Burman <yan_952@hotmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
c4e7fb313771ac03dfdca26d30e8b721731c562b 13-Jul-2006 Ville Herva <vherva@vianova.fi> block2mtd.c: Make kernel boot command line arguments work (try 4)

Trying to pass kernel command line arguments to block2mtd at boot-time does
not work currently. block2mtd_setup() is called so early that kmalloc()
fails nevermind being able to do open_bdev_excl() (which requires rootfs to
be mounted. This patch only saves the option string at the early boot stage,
and parses them later when block2mtd_init() is called. If open_bdev_excl()
fails, open_by_devnum(name_to_dev_t()) is tried instead, which makes it
possible to initialize the driver before rootfs has been mounted. Also gets
rid of the superfluous parse_name() that only checks if name is longer than
80 chars and copies it to a string that is not kfreed.

With this patch, I can boot statically compiled block2mtd, and mount jffs2
as rootfs (without modules or initrd), with lilo config like this:

root=/dev/mtdblock0
append="rootfstype=jffs2 block2mtd.block2mtd=/dev/hdc2,65536"

(Note that rootfstype=jffs2 is required, since the kernel only tries
filesystems without "nodev" attribute by default, and jffs is "nodev").

Compared to first version of this patch, this one does not copy the
parameters to the global buffer if init has already been called, and the
global array is marked as __initdata.

Compared to the second version of this patch, module build is fixed.

Compared to the third version of this patch, statically compiled block2mtd
driver with no boot-time parameter no longer gives spurious error 'cannot
open device ""'

Signed-off-by: Ville Herva <vherva@vianova.fi>
Acked-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6ab3d5624e172c553004ecc862bfeac16d9d68b7 30-Jun-2006 Jörn Engel <joern@wohnheim.fh-wedel.de> Remove obsolete #include <linux/config.h>

Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
17ffc7ba6d7ea68b8d5f55a5ca1b87163e69720d 22-Jun-2006 Artem B. Bityutskiy <dedekind@sauron.oktetlabs.ru> [MTD] Initialize 'writesize'

Signed-off-by: Artem B. Bityutskiy <dedekind@infradead.org>
21c8db9eff95260e543535dfc6f27164c4c0c0ff 14-Jun-2006 David Woodhouse <dwmw2@infradead.org> [MTD] Restore MTD_ROM and MTD_RAM types

Let's not attempt the abolition of mtd->type until/unless it's properly
thought through. And certainly, let's not do it by halves.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
92cbfdcc3661d7670b01b92b89811cd3a2412297 30-May-2006 Joern Engel <joern@wh.fh-wedel.de> [MTD] replace MTD_RAM with MTD_GENERIC_TYPE

Ram devices get the extra capability of MTD_NO_ERASE - not requiring
an explicit erase before writing to it. Currently only mtdblock uses
this capability. Rest of the patch is a simple text replacement.

Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
8546ac4f84b252fff078fab1a992c70504147914 25-May-2006 Thomas Gleixner <tglx@cruncher.tec.linutronix.de> [MTD] Remove the only useless readv implementation

Removing readv from struct mtd_info broke block2mtd. Remove the
reference and the useless default implementation.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
151e76590f66f5406eb2e1f4270c5323f385d2e8 14-May-2006 David Woodhouse <dwmw2@infradead.org> [MTD] Fix legacy character sets throughout drivers/mtd, include/linux/mtd

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
a6550e57f9d074511cf420bdb802ab5e56edc3bb 14-May-2006 Jesper Juhl <jesper.juhl@gmail.com> mtd: fix memory leak in block2mtd_setup()

There's a mem leak in drivers/mtd/devices/block2mtd.c::block2mtd_setup()

We can leak 'name' allocated with kmalloc in 'parse_name' if leave via
the 'parse_err' macro since it contains a return but doesn't do any
freeing.

Spotted by coverity checker as bug 615.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
954c24227318c166ec1925e1229db442e1f56f51 19-Apr-2006 Joern Engel <joern@wohnheim.fh-wedel.de> mtd: improve parameter parsing for block2mtd

Expand the parameter parsing for block2mtd. It now accepts:
Ki, Mi, Gi - the official prefixes for binary multiples,
see http://physics.nist.gov/cuu/Units/binary.html,
ki - mistake on my side and analog to "k" for decimal multiples,
KiB, MiB, GiB - for people that prefer to add a "B" for byte,
kiB - combination of the above.

There were complaints about not accepting "k" for 1024. This has long
been common practice, but is known to lead to confusion. Hence the new
SI units and hence block2mtd only accepts units that cannot be confused
with decimal units. Diverging from common practice doesn't always please
people, even if the change is for the better.

Signed-off-by: Joern Engel <joern@wohnheim.fh-wedel.de>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
48b192686dd20cb1576ae1d8ccd17a07971ef24a 31-Mar-2006 Ingo Molnar <mingo@elte.hu> [PATCH] sem2mutex: drivers/mtd/

Semaphore to mutex conversion.

The conversion was generated via scripts, and the result was validated
automatically via a script as well.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Acked-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2b9175c174b83b8d97db9398efe948fa9092938f 29-Nov-2005 Adrian Bunk <bunk@stusta.de> [MTD] Make functions static, include header files with prototypes

This patch contains the following possible cleanups:
- every file should #include the headers containing the prototypes for
it's global functions
- make needlessly global functions static

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
e5580fbe8a950131b9ccccce0f962811dfb9ef43 07-Nov-2005 Thomas Gleixner <tglx@linutronix.de> [MTD] devices: Clean up trailing white spaces

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
cc71229ff345a32d1b3de370a257dac62986b187 19-Mar-2005 Thomas Gleixner <tglx@linutronix.de> [MTD] block2mtd: Fix incompatible pointer type

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
711c11b78d00c0652d38893c558a2bcca55d96d4 07-Mar-2005 Joern Engel <joern@wohnheim.fh-wedel.de> [MTD] block2mtd: Remove copyright. Fix offset calculation

- Remove Gareth from the Copyrights (at his own request)
- Fix the "fscking embarrassment"

Signed-off-by: Joern Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 17-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org> Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!