From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E3FCC169C4 for ; Tue, 29 Jan 2019 07:19:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4D1A62177E for ; Tue, 29 Jan 2019 07:19:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PjPxLlBt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726531AbfA2HTK (ORCPT ); Tue, 29 Jan 2019 02:19:10 -0500 Received: from mail-yw1-f42.google.com ([209.85.161.42]:36555 "EHLO mail-yw1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725446AbfA2HTK (ORCPT ); Tue, 29 Jan 2019 02:19:10 -0500 Received: by mail-yw1-f42.google.com with SMTP id i73so7821453ywg.3; Mon, 28 Jan 2019 23:19:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jDZ4Y2CVh4nkRdrEuUsgmN7J7H0jXtIgmXZVQmxkvOg=; b=PjPxLlBt9hWTb7vnebXmt+6DYu7sQVjuLKNDognewzW0n3EyJDPV2fL8E8dpTcHsku DJcN18kDHr8SJqyeCRQGVO0vEaJJSWwV5A7RHxYmebvCbfcMapovOyJDO3FAluPTfwCe zIgGrmzyMHy5GmT3T8VzS1DHaGUCsDFB5L9VV4002mz/NTBW0Y+UKYOqEN23gN0QjMsr UcJUfTPLAmO8osodN4WOlGKvhdcgyEOHiiiZCxNTQ6lvSakfO3K0H+Zi6Gz1/AWTxQFR wXXs3QsA6UkCSH5g27Kl8QfIMvQdOlURhrBFuCPMJ9AR4QDo5lbibX+Q1o5nIqq0I4Ia hqIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jDZ4Y2CVh4nkRdrEuUsgmN7J7H0jXtIgmXZVQmxkvOg=; b=oEfRT/tbwsZLhGmzi68MWuwCHCy+nl+Uk3OwGZyQnPXJuC8XU+fx4USygq6jBeDP7I GYO42X4OxoypnFR2l2T6h/BlYilEsfZqNupSVVqza+NdYwJWQA6zRXXg1mvADEVlnGSk IiVrKjuEPQaOgUcmw90YA6B2/UX/cOti75c3SnIGwrkfYy5vQ1kd3tiLXvfwYtaa2vGX 0x3tpycBeL7KRRaNdXW/r5rBA+2BU5S0PqN02k7iJPIZDzhBK2NOkD6+330UbFwTlQ6v JJNrcrQyxvzn3kMZ3SSMde+CpdBON/44TOiZbbboN0NH1erpDNwSzaWoPSTpdpNMOdNQ breg== X-Gm-Message-State: AJcUukfNykvjJ7eYcwfzw/ou6Bp3r3mfsfLFxE8ckwBR2w+yaRVin4eJ 7LgPaYTDMzhXPzqMbHCMFMTsQ9au36mIiviKx0Y= X-Google-Smtp-Source: ALg8bN4BF6uqU/w2DhN9cwk8J2mnBSJ2D7bpBOgtSWUN2M2If2WArItUrG3ptFlqcQw/GIUba+Z0Tyn75O4frtyI4EY= X-Received: by 2002:a81:6382:: with SMTP id x124mr23816082ywb.248.1548746348807; Mon, 28 Jan 2019 23:19:08 -0800 (PST) MIME-Version: 1.0 References: <20190128125044.GC27972@quack2.suse.cz> <20190128212642.GQ4205@dastard> <20190129001826.GV4205@dastard> In-Reply-To: <20190129001826.GV4205@dastard> From: Amir Goldstein Date: Tue, 29 Jan 2019 09:18:57 +0200 Message-ID: Subject: Re: [LSF/MM TOPIC] Lazy file reflink To: Dave Chinner Cc: Jan Kara , lsf-pc@lists.linux-foundation.org, linux-fsdevel , linux-xfs , "Darrick J. Wong" , Christoph Hellwig Content-Type: text/plain; charset="UTF-8" Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org > > I think it's a good idea to add file freeze semantics to the toolbox > > of useful things that could be accomplished with reflink. > > reflink is already atomic w.r.t. other writes - in what way does a > "file freeze" have any impact on a reflink operation? that is, apart > from preventing it from being done, because reflink can modify the > source inode on XFS, too.... > - create O_TMPFILE - freeze source file - read and calculate hash from source file - likely unfreeze and skip reflink+backup For the unlikely case, application could copy_file_range before unfreeze and that means that reflink of source should be allowed while file is frozen, that is, while file *data* is frozen. That mean that file freeze API needs to be able to express if both metadata and data freeze are required. > > Anyway, freeze semantics alone won't work for our backup application > > that needs to be non intrusive. Even if writes to large file are few, > > backup may take time, so blocking those few write for that long is > > not acceptable. > > So, reflink is too expensive because there are only occasional > writes, but blocking that occasional write is too expensive, too, > even though it is rare? > All right. I admit to have presented a weak example, but I am not submitting a patch to be merged. I am proposing a discussion on what I think is a gap in existing API. The feedback of "what is the measurable benefits?" is well expected, but I brought this up anyway, without concrete measurable figures to hear what others have to say. And frankly, I quite like the file freeze suggestion, so I am glad that I did. Besides, even if existing filesystems implement reflink fast "enough", this is not at all an mandated by the API. > > Blocking the writes for the setup time of a reflink > > is exactly what I was proposing and in your analogy, > > No, I proposed a way to provide a -point in time snapshot- of a > file that doesn't require reflink or any other special filesystem > support. > > > the block > > device is frozen only for a short period of time for setting up the > > snapshot and not for the duration of the backup. > > Right, it's frozen for as long as it takes to set up a -point in > time snapshot- that the backup can be taken from. You don't need > that to reflink a file. You need it if you want to do something > other than a reflink.... > Correct. As I wrote above, that could be used for conditional copy or conditional reflink on a filesystem where reflink has a measurable cost. Bottom line: I completely agree with you that "file freeze" is sufficient for the case I presented, as long as reflink is allowed while file is frozen. IOW, break the existing compound API freeze+reflink+unfreeze to individual operations to give more control over to user. Thanks, Amir.