From: Yongqiang Yang Date: Mon, 31 Oct 2011 22:04:38 +0000 (-0400) Subject: ext4: let ext4_discard_partial_buffers handle unaligned range correctly X-Git-Tag: next-20111101~64^2~3 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=5cbf68d1a543a052b3f81741970aa0e82e57ce9a;p=karo-tx-linux.git 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: Yongqiang Yang --- diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 5fcef98f98e5..de05e86f1993 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -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 { /*