linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] ext4: move variables to its scope
@ 2011-10-30 11:30 Yongqiang Yang
  2011-10-30 11:30 ` [PATCH 2/3] ext4: return ENOMEM if find_or_create_pages fails Yongqiang Yang
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Yongqiang Yang @ 2011-10-30 11:30 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4, Yongqiang Yang


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

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index e4b26fa..3c4a9d5 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3182,7 +3182,6 @@ int ext4_discard_partial_page_buffers_no_lock(handle_t *handle,
 	ext4_fsblk_t index = from >> PAGE_CACHE_SHIFT;
 	unsigned int offset = from & (PAGE_CACHE_SIZE-1);
 	unsigned int blocksize, max, pos;
-	unsigned int end_of_block, range_to_discard;
 	ext4_lblk_t iblock;
 	struct buffer_head *bh;
 	int err = 0;
@@ -3234,6 +3233,8 @@ int ext4_discard_partial_page_buffers_no_lock(handle_t *handle,
 
 	pos = offset;
 	while (pos < offset + length) {
+		unsigned int end_of_block, range_to_discard;
+
 		err = 0;
 
 		/* The length of space left to zero and unmap */
-- 
1.7.5.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] ext4: return ENOMEM if find_or_create_pages fails
  2011-10-30 11:30 [PATCH 1/3] ext4: move variables to its scope Yongqiang Yang
@ 2011-10-30 11:30 ` Yongqiang Yang
  2011-10-31 22:12   ` Ted Ts'o
  2011-10-30 11:30 ` [PATCH 3/3] ext4: let ext4_discard_partial_buffers handle unaligned range correctly Yongqiang Yang
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Yongqiang Yang @ 2011-10-30 11:30 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4, Yongqiang Yang


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 3c4a9d5..e113de8 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3132,7 +3132,7 @@ int ext4_discard_partial_page_buffers(handle_t *handle,
 	page = find_or_create_page(mapping, from >> PAGE_CACHE_SHIFT,
 				   mapping_gfp_mask(mapping) & ~__GFP_FS);
 	if (!page)
-		return -EINVAL;
+		return -ENOMEM;
 
 	err = ext4_discard_partial_page_buffers_no_lock(handle, inode, page,
 		from, length, flags);
@@ -3375,7 +3375,7 @@ int ext4_block_zero_page_range(handle_t *handle,
 	page = find_or_create_page(mapping, from >> PAGE_CACHE_SHIFT,
 				   mapping_gfp_mask(mapping) & ~__GFP_FS);
 	if (!page)
-		return -EINVAL;
+		return -ENOMEM;
 
 	blocksize = inode->i_sb->s_blocksize;
 	max = blocksize - (offset & (blocksize - 1));
-- 
1.7.5.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] ext4: let ext4_discard_partial_buffers handle unaligned range correctly
  2011-10-30 11:30 [PATCH 1/3] ext4: move variables to its scope Yongqiang Yang
  2011-10-30 11:30 ` [PATCH 2/3] ext4: return ENOMEM if find_or_create_pages fails Yongqiang Yang
@ 2011-10-30 11:30 ` Yongqiang Yang
  2011-10-30 13:36   ` Yongqiang Yang
  2011-10-31 22:12   ` Ted Ts'o
  2011-10-30 14:00 ` [PATCH 1/3] ext4: move variables to its scope Coly Li
  2011-10-31 22:12 ` Ted Ts'o
  3 siblings, 2 replies; 8+ messages in thread
From: Yongqiang Yang @ 2011-10-30 11:30 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4, Yongqiang Yang

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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] ext4: let ext4_discard_partial_buffers handle unaligned range correctly
  2011-10-30 11:30 ` [PATCH 3/3] ext4: let ext4_discard_partial_buffers handle unaligned range correctly Yongqiang Yang
@ 2011-10-30 13:36   ` Yongqiang Yang
  2011-10-31 22:12   ` Ted Ts'o
  1 sibling, 0 replies; 8+ messages in thread
From: Yongqiang Yang @ 2011-10-30 13:36 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4, Yongqiang Yang

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
>
>



-- 
Best Wishes
Yongqiang Yang
--
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] ext4: move variables to its scope
  2011-10-30 11:30 [PATCH 1/3] ext4: move variables to its scope Yongqiang Yang
  2011-10-30 11:30 ` [PATCH 2/3] ext4: return ENOMEM if find_or_create_pages fails Yongqiang Yang
  2011-10-30 11:30 ` [PATCH 3/3] ext4: let ext4_discard_partial_buffers handle unaligned range correctly Yongqiang Yang
@ 2011-10-30 14:00 ` Coly Li
  2011-10-31 22:12 ` Ted Ts'o
  3 siblings, 0 replies; 8+ messages in thread
From: Coly Li @ 2011-10-30 14:00 UTC (permalink / raw)
  To: Yongqiang Yang; +Cc: tytso, linux-ext4

On 2011年10月30日 19:30, Yongqiang Yang Wrote:
> Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
> ---
>  fs/ext4/inode.c |    3 ++-
[snip]

Yongqiang,

Could you please to add any commit log to this patch set ? That could be much helpful then only one line SOB :-)

Thanks.

-- 
Coly Li
--
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] ext4: move variables to its scope
  2011-10-30 11:30 [PATCH 1/3] ext4: move variables to its scope Yongqiang Yang
                   ` (2 preceding siblings ...)
  2011-10-30 14:00 ` [PATCH 1/3] ext4: move variables to its scope Coly Li
@ 2011-10-31 22:12 ` Ted Ts'o
  3 siblings, 0 replies; 8+ messages in thread
