From: Nate Diller <nate.diller@gmail.com>
To: Andrew Morton <akpm@osdl.org>, Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH 5/13] ext4: use zero_user_page
Date: Tue, 10 Apr 2007 20:36:00 -0700 [thread overview]
Message-ID: <20070411033600.11000.54035.patchbomb.py@localhost> (raw)
In-Reply-To: <20070411033600.11000.38285.patchbomb.py@localhost>
Use zero_user_page() instead of open-coding it.
Signed-off-by: Nate Diller <nate.diller@gmail.com>
---
diff -urpN -X dontdiff linux-2.6.21-rc6-mm1/fs/ext4/inode.c linux-2.6.21-rc6-mm1-test/fs/ext4/inode.c
--- linux-2.6.21-rc6-mm1/fs/ext4/inode.c 2007-04-10 17:15:04.000000000 -0700
+++ linux-2.6.21-rc6-mm1-test/fs/ext4/inode.c 2007-04-10 18:33:04.000000000 -0700
@@ -1791,7 +1791,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) &&
@@ -1808,10 +1807,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);
set_page_dirty(page);
goto unlock;
}
@@ -1864,11 +1860,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);
BUFFER_TRACE(bh, "zeroed end of block");
err = 0;
diff -urpN -X dontdiff linux-2.6.21-rc6-mm1/fs/ext4/writeback.c linux-2.6.21-rc6-mm1-test/fs/ext4/writeback.c
--- linux-2.6.21-rc6-mm1/fs/ext4/writeback.c 2007-04-10 18:05:52.000000000 -0700
+++ linux-2.6.21-rc6-mm1-test/fs/ext4/writeback.c 2007-04-10 18:33:04.000000000 -0700
@@ -961,7 +961,6 @@ int ext4_wb_writepage(struct page *page,
loff_t i_size = i_size_read(inode);
pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT;
unsigned offset;
- void *kaddr;
wb_debug("writepage %lu from inode %lu\n", page->index, inode->i_ino);
@@ -1011,10 +1010,7 @@ int ext4_wb_writepage(struct page *page,
* the page size, the remaining memory is zeroed when mapped, and
* writes to that region are not written out to the file."
*/
- 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);
return ext4_wb_write_single_page(page, wbc);
}
@@ -1065,7 +1061,6 @@ int ext4_wb_block_truncate_page(handle_t
struct inode *inode = mapping->host;
struct buffer_head bh, *bhw = &bh;
unsigned blocksize, length;
- void *kaddr;
int err = 0;
wb_debug("partial truncate from %lu on page %lu from inode %lu\n",
@@ -1104,10 +1099,7 @@ int ext4_wb_block_truncate_page(handle_t
}
}
- 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);
SetPageUptodate(page);
__set_page_dirty_nobuffers(page);
next prev parent reply other threads:[~2007-04-11 3:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-11 3:36 [PATCH 1/13] fs: convert core functions to zero_user_page Nate Diller
2007-04-11 3:36 ` [PATCH 8/13] ntfs: use zero_user_page Nate Diller
2007-04-11 3:36 ` [PATCH 6/13] gfs2: " Nate Diller
2007-04-11 3:36 ` [PATCH 7/13] nfs: " Nate Diller
2007-04-11 3:36 ` [PATCH 10/13] reiser4: " Nate Diller
2007-04-11 3:36 ` [PATCH 4/13] ext3: " Nate Diller
2007-04-11 3:36 ` [PATCH 3/13] ecryptfs: " Nate Diller
2007-04-11 3:36 ` Nate Diller [this message]
2007-04-11 4:14 ` [PATCH 5/13] ext4: " Andreas Dilger
2007-04-11 3:36 ` [PATCH 11/13] reiserfs: " Nate Diller
2007-04-11 3:36 ` [PATCH 9/13] ocfs2: " Nate Diller
2007-04-11 3:36 ` [PATCH 12/13] xfs: " Nate Diller
2007-04-11 3:36 ` [PATCH 13/13] fs: deprecate memclear_highpage_flush Nate Diller
2007-04-11 5:58 ` Andrew Morton
2007-04-11 3:36 ` [PATCH 2/13] affs: use zero_user_page Nate Diller
2007-04-11 5:56 ` [PATCH 1/13] fs: convert core functions to zero_user_page Andrew Morton
2007-04-11 6:14 ` Nate Diller
2007-04-11 14:54 ` Jörn Engel
2007-04-11 14:54 ` Jörn Engel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070411033600.11000.54035.patchbomb.py@localhost \
--to=nate.diller@gmail.com \
--cc=akpm@osdl.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.