linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/buffer.c: call __block_write_begin() if we have page
@ 2010-10-23 15:46 Namhyung Kim
  2010-10-23 16:11 ` [PATCH UPDATED] " Namhyung Kim
  0 siblings, 1 reply; 5+ messages in thread
From: Namhyung Kim @ 2010-10-23 15:46 UTC (permalink / raw)
  To: Alexander Viro; +Cc: Christoph Hellwig, linux-fsdevel, linux-kernel

If we have the appropriate page already, call __block_write_begin()
directly instead of releasing and regrabbing it inside of
block_write_begin().

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 fs/buffer.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index 7f0b9b0..d4b3ada 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2466,11 +2466,10 @@ int nobh_write_begin(struct address_space *mapping,
 	*fsdata = NULL;
 
 	if (page_has_buffers(page)) {
-		unlock_page(page);
-		page_cache_release(page);
-		*pagep = NULL;
-		return block_write_begin(mapping, pos, len, flags, pagep,
-					 get_block);
+		ret = __block_write_begin(page, pos, len, get_block);
+		if (unlikely(ret))
+			*pagep = NULL;
+		return ret;
 	}
 
 	if (PageMappedToDisk(page))
-- 
1.7.0.4

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

* [PATCH UPDATED] fs/buffer.c: call __block_write_begin() if we have page
  2010-10-23 15:46 [PATCH] fs/buffer.c: call __block_write_begin() if we have page Namhyung Kim
@ 2010-10-23 16:11 ` Namhyung Kim
  2010-10-25  6:01   ` [PATCH RESEND] " Namhyung Kim
  2010-10-25 23:11   ` [PATCH UPDATED] " Andrew Morton
  0 siblings, 2 replies; 5+ messages in thread
From: Namhyung Kim @ 2010-10-23 16:11 UTC (permalink / raw)
  To: Alexander Viro; +Cc: Christoph Hellwig, linux-fsdevel, linux-kernel