From: Ted Ts'o @ 2011-10-31 22:12 UTC (permalink / raw)
  To: Yongqiang Yang; +Cc: linux-ext4

On Sun, Oct 30, 2011 at 07:30:01PM +0800, Yongqiang Yang wrote:
> 
> Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>

Thanks, applied.

				- Ted

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] ext4: return ENOMEM if find_or_create_pages fails
  2011-10-30 11:30 ` [PATCH 2/3] ext4: return ENOMEM if find_or_create_pages fails Yongqiang Yang
@ 2011-10-31 22:12   ` Ted Ts'o
  0 siblings, 0 replies; 8+ messages in thread
From: Ted Ts'o @ 2011-10-31 22:12 UTC (permalink / raw)
  To: Yongqiang Yang; +Cc: linux-ext4

On Sun, Oct 30, 2011 at 07:30:02PM +0800, Yongqiang Yang wrote:
> 
> Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>

Thanks, applied.

					- Ted

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] ext4: let ext4_discard_partial_buffers handle unaligned range correctly
  2011-10-30 11:30 ` [PATCH 3/3] ext4: let ext4_discard_partial_buffers handle unaligned range correctly Yongqiang Yang
  2011-10-30 13:36   ` Yongqiang Yang
@ 2011-10-31 22:12   ` Ted Ts'o
  1 sibling, 0 replies; 8+ messages in thread
From: Ted Ts'o @ 2011-10-31 22:12 UTC (permalink / raw)
  To: Yongqiang Yang; +Cc: linux-ext4

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-10-31 22:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-30 11:30 [PATCH 1/3] ext4: move variables to its scope Yongqiang Yang
2011-10-30 11:30 ` [PATCH 2/3] ext4: return ENOMEM if find_or_create_pages fails Yongqiang Yang
2011-10-31 22:12   ` Ted Ts'o
2011-10-30 11:30 ` [PATCH 3/3] ext4: let ext4_discard_partial_buffers handle unaligned range correctly Yongqiang Yang
2011-10-30 13:36   ` Yongqiang Yang
2011-10-31 22:12   ` Ted Ts'o
2011-10-30 14:00 ` [PATCH 1/3] ext4: move variables to its scope Coly Li
2011-10-31 22:12 ` Ted Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).