Skip to content

Commit

Permalink
ext4: let ext4_discard_partial_buffers handle unaligned range correctly
Browse files Browse the repository at this point in the history
As comment says, we should handle unaligned range rather than aligned
one.  This fixes a bug found by running xfstests torvalds#91.

Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
  • Loading branch information
xiaoqiangnk authored and tytso committed Oct 31, 2011
1 parent 5129d05 commit edb5ac8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -3206,8 +3206,8 @@ int ext4_discard_partial_page_buffers_no_lock(handle_t *handle,
* to be updated with the contents of the block before
* we write the zeros on top of it.
*/
if (!(from & (blocksize - 1)) ||
!((from + length) & (blocksize - 1))) {
if ((from & (blocksize - 1)) ||
((from + length) & (blocksize - 1))) {
create_empty_buffers(page, blocksize, 0);
} else {
/*
Expand Down

0 comments on commit edb5ac8

Please sign in to comment.