• Andrew Morton's avatar
    [PATCH] Use kmap_atomic() for generic_file_write() · 86ee4c5d
    Andrew Morton authored
    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.
    86ee4c5d
inode.c 83.4 KB