aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2007-07-18 09:20:44 -0400
committerTheodore Ts'o <tytso@mit.edu>2007-07-18 09:20:44 -0400
commitfc0e15a667121e02686cc52679f6272959fb60cc (patch)
tree1390b806b6286166f486e03726de32c47c3811fa
parentf8628a14a27eb4512a1ede43de1d9db4d9f92bc3 (diff)
Use zero_user_page() in ext4 where possible
Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--fs/ext4/inode.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index f6d8528c4f55..125aca714685 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1766,7 +1766,6 @@ int ext4_block_truncate_page(handle_t *handle, struct page *page,
1766 struct inode *inode = mapping->host; 1766 struct inode *inode = mapping->host;
1767 struct buffer_head *bh; 1767 struct buffer_head *bh;
1768 int err = 0; 1768 int err = 0;
1769 void *kaddr;
1770 1769
1771 blocksize = inode->i_sb->s_blocksize; 1770 blocksize = inode->i_sb->s_blocksize;
1772 length = blocksize - (offset & (blocksize - 1)); 1771 length = blocksize - (offset & (blocksize - 1));
@@ -1778,10 +1777,7 @@ int ext4_block_truncate_page(handle_t *handle, struct page *page,
1778 */ 1777 */
1779 if (!page_has_buffers(page) && test_opt(inode->i_sb, NOBH) && 1778 if (!page_has_buffers(page) && test_opt(inode->i_sb, NOBH) &&
1780 ext4_should_writeback_data(inode) && PageUptodate(page)) { 1779 ext4_should_writeback_data(inode) && PageUptodate(page)) {
1781 kaddr = kmap_atomic(page, KM_USER0); 1780 zero_user_page(page, offset, length, KM_USER0);
1782 memset(kaddr + offset, 0, length);
1783 flush_dcache_page(page);
1784 kunmap_atomic(kaddr, KM_USER0);
1785 set_page_dirty(page); 1781 set_page_dirty(page);
1786 goto unlock; 1782 goto unlock;
1787 } 1783 }
@@ -1834,10 +1830,7 @@ int ext4_block_truncate_page(handle_t *handle, struct page *page,
1834 goto unlock; 1830 goto unlock;
1835 } 1831 }
1836 1832
1837 kaddr = kmap_atomic(page, KM_USER0); 1833 zero_user_page(page, offset, length, KM_USER0);
1838 memset(kaddr + offset, 0, length);
1839 flush_dcache_page(page);
1840 kunmap_atomic(kaddr, KM_USER0);
1841 1834
1842 BUFFER_TRACE(bh, "zeroed end of block"); 1835 BUFFER_TRACE(bh, "zeroed end of block");
1843 1836