]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[CIFS] use simple_prepare_write to zero page data
authorNate <nate.diler@gmail.com>
Mon, 16 Jul 2007 15:45:13 +0000 (15:45 +0000)
committerSteve French <sfrench@us.ibm.com>
Mon, 16 Jul 2007 15:45:13 +0000 (15:45 +0000)
It's common for file systems to need to zero data on either side of a
write, if a page is not Uptodate during prepare_write.  It just so happens
that simple_prepare_write() in libfs.c does exactly that, so we can avoid
duplication and just call that function to zero page data.

Signed-off-by: Nate Diller <nate.diller@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/file.c

index b67f1da020be1d33003ae90ff70d7e6c964117b8..0620feaaea66afc48b7858385c83c7e4a97e30e3 100644 (file)
@@ -1966,14 +1966,7 @@ static int cifs_prepare_write(struct file *file, struct page *page,
                 * We don't need to read data beyond the end of the file.
                 * zero it, and set the page uptodate
                 */
-               void *kaddr = kmap_atomic(page, KM_USER0);
-
-               if (from)
-                       memset(kaddr, 0, from);
-               if (to < PAGE_CACHE_SIZE)
-                       memset(kaddr + to, 0, PAGE_CACHE_SIZE - to);
-               flush_dcache_page(page);
-               kunmap_atomic(kaddr, KM_USER0);
+               simple_prepare_write(file, page, from, to);
                SetPageUptodate(page);
        } else if ((file->f_flags & O_ACCMODE) != O_WRONLY) {
                /* might as well read a page, it is fast enough */