If we have the appropriate page already, call __block_write_begin()
directly instead of releasing and regrabbing it inside of
block_write_begin().

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
Fix error path.

 fs/buffer.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index 7f0b9b0..f5755f7 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2466,11 +2466,13 @@ int nobh_write_begin(struct address_space *mapping,
 	*fsdata = NULL;
 
 	if (page_has_buffers(page)) {
-		unlock_page(page);
-		page_cache_release(page);
-		*pagep = NULL;
-		return block_write_begin(mapping, pos, len, flags, pagep,
-					 get_block);
+		ret = __block_write_begin(page, pos, len, get_block);
+		if (unlikely(ret)) {
+			unlock_page(page);
+			page_cache_release(page);
+			*pagep = NULL;
+		}
+		return ret;
 	}
 
 	if (PageMappedToDisk(page))
-- 
1.7.0.4

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

* [PATCH RESEND] fs/buffer.c: call __block_write_begin() if we have page
  2010-10-23 16:11 ` [PATCH UPDATED] " Namhyung Kim
@ 2010-10-25  6:01   ` Namhyung Kim
  2010-10-25 23:11   ` [PATCH UPDATED] " Andrew Morton
  1 sibling, 0 replies; 5+ messages in thread
From: Namhyung Kim @ 2010-10-25  6:01 UTC (permalink / raw)
  To: Alexander Viro; +Cc: Christoph Hellwig, linux-fsdevel, linux-kernel

If we have the appropriate page already, call __block_write_begin()
directly instead of releasing and regrabbing it inside of
block_write_begin().

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
Shared error path.

 fs/buffer.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index 7f0b9b0..a132c2b 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2466,11 +2466,10 @@ int nobh_write_begin(struct address_space *mapping,
 	*fsdata = NULL;
 
 	if (page_has_buffers(page)) {
-		unlock_page(page);
-		page_cache_release(page);
-		*pagep = NULL;
-		return block_write_begin(mapping, pos, len, flags, pagep,
-					 get_block);
+		ret = __block_write_begin(page, pos, len, get_block);
+		if (unlikely(ret))
+			goto out_release;
+		return ret;
 	}
 
 	if (PageMappedToDisk(page))
-- 
1.7.0.4

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

* Re: [PATCH UPDATED] fs/buffer.c: call __block_write_begin() if we have page
  2010-10-23 16:11 ` [PATCH UPDATED] " Namhyung Kim
  2010-10-25  6:01   ` [PATCH RESEND] " Namhyung Kim
@ 2010-10-25 23:11   ` Andrew Morton
  2010-10-26  8:06     ` Namhyung Kim
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2010-10-25 23:11 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Alexander Viro, Christoph Hellwig, linux-fsdevel, linux-kernel

On Sun, 24 Oct 2010 01:11:54 +0900
Namhyung Kim <namhyung@gmail.com> wrote:

> If we have the appropriate page already, call __block_write_begin()
> directly instead of releasing and regrabbing it inside of
> block_write_begin().
> 
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> ---
> Fix error path.
> 
>  fs/buffer.c |   12 +++++++-----
>  1 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/buffer.c b/fs/buffer.c
> index 7f0b9b0..f5755f7 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -2466,11 +2466,13 @@ int nobh_write_begin(struct address_space *mapping,
>  	*fsdata = NULL;
>  
>  	if (page_has_buffers(page)) {
> -		unlock_page(page);
> -		page_cache_release(page);
> -		*pagep = NULL;
> -		return block_write_begin(mapping, pos, len, flags, pagep,
> -					 get_block);
> +		ret = __block_write_begin(page, pos, len, get_block);
> +		if (unlikely(ret)) {
> +			unlock_page(page);
> +			page_cache_release(page);
> +			*pagep = NULL;
> +		}
> +		return ret;
>  	}
>  
>  	if (PageMappedToDisk(page))

It looks OK.  Was it tested?  (ext2 mounted with -o nobh)

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

* Re: [PATCH UPDATED] fs/buffer.c: call __block_write_begin() if we have page
  2010-10-25 23:11   ` [PATCH UPDATED] " Andrew Morton
@ 2010-10-26  8:06     ` Namhyung Kim
  0 siblings, 0 replies; 5+ messages in thread
From: Namhyung Kim @ 2010-10-26  8:06 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Alexander Viro, Christoph Hellwig, linux-fsdevel, linux-kernel

2010-10-25 (월), 16:11 -0700, Andrew Morton:
> On Sun, 24 Oct 2010 01:11:54 +0900
> Namhyung Kim <namhyung@gmail.com> wrote:
> 
> > If we have the appropriate page already, call __block_write_begin()
> > directly instead of releasing and regrabbing it inside of
> > block_write_begin().
> > 
> > Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> > ---
> > Fix error path.
> > 
> >  fs/buffer.c |   12 +++++++-----
> >  1 files changed, 7 insertions(+), 5 deletions(-)
> > 
> > diff --git a/fs/buffer.c b/fs/buffer.c
> > index 7f0b9b0..f5755f7 100644
> > --- a/fs/buffer.c
> > +++ b/fs/buffer.c
> > @@ -2466,11 +2466,13 @@ int nobh_write_begin(struct address_space *mapping,
> >  	*fsdata = NULL;
> >  
> >  	if (page_has_buffers(page)) {
> > -		unlock_page(page);
> > -		page_cache_release(page);
> > -		*pagep = NULL;
> > -		return block_write_begin(mapping, pos, len, flags, pagep,
> > -					 get_block);
> > +		ret = __block_write_begin(page, pos, len, get_block);
> > +		if (unlikely(ret)) {
> > +			unlock_page(page);
> > +			page_cache_release(page);
> > +			*pagep = NULL;
> > +		}
> > +		return ret;
> >  	}
> >  
> >  	if (PageMappedToDisk(page))
> 
> It looks OK.  Was it tested?  (ext2 mounted with -o nobh)

I just did tar && untar with current kernel source several times on UML.
It worked find for me. Thanks.


-- 
Regards,
Namhyung Kim


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" 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] 5+ messages in thread

end of thread, other threads:[~2010-10-26  8:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-23 15:46 [PATCH] fs/buffer.c: call __block_write_begin() if we have page Namhyung Kim
2010-10-23 16:11 ` [PATCH UPDATED] " Namhyung Kim
2010-10-25  6:01   ` [PATCH RESEND] " Namhyung Kim
2010-10-25 23:11   ` [PATCH UPDATED] " Andrew Morton
2010-10-26  8:06     ` Namhyung Kim

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