Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2376982ybl; Thu, 9 Jan 2020 11:39:58 -0800 (PST) X-Google-Smtp-Source: APXvYqzaMPUwDNKC9UnvODWNjSQfRk0H502YzANnojxKZhuCjxdozvceozI4nseZLLlPP29L62oU X-Received: by 2002:a05:6830:1f13:: with SMTP id u19mr9422557otg.237.1578598798718; Thu, 09 Jan 2020 11:39:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578598798; cv=none; d=google.com; s=arc-20160816; b=Was/Jof2jevfYITZ+PajlzMFj8DGYNifTQCOpLn63X1q0dj17BjIlYdV+KNTmj+UO0 4+jQln43wMZZVgXMpbhJM1QOOMsFvlAjzY6wymqghqxb9W61pwyiAYSzlFZYASoqeSZ7 qT9KYy3Jcv4pX0t971p304LMfYRpL6nKVMI9AtpB98iMRiCwZMeJcjEWuVCH9+ESd8Qu rNF9YmUTdp0qWFYYJXIbMqL0faIbz8LZ6PGGHysmXWRU/eH4Keqnixj0DvhX3WQtjFOZ NWwqUj3hiKmNpROwl0FHRdDCcLdaQZDS3xCsNjjpfXMLgfpyZMPJq6vCKvmAyEewkgKz QvVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=T+fz9doSM3kZ8mBig+/Fwr5PVTRlviGdTPRNKeZCtm8=; b=pt/MHhyKmqACMT1TSkSJUXYXfHh9+9pwVSjB3mXR6GEfDYZIc3xxyaRinAQZrEmBPG 2dwvU1NsZjWGssb5UePev5Z/VwqoJyhaEPt02lKCaqEbis45mBIJaelPnq5Rd9irnkbF PAdwj73gca5xRdSEHQEgNuyHoA8YbVuwr1wrbNHWEgFtCm4MdvOVj+wYJ7baWR5PkulP Y0iQYNet/rRML3Ea1+r+J8tnkCw6Fpb9+uIUJqInkmjx8GzH9jA2TdH2uqhsMuOAVXWd hOvkRz14s9ECAokSi4Js+XnzR2o8CXRcjK7YCuOI8nm5p+v1uBWEymnwIrKYMXlTEJcZ Fcuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ft1LzzTY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z21si4120539oic.32.2020.01.09.11.39.46; Thu, 09 Jan 2020 11:39:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ft1LzzTY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733025AbgAIQF4 (ORCPT + 99 others); Thu, 9 Jan 2020 11:05:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:58910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728584AbgAIQFy (ORCPT ); Thu, 9 Jan 2020 11:05:54 -0500 Received: from tleilax.poochiereds.net (68-20-15-154.lightspeed.rlghnc.sbcglobal.net [68.20.15.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5E8562072E; Thu, 9 Jan 2020 16:05:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578585953; bh=E+4soxqfhxfGquTmA4RcmwB0tyse1BamCGTUnkYpNUs=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=Ft1LzzTY7zNPdOi90ZeMSvPTVYCq+XFqhKAjHJl2td3VS3ZZEA7AgBwZ8P68BlVAe mlj6Q8B20E2e0eOi3Pq5cmXxFhCgOCBsVEb1NQFgKPOZ7jZ1TZaIvJ5s5bqIvpZc6I R5AaShIfRWCZkkdAdcN5nB1J8L2Pk1XfNRsaqaTs= Message-ID: <0c8566e39221cc475840da0f93913aeaa77dc0e4.camel@kernel.org> Subject: Re: [RFC PATCH v4] ceph: use 'copy-from2' operation in copy_file_range From: Jeff Layton To: Ilya Dryomov , Luis Henriques Cc: Sage Weil , "Yan, Zheng" , Gregory Farnum , Ceph Development , LKML Date: Thu, 09 Jan 2020 11:05:50 -0500 In-Reply-To: References: <20200108100353.23770-1-lhenriques@suse.com> <913eb28e6bb698f27f1831f75ea5250497ee659c.camel@kernel.org> <20200109143011.GA14582@brahms> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.2 (3.34.2-1.fc31) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2020-01-09 at 15:53 +0100, Ilya Dryomov wrote: > On Thu, Jan 9, 2020 at 3:30 PM Luis Henriques wrote: > > On Thu, Jan 09, 2020 at 08:06:17AM -0500, Jeff Layton wrote: > > > On Wed, 2020-01-08 at 10:03 +0000, Luis Henriques wrote: > > > > Instead of using the 'copy-from' operation, switch copy_file_range to the > > > > new 'copy-from2' operation, which allows to send the truncate_seq and > > > > truncate_size parameters. > > > > > > > > If an OSD does not support the 'copy-from2' operation it will return > > > > -EOPNOTSUPP. In that case, the kernel client will stop trying to do > > > > remote object copies for this fs client and will always use the generic > > > > VFS copy_file_range. > > > > > > > > Signed-off-by: Luis Henriques > > > > --- > > > > Hi Jeff, > > > > > > > > This is a follow-up to the discussion in [1]. Since PR [2] has been > > > > merged, it's now time to change the kernel client to use the new > > > > 'copy-from2'. And that's what this patch does. > > > > > > > > [1] https://lore.kernel.org/lkml/20191118120935.7013-1-lhenriques@suse.com/ > > > > [2] https://github.com/ceph/ceph/pull/31728 > > > > > > > > fs/ceph/file.c | 13 ++++++++++++- > > > > fs/ceph/super.c | 1 + > > > > fs/ceph/super.h | 3 +++ > > > > include/linux/ceph/osd_client.h | 1 + > > > > include/linux/ceph/rados.h | 2 ++ > > > > net/ceph/osd_client.c | 18 ++++++++++++------ > > > > 6 files changed, 31 insertions(+), 7 deletions(-) > > > > > > > > diff --git a/fs/ceph/file.c b/fs/ceph/file.c > > > > index 11929d2bb594..1e6cdf2dfe90 100644 > > > > --- a/fs/ceph/file.c > > > > +++ b/fs/ceph/file.c > > > > @@ -1974,6 +1974,10 @@ static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off, > > > > if (ceph_test_mount_opt(src_fsc, NOCOPYFROM)) > > > > return -EOPNOTSUPP; > > > > > > > > + /* Do the OSDs support the 'copy-from2' operation? */ > > > > + if (!src_fsc->have_copy_from2) > > > > + return -EOPNOTSUPP; > > > > + > > > > /* > > > > * Striped file layouts require that we copy partial objects, but the > > > > * OSD copy-from operation only supports full-object copies. Limit > > > > @@ -2101,8 +2105,15 @@ static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off, > > > > CEPH_OSD_OP_FLAG_FADVISE_NOCACHE, > > > > &dst_oid, &dst_oloc, > > > > CEPH_OSD_OP_FLAG_FADVISE_SEQUENTIAL | > > > > - CEPH_OSD_OP_FLAG_FADVISE_DONTNEED, 0); > > > > + CEPH_OSD_OP_FLAG_FADVISE_DONTNEED, > > > > + dst_ci->i_truncate_seq, dst_ci->i_truncate_size, > > > > + CEPH_OSD_COPY_FROM_FLAG_TRUNCATE_SEQ); > > > > if (err) { > > > > + if (err == -EOPNOTSUPP) { > > > > + src_fsc->have_copy_from2 = false; > > > > + pr_notice("OSDs don't support 'copy-from2'; " > > > > + "disabling copy_file_range\n"); > > > > + } > > > > dout("ceph_osdc_copy_from returned %d\n", err); > > > > if (!ret) > > > > ret = err; > > > > > > The patch itself looks fine to me. I'll not merge yet, since you sent it > > > as an RFC, but I don't have any objection to it at first glance. > > > > I was going to drop the RFC, but then at the last minute decided to leave. > > > > > The > > > only other comment I'd make is that you should probably split this into > > > two patches -- one for the libceph changes and one for cephfs. > > > > Hmm... TBH I didn't thought about that, but since the libceph patch would > > be changing its API (ceph_osdc_copy_from would have 2 extra parameters), I > > don't think that's a good idea. Bisection would be broken between these 2 > > patches. > In that case, I'll just go ahead and do some testing with this patch and will plan to merge it as-is, assuming that goes ok. -- Jeff Layton