aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorNate <nate.diler@gmail.com>2007-07-16 11:45:13 -0400
committerSteve French <sfrench@us.ibm.com>2007-07-16 11:45:13 -0400
commit8803863a9051582081fb2bcca3a6dc8fddaed93c (patch)
treed3d8162fd0a77c6e3891edbfc89f365b428b03f9 /fs/cifs
parent4a379e6657ae2dd910f9f06d46bd7c05fbe9ed5c (diff)
[CIFS] use simple_prepare_write to zero page data
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>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/file.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index b67f1da020be..0620feaaea66 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1966,14 +1966,7 @@ static int cifs_prepare_write(struct file *file, struct page *page,
1966 * We don't need to read data beyond the end of the file. 1966 * We don't need to read data beyond the end of the file.
1967 * zero it, and set the page uptodate 1967 * zero it, and set the page uptodate
1968 */ 1968 */
1969 void *kaddr = kmap_atomic(page, KM_USER0); 1969 simple_prepare_write(file, page, from, to);
1970
1971 if (from)
1972 memset(kaddr, 0, from);
1973 if (to < PAGE_CACHE_SIZE)
1974 memset(kaddr + to, 0, PAGE_CACHE_SIZE - to);
1975 flush_dcache_page(page);
1976 kunmap_atomic(kaddr, KM_USER0);
1977 SetPageUptodate(page); 1970 SetPageUptodate(page);
1978 } else if ((file->f_flags & O_ACCMODE) != O_WRONLY) { 1971 } else if ((file->f_flags & O_ACCMODE) != O_WRONLY) {
1979 /* might as well read a page, it is fast enough */ 1972 /* might as well read a page, it is fast enough */