diff mbox

[3/3] ext4: let ext4_discard_partial_buffers handle unaligned range correctly

Message ID 1319974203-2625-3-git-send-email-xiaoqiangnk@gmail.com
State Accepted, archived
Headers show

Commit Message

Yongqiang Yang Oct. 30, 2011, 11:30 a.m. UTC
As comment says, we should handle unaligned range rather than aligned
one.

Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
---
 fs/ext4/inode.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

Yongqiang Yang Oct. 30, 2011, 1:36 p.m. UTC | #1
Forgot to say that the bug was found by running xfstests 91.

Thx!

Yongqiang.

On Sun, Oct 30, 2011 at 7:30 PM, Yongqiang Yang <xiaoqiangnk@gmail.com> wrote:
> As comment says, we should handle unaligned range rather than aligned
> one.
>
> Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
> ---
>  fs/ext4/inode.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index e113de8..f97d671 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3209,8 +3209,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 {
>                        /*
> --
> 1.7.5.1
>
>
Theodore Ts'o Oct. 31, 2011, 10:12 p.m. UTC | #2
On Sun, Oct 30, 2011 at 07:30:03PM +0800, Yongqiang Yang wrote:
> As comment says, we should handle unaligned range rather than aligned
> one.
> 
> Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>

Thanks, applied.

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index e113de8..f97d671 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3209,8 +3209,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 {
 			/*