]> git.neil.brown.name Git - history.git/commit
[PATCH] Use kmap_atomic() for generic_file_write()
authorAndrew Morton <akpm@digeo.com>
Sun, 8 Sep 2002 05:22:16 +0000 (22:22 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sun, 8 Sep 2002 05:22:16 +0000 (22:22 -0700)
commit86ee4c5d3de53c3b62c1e312777c16760e70a076
tree21a7f9524110427d30880d17a01d7bea48c20828
parent88a3b49083d66d42fec7ae5a5fbbf9fc6b3a9c46
[PATCH] Use kmap_atomic() for generic_file_write()

This patch uses the atomic copy_from_user() facility in
generic_file_write().

This required a change in the prepare_write/commit_write API
definition.  It is no longer the case that these functions will kmap
the page for you.

If any part of the kernel wants to get at the page in the write path,
it now has to kmap it for itself.  The best way to do this is with
kmap_atomic(KM_USER0).

This patch updates all callers.  It also converts several places which
were unnecessarily using kmap() over to using kmap_atomic().

The reiserfs changes here are Oleg Drokin's revised version.

The patch has been tested with loop, ext2, ext3, reiserfs, jfs,
minixfs, vfat, iso9660, nfs and the ramdisk driver.

I haven't fixed the racy deadlock avoidance thing in
generic_file_write() - the case where we take a fault when the source
and dest of the copy are both the same pagecache page.

There is a printk in there now which will trigger if the page was
unexpectedly not present.  And guess what?  I get 50-100 of them when
running `dbench 64' on mem=48m.   This deadlock can happen.
19 files changed:
drivers/block/loop.c
drivers/block/rd.c
fs/affs/file.c
fs/buffer.c
fs/driverfs/inode.c
fs/ext2/dir.c
fs/ext3/inode.c
fs/fat/inode.c
fs/jffs/inode-v23.c
fs/jffs2/file.c
fs/jfs/jfs_metapage.c
fs/minix/dir.c
fs/namei.c
fs/ramfs/inode.c
fs/reiserfs/inode.c
fs/reiserfs/stree.c
fs/reiserfs/tail_conversion.c
fs/sysv/dir.c
mm/filemap.c