Commit b084fe4b authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] kmap->kmap_atomic in mpage.c

Replace some kmaps in mpage.c with kmap_atomic.
parent deda1b5e
......@@ -210,10 +210,11 @@ do_mpage_readpage(struct bio *bio, struct page *page, unsigned nr_pages,
}
if (first_hole != blocks_per_page) {
memset(kmap(page) + (first_hole << blkbits), 0,
char *kaddr = kmap_atomic(page, KM_USER0);
memset(kaddr + (first_hole << blkbits), 0,
PAGE_CACHE_SIZE - (first_hole << blkbits));
flush_dcache_page(page);
kunmap(page);
kunmap_atomic(kaddr, KM_USER0);
if (first_hole == 0) {
SetPageUptodate(page);
unlock_page(page);
......@@ -427,12 +428,14 @@ mpage_writepage(struct bio *bio, struct page *page, get_block_t get_block,
end_index = inode->i_size >> PAGE_CACHE_SHIFT;
if (page->index >= end_index) {
unsigned offset = inode->i_size & (PAGE_CACHE_SIZE - 1);
char *kaddr;
if (page->index > end_index || !offset)
goto confused;
memset(kmap(page) + offset, 0, PAGE_CACHE_SIZE - offset);
kaddr = kmap_atomic(page, KM_USER0);
memset(kaddr + offset, 0, PAGE_CACHE_SIZE - offset);
flush_dcache_page(page);
kunmap(page);
kunmap_atomic(kaddr, KM_USER0);
}
page_is_mapped:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment