From patchwork Tue Jun 7 17:29:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Rees X-Patchwork-Id: 858232 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p57HTn1J019764 for ; Tue, 7 Jun 2011 17:29:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756645Ab1FGR3l (ORCPT ); Tue, 7 Jun 2011 13:29:41 -0400 Received: from int-mailstore01.merit.edu ([207.75.116.232]:53766 "EHLO int-mailstore01.merit.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755722Ab1FGR3k (ORCPT ); Tue, 7 Jun 2011 13:29:40 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by int-mailstore01.merit.edu (Postfix) with ESMTP id 91806305CF58; Tue, 7 Jun 2011 13:29:39 -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 XR99js+U1kS1; Tue, 7 Jun 2011 13:29:39 -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 2CEC43055B74; Tue, 7 Jun 2011 13:29:39 -0400 (EDT) Date: Tue, 7 Jun 2011 13:29:38 -0400 From: Jim Rees To: Benny Halevy Cc: linux-nfs@vger.kernel.org, peter honeyman Subject: [PATCH 32/88] pnfsblock: bl_write_pagelist support functions Message-ID: 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 (demeter1.kernel.org [140.211.167.41]); Tue, 07 Jun 2011 17:29:49 +0000 (UTC) From: Fred Isaman [pnfsblock: SQUASHME: adjust to API change] Signed-off-by: Fred Isaman [pnfsblock: fixup blksize alignment in bl_setup_layoutcommit] Signed-off-by: Benny Halevy --- fs/nfs/blocklayout/blocklayout.c | 32 +++++++++++++++++++++++++++++++- 1 files changed, 31 insertions(+), 1 deletions(-) diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c index af26bcc..9c46f5a 100644 --- a/fs/nfs/blocklayout/blocklayout.c +++ b/fs/nfs/blocklayout/blocklayout.c @@ -73,6 +73,19 @@ static int is_hole(struct pnfs_block_extent *be, sector_t isect) return !is_sector_initialized(be->be_inval, isect); } +/* Given the be associated with isect, determine if page data can be + * written to disk. + */ +static int is_writable(struct pnfs_block_extent *be, sector_t isect) +{ + if (be->be_state == PNFS_BLOCK_READWRITE_DATA) + return 1; + else if (be->be_state != PNFS_BLOCK_INVALID_DATA) + return 0; + else + return is_sector_initialized(be->be_inval, isect); +} + static int dont_like_caller(struct nfs_page *req) { @@ -441,7 +454,19 @@ static int bl_setup_layoutcommit(struct pnfs_layout_type *lo, struct pnfs_layoutcommit_arg *arg) { + struct nfs_server *nfss = PNFS_NFS_SERVER(lo); + struct pnfs_layoutcommit_arg *arg = &data->args; + dprintk("%s enter\n", __func__); + /* Need to ensure commit is block-size aligned */ + if (nfss->pnfs_blksize) { + u64 mask = nfss->pnfs_blksize - 1; + u64 offset = arg->lseg.offset & mask; + + arg->lseg.offset -= offset; + arg->lseg.length += offset + mask; + arg->lseg.length &= ~mask; + } return 0; } @@ -916,7 +941,12 @@ bl_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, struct nfs_page *req) { dprintk("%s enter\n", __func__); - return 1; + if (pgio->pg_iswrite) { + return test_bit(PG_USE_PNFS, &prev->wb_flags) == + test_bit(PG_USE_PNFS, &req->wb_flags); + } else { + return 1; + } } /* This checks if old req will likely use same io method as soon