From patchwork Tue Dec 16 19:01:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Haynes X-Patchwork-Id: 5503171 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 227F59F326 for ; Tue, 16 Dec 2014 19:03:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 30644209C1 for ; Tue, 16 Dec 2014 19:03:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 36256209BD for ; Tue, 16 Dec 2014 19:03:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751328AbaLPTDb (ORCPT ); Tue, 16 Dec 2014 14:03:31 -0500 Received: from mail-pd0-f172.google.com ([209.85.192.172]:39812 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751155AbaLPTDb (ORCPT ); Tue, 16 Dec 2014 14:03:31 -0500 Received: by mail-pd0-f172.google.com with SMTP id y13so14441325pdi.17 for ; Tue, 16 Dec 2014 11:03:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YJ9Zi3zAnocRZEZAN/pHNawksM874xTNEwJ5ohCEBxA=; b=I2+gfRtb0P222KjT52SB8zawyQOTNAZsr1J+e5EmRynazUewI1K8/0Bva9+aEurOKz ndvYJRf8/71XSQandvExgD8w4+wKZWfUq0+E0r8W+0+TsBaB4ZKt8/Gt68zTlC3DGe+8 XiobCzKnTgGj82Zwko9qDdJrPlnLGwV/afGANB/VvJxuMYIghyDOJ0bxEZzOR6uE7w5w ezgYfrHUBMf/fvCDvcNFz0Iawexeo+/gGhmRYvydACQMUKdhrQWwd4mqHCP/pAhxcdo3 L5Zt+ZUz8vYVZqa5P3rWS6iYuB7Co/Hy1UuUeGhijts42b1J9UvZCS72+o0u9XPEkiSx alEw== X-Gm-Message-State: ALoCoQn8ntl7vgU4//Y86Q3GypMJ7VPYYlweY3rMZwPKcu2C9uMpBnnjpKC0PbIvCQU9k8rBsJeu X-Received: by 10.66.150.225 with SMTP id ul1mr61852434pab.3.1418756610349; Tue, 16 Dec 2014 11:03:30 -0800 (PST) Received: from localhost.localdomain ([50.242.95.105]) by mx.google.com with ESMTPSA id q4sm1620669pdh.79.2014.12.16.11.03.29 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Dec 2014 11:03:29 -0800 (PST) From: Tom Haynes X-Google-Original-From: Tom Haynes To: Trond Myklebust Cc: Linux NFS Mailing List Subject: [PATCH 43/50] nfs41: add range to layoutreturn args Date: Tue, 16 Dec 2014 11:01:46 -0800 Message-Id: <1418756513-95187-44-git-send-email-loghyr@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1418756513-95187-1-git-send-email-loghyr@primarydata.com> References: <1418756513-95187-1-git-send-email-loghyr@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Peng Tao So that callers can specify which range to return. Signed-off-by: Peng Tao Signed-off-by: Tom Haynes --- fs/nfs/nfs4xdr.c | 6 +++--- fs/nfs/pnfs.c | 14 +++++++++----- include/linux/nfs_xdr.h | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 3c3ff63..56d4c91 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -2012,11 +2012,11 @@ encode_layoutreturn(struct xdr_stream *xdr, p = reserve_space(xdr, 16); *p++ = cpu_to_be32(0); /* reclaim. always 0 for now */ *p++ = cpu_to_be32(args->layout_type); - *p++ = cpu_to_be32(args->iomode); + *p++ = cpu_to_be32(args->range.iomode); *p = cpu_to_be32(RETURN_FILE); p = reserve_space(xdr, 16); - p = xdr_encode_hyper(p, 0); - p = xdr_encode_hyper(p, NFS4_MAX_UINT64); + p = xdr_encode_hyper(p, args->range.offset); + p = xdr_encode_hyper(p, args->range.length); spin_lock(&args->inode->i_lock); encode_nfs4_stateid(xdr, &args->stateid); spin_unlock(&args->inode->i_lock); diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 10e9aaf..a368c74 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -52,7 +52,7 @@ static LIST_HEAD(pnfs_modules_tbl); static int pnfs_send_layoutreturn(struct pnfs_layout_hdr *lo, nfs4_stateid stateid, - enum pnfs_iomode iomode); + enum pnfs_iomode iomode, u64 offset, u64 length); /* Return the registered pnfs layout driver module matching given id */ static struct pnfs_layoutdriver_type * @@ -391,7 +391,8 @@ pnfs_put_lseg(struct pnfs_layout_segment *lseg) if (need_return) { spin_unlock(&inode->i_lock); /* hdr reference dropped in nfs4_layoutreturn_release */ - pnfs_send_layoutreturn(lo, stateid, iomode); + pnfs_send_layoutreturn(lo, stateid, iomode, 0, + NFS4_MAX_UINT64); spin_lock(&inode->i_lock); pnfs_layout_remove_lseg(lo, lseg); spin_unlock(&inode->i_lock); @@ -904,7 +905,7 @@ static void pnfs_clear_layoutcommit(struct inode *inode, static int pnfs_send_layoutreturn(struct pnfs_layout_hdr *lo, nfs4_stateid stateid, - enum pnfs_iomode iomode) + enum pnfs_iomode iomode, u64 offset, u64 length) { struct inode *ino = lo->plh_inode; struct nfs4_layoutreturn *lrp; @@ -923,7 +924,9 @@ pnfs_send_layoutreturn(struct pnfs_layout_hdr *lo, nfs4_stateid stateid, lrp->args.stateid = stateid; lrp->args.layout_type = NFS_SERVER(ino)->pnfs_curr_ld->id; lrp->args.inode = ino; - lrp->args.iomode = iomode; + lrp->args.range.iomode = iomode; + lrp->args.range.offset = offset; + lrp->args.range.length = length; lrp->args.layout = lo; lrp->clp = NFS_SERVER(ino)->nfs_client; lrp->cred = lo->plh_lc_cred; @@ -994,7 +997,8 @@ _pnfs_return_layout(struct inode *ino) spin_unlock(&ino->i_lock); pnfs_free_lseg_list(&tmp_list); - status = pnfs_send_layoutreturn(lo, stateid, IOMODE_ANY); + status = pnfs_send_layoutreturn(lo, stateid, IOMODE_ANY, 0, + NFS4_MAX_UINT64); out: dprintk("<-- %s status: %d\n", __func__, status); return status; diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 6400a1e..3637923 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -293,7 +293,7 @@ struct nfs4_layoutreturn_args { struct nfs4_sequence_args seq_args; struct pnfs_layout_hdr *layout; struct inode *inode; - enum pnfs_iomode iomode; + struct pnfs_layout_range range; nfs4_stateid stateid; __u32 layout_type; };