Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756953Ab0GGPVl (ORCPT ); Wed, 7 Jul 2010 11:21:41 -0400 Received: from rcsinet10.oracle.com ([148.87.113.121]:54215 "EHLO rcsinet10.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754839Ab0GGPVj (ORCPT ); Wed, 7 Jul 2010 11:21:39 -0400 Message-ID: <4C349AFF.9040301@oracle.com> Date: Wed, 07 Jul 2010 23:19:27 +0800 From: Tao Ma User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090706) MIME-Version: 1.0 To: Joel Becker CC: Dave Chinner , Linus Torvalds , Linux Kernel , ocfs2-devel@oss.oracle.com, Dave Chinner , Christoph Hellwig , Mark Fasheh Subject: Re: [PATCH 1/3] ocfs2: When zero extending, do it by page. References: <20100703213219.GB21262@mail.oracle.com> <1278501367-7710-2-git-send-email-joel.becker@oracle.com> In-Reply-To: <1278501367-7710-2-git-send-email-joel.becker@oracle.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Source-IP: acsmt353.oracle.com [141.146.40.153] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090204.4C349B43.01FA:SCFMA4539814,ss=1,fgs=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2591 Lines: 92 Hi Joel, Joel Becker wrote: > ocfs2_zero_extend() does its zeroing block by block, but it calls a > function named ocfs2_write_zero_page(). Let's have > ocfs2_write_zero_page() handle the page level. From > ocfs2_zero_extend()'s perspective, it is now page-at-a-time. > > Signed-off-by: Joel Becker > --- > fs/ocfs2/aops.c | 30 -------------- > fs/ocfs2/file.c | 119 +++++++++++++++++++++++++++++++++++++++---------------- > 2 files changed, 85 insertions(+), 64 deletions(-) > > diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c > index 3623ca2..9a5c931 100644 > --- a/fs/ocfs2/aops.c > +++ b/fs/ocfs2/aops.c > @@ -459,36 +459,6 @@ int walk_page_buffers( handle_t *handle, > return ret; > } > > -handle_t *ocfs2_start_walk_page_trans(struct inode *inode, > - struct page *page, > - unsigned from, > - unsigned to) > -{ > - struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); > - handle_t *handle; > - int ret = 0; > - > - handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); > - if (IS_ERR(handle)) { > - ret = -ENOMEM; > - mlog_errno(ret); > - goto out; > - } > - > - if (ocfs2_should_order_data(inode)) { > - ret = ocfs2_jbd2_file_inode(handle, inode); > - if (ret < 0) > - mlog_errno(ret); > - } > -out: > - if (ret) { > - if (!IS_ERR(handle)) > - ocfs2_commit_trans(osb, handle); > - handle = ERR_PTR(ret); > - } > - return handle; > -} > - > static sector_t ocfs2_bmap(struct address_space *mapping, sector_t block) > { > sector_t status; > diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c > index 6a13ea6..a6e0eb6 100644 > --- a/fs/ocfs2/file.c > +++ b/fs/ocfs2/file.c > @@ -724,28 +724,55 @@ leave: > return status; > } > > +/* > + * While a write will already be ordering the data, a truncate will not. > + * Thus, we need to explicitly order the zeroed pages. > + */ > +static handle_t *ocfs2_zero_start_ordered_transaction(struct inode *inode) > +{ > + struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); > + handle_t *handle = NULL; > + int ret = 0; > + > + if (ocfs2_should_order_data(inode)) > This should be if (!ocfs2_should_order_data(inode)) I guess? ;) > + goto out; > + > + handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); > + if (IS_ERR(handle)) { > + ret = -ENOMEM; > + mlog_errno(ret); > + goto out; > + } > + > Regards, Tao -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/