Skip to content

Commit

Permalink
Revert "ext4: fix fsx truncate failure"
Browse files Browse the repository at this point in the history
This reverts commit 189e868.

This commit reintroduces the use of ext4_block_truncate_page() in ext4
truncate operation instead of ext4_discard_partial_page_buffers().

The statement in the commit description that the truncate operation only
zero block unaligned portion of the last page is not exactly right,
since truncate_pagecache_range() also zeroes and invalidate the unaligned
portion of the page. Then there is no need to zero and unmap it once more
and ext4_block_truncate_page() was doing the right job, although we
still need to update the buffer head containing the last block, which is
exactly what ext4_block_truncate_page() is doing.

Moreover the problem described in the commit is fixed more properly with
commit

1529116
	jbd2: clear BH_Delay & BH_Unwritten in journal_unmap_buffer

This was tested on ppc64 machine with block size of 1024 bytes without
any problems.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
  • Loading branch information
Lukas Czerner authored and Theodore Ts'o committed May 28, 2013
1 parent 0713ed0 commit eb3544c
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 @@ -3938,7 +3938,6 @@ void ext4_truncate(struct inode *inode)
unsigned int credits;
handle_t *handle;
struct address_space *mapping = inode->i_mapping;
loff_t page_len;

/*
* There is a possibility that we're either freeing the inode
Expand Down Expand Up @@ -3982,14 +3981,8 @@ void ext4_truncate(struct inode *inode)
return;
}

if (inode->i_size % PAGE_CACHE_SIZE != 0) {
page_len = PAGE_CACHE_SIZE -
(inode->i_size & (PAGE_CACHE_SIZE - 1));

if (ext4_discard_partial_page_buffers(handle,
mapping, inode->i_size, page_len, 0))
goto out_stop;
}
if (inode->i_size & (inode->i_sb->s_blocksize - 1))
ext4_block_truncate_page(handle, mapping, inode->i_size);

/*
* We add the inode to the orphan list, so that if this
Expand Down

0 comments on commit eb3544c

Please sign in to comment.