aboutsummaryrefslogtreecommitdiffstats
path: root/fs/direct-io.c
diff options
context:
space:
mode:
authorNate Diller <nate.diller@gmail.com>2007-05-09 05:35:07 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-09 15:30:55 -0400
commit01f2705daf5a36208e69d7cf95db9c330f843af6 (patch)
tree2d2c7a042c2466ed985f6e0950450c099f02725f /fs/direct-io.c
parent38a23e311b6cd389b9d8af2ea6c28c8cffbe581c (diff)
fs: convert core functions to zero_user_page
It's very common for file systems to need to zero part or all of a page, the simplist way is just to use kmap_atomic() and memset(). There's actually a library function in include/linux/highmem.h that does exactly that, but it's confusingly named memclear_highpage_flush(), which is descriptive of *how* it does the work rather than what the *purpose* is. So this patchset renames the function to zero_user_page(), and calls it from the various places that currently open code it. This first patch introduces the new function call, and converts all the core kernel callsites, both the open-coded ones and the old memclear_highpage_flush() ones. Following this patch is a series of conversions for each file system individually, per AKPM, and finally a patch deprecating the old call. The diffstat below shows the entire patchset. [akpm@linux-foundation.org: fix a few things] Signed-off-by: Nate Diller <nate.diller@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/direct-io.c')
-rw-r--r--fs/direct-io.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/direct-io.c b/fs/direct-io.c
index d9d0833444f5..8aa2d8b04ef1 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -867,7 +867,6 @@ static int do_direct_IO(struct dio *dio)
867do_holes: 867do_holes:
868 /* Handle holes */ 868 /* Handle holes */
869 if (!buffer_mapped(map_bh)) { 869 if (!buffer_mapped(map_bh)) {
870 char *kaddr;
871 loff_t i_size_aligned; 870 loff_t i_size_aligned;
872 871
873 /* AKPM: eargh, -ENOTBLK is a hack */ 872 /* AKPM: eargh, -ENOTBLK is a hack */
@@ -888,11 +887,8 @@ do_holes:
888 page_cache_release(page); 887 page_cache_release(page);
889 goto out; 888 goto out;
890 } 889 }
891 kaddr = kmap_atomic(page, KM_USER0); 890 zero_user_page(page, block_in_page << blkbits,
892 memset(kaddr + (block_in_page << blkbits), 891 1 << blkbits, KM_USER0);
893 0, 1 << blkbits);
894 flush_dcache_page(page);
895 kunmap_atomic(kaddr, KM_USER0);
896 dio->block_in_file++; 892 dio->block_in_file++;
897 block_in_page++; 893 block_in_page++;
898 goto next_block; 894 goto next_block;