From patchwork Fri Oct 13 20:57:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 10005993 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4DDE060325 for ; Fri, 13 Oct 2017 20:57:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D9D92909C for ; Fri, 13 Oct 2017 20:57:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 329222913A; Fri, 13 Oct 2017 20:57:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 898382909C for ; Fri, 13 Oct 2017 20:57:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751608AbdJMU5o (ORCPT ); Fri, 13 Oct 2017 16:57:44 -0400 Received: from mail-ua0-f194.google.com ([209.85.217.194]:52692 "EHLO mail-ua0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751378AbdJMU5o (ORCPT ); Fri, 13 Oct 2017 16:57:44 -0400 Received: by mail-ua0-f194.google.com with SMTP id i35so6148377uah.9 for ; Fri, 13 Oct 2017 13:57:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Y4AalvdHJIhlLE6RK/2/XZd5GW7ccVspWc8nL8zTJU4=; b=fQixrP3BdyX97rSYPtA8t/vxATwVKwed/vjeumzJK99aKKKxT5dVS4bzUOf5s8bdxZ cIba505dBt4q7paFLc3JRKUvWIpsfIXZbXY4z7Lhr5Ba9UztO6ymqy1QruxYpAmi9lWa HPflVnfB09FFmNsnlZ6PWAykANnriwEZ5pU3Q8ovzfM253zSrMMtsNpvygwuZq85c41o R3+AsQoXVpQCxa0xBt7c53kDX+NzBWsOEpm/GMkw2bMZbSltseNT5aTIGOY72BM87rJW lPhYR8Sxj5cxB962PjYFVMCWWVD6asUi9XX0epjM67w5EnzIw8FQ6Qu8oksGacWEa9gr dQ4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Y4AalvdHJIhlLE6RK/2/XZd5GW7ccVspWc8nL8zTJU4=; b=AEhe0E7cBT8NNdQoyoC3f1W8sPB1Qn9vMefSrWasy0xV4Ifid9D38fAcxFDi38+dK3 uY5Gf+3w8vJrKV2lWuEAMa1lJfoMmqNT68HYaUNk7scPd+7VY7gVZPyMrJiOn6o7npMk zRpu84f31mmYDhQUDYnzsMkYTSjaXY9BdJGTfjaRSB2yWPu+MdEczqlAdsTIYaaxkRUs rCNrqrhdNpgzSbqym5b3ZBipin/YCs/p45HqPfex+irWBxrWixZMJkxzk7F+ytnDXvGv QKLpdGQTY7xhyy5lA4g4GibPcNsJRopgze501TQJuc5UrcIZNvrleSOm/C7qkDv6Rlq2 2sPQ== X-Gm-Message-State: AMCzsaUFt5X5p4pMl0o/wl2DyOS1ic9fCWVZGbJSUvVBeGu0bWGwFrm3 MBAHfMV4ci9tou0jUmyLw1SiFDBEGiPK1NBFBD8= X-Google-Smtp-Source: ABhQp+RTb1hmQaxD3fksb3kOcUcDcqZQYrl7pcoVzBIJB0M+rOtSxc3PIm111FBDpW1B23vQz6qeNRaY56M3TdjsbEo= X-Received: by 10.159.56.153 with SMTP id t25mr2277543uaf.14.1507928263362; Fri, 13 Oct 2017 13:57:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.59.202 with HTTP; Fri, 13 Oct 2017 13:57:42 -0700 (PDT) In-Reply-To: <20171013205550.65573-5-kolga@netapp.com> References: <20171013205550.65573-1-kolga@netapp.com> <20171013205550.65573-5-kolga@netapp.com> From: Olga Kornievskaia Date: Fri, 13 Oct 2017 16:57:42 -0400 X-Google-Sender-Auth: tV5mHoz2FzJVSTXtmh2zsyjitnw Message-ID: Subject: Re: [PATCH v5 04/23] NFS OFFLOAD_STATUS op To: Olga Kornievskaia Cc: Trond Myklebust , Anna Schumaker , linux-nfs Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Oct 13, 2017 at 4:55 PM, Olga Kornievskaia wrote: > Signed-off-by: Olga Kornievskaia > --- > fs/nfs/nfs42.h | 5 ++++- > fs/nfs/nfs42proc.c | 43 +++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 47 insertions(+), 1 deletion(-) > > diff --git a/fs/nfs/nfs42.h b/fs/nfs/nfs42.h > index b6cd153..6b9decf 100644 > --- a/fs/nfs/nfs42.h > +++ b/fs/nfs/nfs42.h > @@ -11,6 +11,7 @@ > */ > #define PNFS_LAYOUTSTATS_MAXDEV (4) > > +#if defined(CONFIG_NFS_V4_2) > /* nfs4.2proc.c */ > int nfs42_proc_allocate(struct file *, loff_t, loff_t); > ssize_t nfs42_proc_copy(struct file *, loff_t, struct file *, loff_t, size_t); > @@ -19,5 +20,7 @@ > int nfs42_proc_layoutstats_generic(struct nfs_server *, > struct nfs42_layoutstat_data *); > int nfs42_proc_clone(struct file *, struct file *, loff_t, loff_t, loff_t); > - > +int nfs42_proc_offload_status(struct file *, nfs4_stateid *, > + struct nfs42_offload_status_res *); > +#endif /* CONFIG_NFS_V4_2) */ > #endif /* __LINUX_FS_NFS_NFS4_2_H */ > diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c > index 6c2db51..65fb014 100644 > --- a/fs/nfs/nfs42proc.c > +++ b/fs/nfs/nfs42proc.c > @@ -263,6 +263,49 @@ ssize_t nfs42_proc_copy(struct file *src, loff_t pos_src, > return err; > } > > +int _nfs42_proc_offload_status(struct file *dst, nfs4_stateid *stateid, > + struct nfs42_offload_status_res *res) > +{ > + struct nfs42_offload_status_args args = { > + .osa_src_fh = NFS_FH(file_inode(dst)), > + }; > + struct nfs_server *dst_server = NFS_SERVER(file_inode(dst)); > + struct rpc_message msg = { > + .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OFFLOAD_STATUS], > + .rpc_resp = res, > + .rpc_argp = &args, > + }; > + int status; > + > + memcpy(&args.osa_stateid, stateid, sizeof(args.osa_stateid)); > + status = nfs4_call_sync(dst_server->client, dst_server, &msg, > + &args.osa_seq_args, &res->osr_seq_res, 0); > + if (status == -ENOTSUPP) > + dst_server->caps &= ~NFS_CAP_OFFLOAD_STATUS; > + > + return status; > +} > + > +int nfs42_proc_offload_status(struct file *dst, nfs4_stateid *stateid, > + struct nfs42_offload_status_res *res) > +{ > + struct nfs_server *dst_server = NFS_SERVER(file_inode(dst)); > + struct nfs4_exception exception = { }; > + int status; > + > + if (!(dst_server->caps & NFS_CAP_OFFLOAD_STATUS)) > + return -EOPNOTSUPP; > + > + do { > + status = _nfs42_proc_offload_status(dst, stateid, res); > + if (status == -ENOTSUPP) > + return -EOPNOTSUPP; > + status = nfs4_handle_exception(dst_server, status, &exception); > + } while (exception.retry); > + > + return status; > +} > + > static loff_t _nfs42_proc_llseek(struct file *filep, > struct nfs_lock_context *lock, loff_t offset, int whence) > { > -- To test this and the server code I used the following patch: > 1.8.3.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-nfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html --- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c index 317eab9..97d3937 100644 --- a/fs/nfs/nfs42proc.c +++ b/fs/nfs/nfs42proc.c @@ -156,7 +156,7 @@ static int handle_async_copy(struct nfs42_copy_res *res, struct file *src, struct file *dst, nfs4_stateid *src_stateid, - uint64_t *ret_count) + uint64_t *ret_count, uint64_t count) { struct nfs4_copy_state *copy; int status = NFS4_OK; @@ -190,6 +190,24 @@ static int handle_async_copy(struct nfs42_copy_res *res, list_add_tail(©->copies, &server->ss_copies); spin_unlock(&server->nfs_client->cl_lock); + for (;;) { + struct nfs42_offload_status_res res = { + .osr_status = 0, + }; + + status = nfs42_proc_offload_status(dst, ©->stateid, &res); + if (status || res.osr_status) { + printk("AGLO: status=%d osr_status=%d\n", status, res.osr_status); + break; + } + if (res.osr_count == count) { + printk("AGLO: received all the bytes=%lld\n", count); + break; + } else { + printk("AGLO: bytes=%lld going to sleep for 100ms\n", res.osr_count); + msleep(100); + } + } status = wait_for_completion_interruptible(©->completion); spin_lock(&server->nfs_client->cl_lock); list_del_init(©->copies); @@ -310,7 +328,7 @@ static ssize_t _nfs42_proc_copy(struct file *src, if (!res->synchronous) { status = handle_async_copy(res, server, src, dst, - &args->src_stateid, &res->write_res.count); + &args->src_stateid, &res->write_res.count, args->count); if (status) return status; }