Skip to content

Commit

Permalink
Use zero_user_page() in ext4 where possible
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
  • Loading branch information
Eric Sandeen authored and Theodore Ts'o committed Jul 18, 2007
1 parent f8628a1 commit fc0e15a
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1766,7 +1766,6 @@ int ext4_block_truncate_page(handle_t *handle, struct page *page,
struct inode *inode = mapping->host;
struct buffer_head *bh;
int err = 0;
void *kaddr;

blocksize = inode->i_sb->s_blocksize;
length = blocksize - (offset & (blocksize - 1));
Expand All @@ -1778,10 +1777,7 @@ int ext4_block_truncate_page(handle_t *handle, struct page *page,
*/
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;
}
Expand Down Expand Up @@ -1834,10 +1830,7 @@ int ext4_block_truncate_page(handle_t *handle, struct page *page,
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");

Expand Down

0 comments on commit fc0e15a

Please sign in to comment.