From patchwork Tue Jun 7 17:26:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Rees X-Patchwork-Id: 858012 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p57HQgVT007977 for ; Tue, 7 Jun 2011 17:26:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756713Ab1FGR07 (ORCPT ); Tue, 7 Jun 2011 13:26:59 -0400 Received: from int-mailstore01.merit.edu ([207.75.116.232]:52883 "EHLO int-mailstore01.merit.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756717Ab1FGR06 (ORCPT ); Tue, 7 Jun 2011 13:26:58 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by int-mailstore01.merit.edu (Postfix) with ESMTP id 2F5D23083A4A; Tue, 7 Jun 2011 13:26:58 -0400 (EDT) X-Virus-Scanned: amavisd-new at int-mailstore01.merit.edu Received: from int-mailstore01.merit.edu ([127.0.0.1]) by localhost (int-mailstore01.merit.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kNTPJcdu5V4J; Tue, 7 Jun 2011 13:26:57 -0400 (EDT) Received: from merit.edu (host-17.subnet-17.med.umich.edu [141.214.17.17]) by int-mailstore01.merit.edu (Postfix) with ESMTPSA id BD4F7305CF58; Tue, 7 Jun 2011 13:26:57 -0400 (EDT) Date: Tue, 7 Jun 2011 13:26:56 -0400 From: Jim Rees To: Benny Halevy Cc: linux-nfs@vger.kernel.org, peter honeyman Subject: [PATCH 09/88] pnfs: HACK: adjust eof handling Message-ID: <7609e41fa37bda125ad7a1502c7d237f6c84569e.1307464382.git.rees@umich.edu> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 07 Jun 2011 17:26:59 +0000 (UTC) From: Fred Isaman This needs to be changed, but will require a major rewrite of the block layout's IO code. Including it here so I can get some current code into the tree. To deal with multipage blocks, the block driver sometimes needs to write pages of zeros past the EOF without advancing the eof to the written page. This gives a minimal infrastructure to allow that to happen. Signed-off-by: Fred Isaman Signed-off-by: Benny Halevy --- fs/nfs/pnfs.h | 14 ++++++++++++++ fs/nfs/write.c | 3 ++- 2 files changed, 16 insertions(+), 1 deletions(-) diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index ac536bc..b50cf3a 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h @@ -56,6 +56,7 @@ enum pnfs_try_status { struct pnfs_fsdata { struct pnfs_layout_segment *lseg; + int bypass_eof; void *private; }; @@ -313,6 +314,13 @@ static inline void pnfs_clear_request_commit(struct nfs_page *req) put_lseg(req->wb_commit_lseg); } +static inline int pnfs_grow_ok(struct pnfs_layout_segment *lseg, + struct pnfs_fsdata *fsdata) +{ + return !fsdata || ((struct pnfs_layout_segment *)fsdata == lseg) || + !fsdata->bypass_eof; +} + /* Should the pNFS client commit and return the layout upon a setattr */ static inline bool pnfs_ld_layoutret_on_setattr(struct inode *inode) @@ -427,6 +435,12 @@ pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx, return NULL; } +static inline int pnfs_grow_ok(struct pnfs_layout_segment *lseg, + struct pnfs_fsdata *fsdata) +{ + return 1; +} + static inline enum pnfs_try_status pnfs_try_to_read_data(struct nfs_read_data *data, const struct rpc_call_ops *call_ops) diff --git a/fs/nfs/write.c b/fs/nfs/write.c index fc36db8..75e2a6b 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -683,7 +683,8 @@ static int nfs_writepage_setup(struct nfs_open_context *ctx, struct page *page, if (IS_ERR(req)) return PTR_ERR(req); /* Update file length */ - nfs_grow_file(page, offset, count); + if (pnfs_grow_ok(lseg, fsdata)) + nfs_grow_file(page, offset, count); nfs_mark_uptodate(page, req->wb_pgbase, req->wb_bytes); nfs_mark_request_dirty(req); nfs_clear_page_tag_locked(req);