From patchwork Fri Oct 7 18:46:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Bruce Fields" X-Patchwork-Id: 9367399 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 6E23760487 for ; Fri, 7 Oct 2016 18:46:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 634EB297C2 for ; Fri, 7 Oct 2016 18:46:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57E76297D3; Fri, 7 Oct 2016 18:46:43 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 B9809297C2 for ; Fri, 7 Oct 2016 18:46:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932426AbcJGSql (ORCPT ); Fri, 7 Oct 2016 14:46:41 -0400 Received: from fieldses.org ([173.255.197.46]:33176 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932132AbcJGSql (ORCPT ); Fri, 7 Oct 2016 14:46:41 -0400 Received: by fieldses.org (Postfix, from userid 2815) id E5B6650F9; Fri, 7 Oct 2016 14:46:39 -0400 (EDT) Date: Fri, 7 Oct 2016 14:46:39 -0400 From: "J. Bruce Fields" To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: Re: [PATCH v5] NFSD: Add support for the COPY operation Message-ID: <20161007184639.GA25120@fieldses.org> References: <20160907195730.26480-1-Anna.Schumaker@Netapp.com> <20160909195336.GA25490@fieldses.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160909195336.GA25490@fieldses.org> User-Agent: Mutt/1.5.21 (2010-09-15) 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, Sep 09, 2016 at 03:53:36PM -0400, J. Bruce Fields wrote: > On Wed, Sep 07, 2016 at 03:57:29PM -0400, Anna Schumaker wrote: > > This patch adds server support for the NFS v4.2 COPY operation. I did some > > performance testing on my own, and found that a 4MB copy cap has performance > > pretty close to copying with no cap at all. Here are my results for testing > > with various file sizes and copy caps: > > Thanks, but we expect the tradeoffs here to vary a lot depending on the > latency of the client<->server connection and the server<->server copy > bandwidth. So this isn't really interesting without knowing your > testing setup. ... but I guess I'm inclined to try this anyway. It's simple. We can do something more complicated later if this turns out to be a problem. Maybe it'd help to leave a little more documentation here. Applying for 4.8 with that change. --b. --- 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/nfsd/vfs.c b/fs/nfsd/vfs.c index 271a23cf6470..8ca642fe9b21 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -516,7 +516,15 @@ __be32 nfsd4_clone_file_range(struct file *src, u64 src_pos, struct file *dst, ssize_t nfsd_copy_file_range(struct file *src, u64 src_pos, struct file *dst, u64 dst_pos, u64 count) { - /* Arbitrary 4 megabyte copy cap */ + + /* + * Limit copy to 4MB to prevent indefinitely blocking an nfsd + * thread and client rpc slot. The choice of 4MB is somewhat + * arbitrary. We might instead base this on r/wsize, or make it + * tunable, or use a time instead of a byte limit, or implement + * asynchronous copy. In theory a client could also recognize a + * limit like this and pipeline multiple COPY requests. + */ count = min_t(u64, count, 1 << 22); return vfs_copy_file_range(src, src_pos, dst, dst_pos, count, 0); }