Commit edb5ac89 authored by Yongqiang Yang's avatar Yongqiang Yang Committed by Theodore Ts'o

ext4: let ext4_discard_partial_buffers handle unaligned range correctly

As comment says, we should handle unaligned range rather than aligned
one.  This fixes a bug found by running xfstests #91.
Signed-off-by: default avatarYongqiang Yang <xiaoqiangnk@gmail.com>
parent 5129d05f
...@@ -3206,8 +3206,8 @@ int ext4_discard_partial_page_buffers_no_lock(handle_t *handle, ...@@ -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 * to be updated with the contents of the block before
* we write the zeros on top of it. * we write the zeros on top of it.
*/ */
if (!(from & (blocksize - 1)) || if ((from & (blocksize - 1)) ||
!((from + length) & (blocksize - 1))) { ((from + length) & (blocksize - 1))) {
create_empty_buffers(page, blocksize, 0); create_empty_buffers(page, blocksize, 0);
} else { } else {
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment