From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [PATCH UPDATED] fs/buffer.c: call __block_write_begin() if we have page Date: Mon, 25 Oct 2010 16:11:37 -0700 Message-ID: <20101025161137.5f0b642d.akpm@linux-foundation.org> References: <1287848786-13347-1-git-send-email-namhyung@gmail.com> <1287850314-13663-1-git-send-email-namhyung@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Alexander Viro , Christoph Hellwig , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: Namhyung Kim Return-path: Received: from smtp1.linux-foundation.org ([140.211.169.13]:36488 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751305Ab0JYXLr (ORCPT ); Mon, 25 Oct 2010 19:11:47 -0400 In-Reply-To: <1287850314-13663-1-git-send-email-namhyung@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Sun, 24 Oct 2010 01:11:54 +0900 Namhyung Kim 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 > --- > 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)