* [PATCH] zero_user_page conversion
@ 2007-06-20 22:08 Eric Sandeen
2007-06-21 0:21 ` Mark Fasheh
2007-06-23 16:51 ` Andrew Morton
0 siblings, 2 replies; 3+ messages in thread
From: Eric Sandeen @ 2007-06-20 22:08 UTC (permalink / raw)
To: linux-kernel Mailing List
Cc: ocfs2-devel, cluster-devel, samba-technical, ext4 development
Use zero_user_page() in cifs, ocfs2, ext4, and gfs2 where possible.
Compile tested, reviews welcome.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Index: linux-2.6.22-rc4-mm2/fs/cifs/inode.c
===================================================================
--- linux-2.6.22-rc4-mm2.orig/fs/cifs/inode.c
+++ linux-2.6.22-rc4-mm2/fs/cifs/inode.c
@@ -1334,17 +1334,13 @@ static int cifs_truncate_page(struct add
pgoff_t index = from >> PAGE_CACHE_SHIFT;
unsigned offset = from & (PAGE_CACHE_SIZE - 1);
struct page *page;
- char *kaddr;
int rc = 0;
page = grab_cache_page(mapping, index);
if (!page)
return -ENOMEM;
- kaddr = kmap_atomic(page, KM_USER0);
- memset(kaddr + offset, 0, PAGE_CACHE_SIZE - offset);
- flush_dcache_page(page);
- kunmap_atomic(kaddr, KM_USER0);
+ zero_user_page(page, offset, PAGE_CACHE_SIZE - offset, KM_USER0);
unlock_page(page);
page_cache_release(page);
return rc;
Index: linux-2.6.22-rc4-mm2/fs/ext4/inode.c
===================================================================
--- linux-2.6.22-rc4-mm2.orig/fs/ext4/inode.c
+++ linux-2.6.22-rc4-mm2/fs/ext4/inode.c
@@ -1830,7 +1830,6 @@ int ext4_block_truncate_page(handle_t *h
struct inode *inode = mapping->host;
struct buffer_head *bh;
int err = 0;
- void *kaddr;
if ((EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) &&
test_opt(inode->i_sb, EXTENTS) &&
@@ -1847,10 +1846,7 @@ int ext4_block_truncate_page(handle_t *h
*/
if (!page_has_buffers(page) && test_opt(inode->i_sb, NOBH) &&
ext4_should_writeback_data(inode) && PageUptodate(page)) {
- kaddr = kmap_atomic(page, KM_USER0);
- memset(kaddr + offset, 0, length);
- flush_dcache_page(page);
- kunmap_atomic(kaddr, KM_USER0);
+ zero_user_page(page, offset, length, KM_USER0);
set_page_dirty(page);
goto unlock;
}
@@ -1903,10 +1899,7 @@ int ext4_block_truncate_page(handle_t *h
goto unlock;
}
- kaddr = kmap_atomic(page, KM_USER0);
- memset(kaddr + offset, 0, length);
- flush_dcache_page(page);
- kunmap_atomic(kaddr, KM_USER0);
+ zero_user_page(page, offset, length, KM_USER0);
BUFFER_TRACE(bh, "zeroed end of block");
Index: linux-2.6.22-rc4-mm2/fs/gfs2/ops_address.c
===================================================================
--- linux-2.6.22-rc4-mm2.orig/fs/gfs2/ops_address.c
+++ linux-2.6.22-rc4-mm2/fs/gfs2/ops_address.c
@@ -207,10 +207,7 @@ static int stuffed_readpage(struct gfs2_
* so we need to supply one here. It doesn't happen often.
*/
if (unlikely(page->index)) {
- kaddr = kmap_atomic(page, KM_USER0);
- memset(kaddr, 0, PAGE_CACHE_SIZE);
- kunmap_atomic(kaddr, KM_USER0);
- flush_dcache_page(page);
+ zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0);
SetPageUptodate(page);
return 0;
}
Index: linux-2.6.22-rc4-mm2/fs/ocfs2/aops.c
===================================================================
--- linux-2.6.22-rc4-mm2.orig/fs/ocfs2/aops.c
+++ linux-2.6.22-rc4-mm2/fs/ocfs2/aops.c
@@ -739,18 +739,13 @@ int ocfs2_map_page_blocks(struct page *p
bh = head;
block_start = 0;
do {
- void *kaddr;
-
block_end = block_start + bsize;
if (block_end <= from)
goto next_bh;
if (block_start >= to)
break;
- kaddr = kmap_atomic(page, KM_USER0);
- memset(kaddr+block_start, 0, bh->b_size);
- flush_dcache_page(page);
- kunmap_atomic(kaddr, KM_USER0);
+ zero_user_page(page, block_start, bh->b_size, KM_USER0);
set_buffer_uptodate(bh);
mark_buffer_dirty(bh);
@@ -895,15 +890,11 @@ static void ocfs2_zero_new_buffers(struc
if (block_end > from && block_start < to) {
if (!PageUptodate(page)) {
unsigned start, end;
- void *kaddr;
start = max(from, block_start);
end = min(to, block_end);
- kaddr = kmap_atomic(page, KM_USER0);
- memset(kaddr+start, 0, end - start);
- flush_dcache_page(page);
- kunmap_atomic(kaddr, KM_USER0);
+ zero_user_page(page, start, end - start, KM_USER0);
set_buffer_uptodate(bh);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] zero_user_page conversion
2007-06-20 22:08 [PATCH] zero_user_page conversion Eric Sandeen
@ 2007-06-21 0:21 ` Mark Fasheh
2007-06-23 16:51 ` Andrew Morton
1 sibling, 0 replies; 3+ messages in thread
From: Mark Fasheh @ 2007-06-21 0:21 UTC (permalink / raw)
To: Eric Sandeen
Cc: linux-kernel Mailing List, ocfs2-devel, cluster-devel,
samba-technical, ext4 development
On Wed, Jun 20, 2007 at 05:08:24PM -0500, Eric Sandeen wrote:
> Use zero_user_page() in cifs, ocfs2, ext4, and gfs2 where possible.
Ok, the ocfs2 bits looked fine so I folded that part of the patch into
ocfs2.git, thanks.
--Mark
--
Mark Fasheh
Senior Software Developer, Oracle
mark.fasheh@oracle.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] zero_user_page conversion
2007-06-20 22:08 [PATCH] zero_user_page conversion Eric Sandeen
2007-06-21 0:21 ` Mark Fasheh
@ 2007-06-23 16:51 ` Andrew Morton
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2007-06-23 16:51 UTC (permalink / raw)
To: Eric Sandeen
Cc: linux-kernel, ocfs2-devel, cluster-devel, samba-technical, linux-ext4
> On Wed, 20 Jun 2007 17:08:24 -0500 Eric Sandeen <sandeen@redhat.com> wrote:
> Use zero_user_page() in cifs, ocfs2, ext4, and gfs2 where possible.
One patch, splattered across four maintainers, each of whom maintain separate
trees.
Sigh. Please, don't. _someone_ has to split this up, and it might as well
not be me.
<splits it up>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-06-23 16:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-20 22:08 [PATCH] zero_user_page conversion Eric Sandeen
2007-06-21 0:21 ` Mark Fasheh
2007-06-23 16:51 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).