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>
This commit is contained in:
committed by
Linus Torvalds
parent
38a23e311b
commit
01f2705daf
@@ -867,7 +867,6 @@ static int do_direct_IO(struct dio *dio)
|
||||
do_holes:
|
||||
/* Handle holes */
|
||||
if (!buffer_mapped(map_bh)) {
|
||||
char *kaddr;
|
||||
loff_t i_size_aligned;
|
||||
|
||||
/* AKPM: eargh, -ENOTBLK is a hack */
|
||||
@@ -888,11 +887,8 @@ do_holes:
|
||||
page_cache_release(page);
|
||||
goto out;
|
||||
}
|
||||
kaddr = kmap_atomic(page, KM_USER0);
|
||||
memset(kaddr + (block_in_page << blkbits),
|
||||
0, 1 << blkbits);
|
||||
flush_dcache_page(page);
|
||||
kunmap_atomic(kaddr, KM_USER0);
|
||||
zero_user_page(page, block_in_page << blkbits,
|
||||
1 << blkbits, KM_USER0);
|
||||
dio->block_in_file++;
|
||||
block_in_page++;
|
||||
goto next_block;
|
||||
|
Reference in New Issue
Block a user