From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org)
	by finch.gentoo.org with esmtp (Exim 4.60)
	(envelope-from <gentoo-dev+bounces-48765-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1RULAb-0000VK-Sp
	for garchives@archives.gentoo.org; Sat, 26 Nov 2011 16:32:06 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 5AC0721C0E0;
	Sat, 26 Nov 2011 16:31:57 +0000 (UTC)
Received: from mail-gy0-f181.google.com (mail-gy0-f181.google.com [209.85.160.181])
	by pigeon.gentoo.org (Postfix) with ESMTP id A7B8221C059
	for <gentoo-dev@lists.gentoo.org>; Sat, 26 Nov 2011 16:31:32 +0000 (UTC)
Received: by ghrr13 with SMTP id r13so5569770ghr.40
        for <gentoo-dev@lists.gentoo.org>; Sat, 26 Nov 2011 08:31:32 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=mime-version:sender:in-reply-to:references:from:date
         :x-google-sender-auth:message-id:subject:to:cc:content-type
         :content-transfer-encoding;
        bh=I90AEnmFWeNNysZuZv0EhHg+Bgy/Wreh/i2dRnz5X18=;
        b=IK5wCgD7sABYv4bb380L1CeNzHrxx6GrYNCzBOLtZkMb7SDcOlJe084ja4vDMSEFkL
         apQV6MfSDDDafa3aVh2gB9yuUFh4GsaiYmUXKItjP9xqutT9eduGm12CbUYG58zyXJYB
         CHrrtMsJdtmIQjtfN40zD9cSXHhMhgbSzFnPU=
Received: by 10.182.2.225 with SMTP id 1mr11163490obx.30.1322325092095; Sat,
 26 Nov 2011 08:31:32 -0800 (PST)
Precedence: bulk
List-Post: <mailto:gentoo-dev@lists.gentoo.org>
List-Help: <mailto:gentoo-dev+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-dev+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-dev+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-dev.gentoo.org>
X-BeenThere: gentoo-dev@lists.gentoo.org
Reply-to: gentoo-dev@lists.gentoo.org
MIME-Version: 1.0
Sender: nirbheek.chauhan@gmail.com
Received: by 10.182.150.3 with HTTP; Sat, 26 Nov 2011 08:31:11 -0800 (PST)
In-Reply-To: <20111126170831.16d9d656@pomiocik.lan>
References: <1d4ac47c28706094230cb2c4e6ee1c1c71629aa0.arfrever@gentoo>
 <20111126105822.GA37825@gentoo.org> <CADqQcK6XB489Lyrf+=01k_8HQD98Pk8Hp+gVBOKz+UfH83hzFQ@mail.gmail.com>
 <20111126113830.GC37825@gentoo.org> <CADqQcK5pW7nWnqPXc_yu6N0Kpfqd+Ekif-uS_g3A3L_dyykkMA@mail.gmail.com>
 <20111126125915.428cb31a@googlemail.com> <CAGfcS_k+jKAxsq9znTp+5_fuWkuzi78=hLpCi+wWA_RLqWkJtw@mail.gmail.com>
 <20111126160936.64eeee1c@pomiocik.lan> <CADqQcK4g_QaZK-VuK6D3Y5=S_5jVhEPo64XPGVx36=ZopMQHbA@mail.gmail.com>
 <20111126170831.16d9d656@pomiocik.lan>
From: Nirbheek Chauhan <nirbheek@gentoo.org>
Date: Sat, 26 Nov 2011 22:01:11 +0530
X-Google-Sender-Auth: YuEDuy85YX7QZR-fgi0HdWbTt_U
Message-ID: <CADqQcK49=XAevNBNOzORYajS1NsAPDXvO1x3erz9-_E9ViF8qw@mail.gmail.com>
Subject: Re: [gentoo-dev] Re: proj/portage:master commit in: pym/portage/dbapi/
To: =?UTF-8?B?TWljaGHFgiBHw7Nybnk=?= <mgorny@gentoo.org>
Cc: gentoo-dev@lists.gentoo.org, rich0@gentoo.org
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Archives-Salt: af419d96-7d08-4437-8850-47e74f5ebbd0
X-Archives-Hash: f2c1c957095a9c56a101f87790fdd3b3

On Sat, Nov 26, 2011 at 9:38 PM, Micha=C5=82 G=C3=B3rny <mgorny@gentoo.org>=
 wrote:
> On Sat, 26 Nov 2011 21:28:51 +0530
> Nirbheek Chauhan <nirbheek@gentoo.org> wrote:
>> There are still a few specific cases in which CoW would indeed be
>> useful. IIRC, reflinking of files works across btrfs *subvolumes*, and
>> such a copy would normally be detected as a cross-device move.
>
> For such a thing, shouldn't rename() work neat anyway?
>

No, because reflink is an ioctl that works directly on the FS level by
sharing data blocks, and should theoretically not bother about the
file hierarchy. On the other hand, rename() is a userland API and must
behave itself.

>> Another use would be an patch-merge which makes use of *ranged
>> reflinks* to only CoW copy those parts of the file that were
>> changed[1]. rsync has support for this, but only while appending to
>> files (--append-verify --no-whole-file).
>
> So, it'd be like:
> 1) CoW-dup old file,
> 2) patch-merge into the duped old file,
> 3) replace.
>
> Am I understanding correctly?
>

You can do that, or perhaps you can just do the patch-merge in-place.
Not sure about the crash guarantees in the latter case. The former
(rename) is documented here:
https://btrfs.wiki.kernel.org/articles/f/a/q/FAQ_1fe9.html#What_are_the_cra=
sh_guarantees_of_overwrite-by-rename.3F

But in all this, the hard part is really the "patch-merge" for
anything except appends. ;)

--=20
~Nirbheek Chauhan

Gentoo GNOME+Mozilla Team