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=-10.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 195BEC433E0 for ; Mon, 13 Jul 2020 09:14:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E722B2067D for ; Mon, 13 Jul 2020 09:14:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729184AbgGMJOX (ORCPT ); Mon, 13 Jul 2020 05:14:23 -0400 Received: from mx2.suse.de ([195.135.220.15]:38618 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726380AbgGMJOW (ORCPT ); Mon, 13 Jul 2020 05:14:22 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 28378ACAF; Mon, 13 Jul 2020 09:14:23 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id F1348DA809; Mon, 13 Jul 2020 11:13:58 +0200 (CEST) Date: Mon, 13 Jul 2020 11:13:58 +0200 From: David Sterba To: Andrei Borzenkov Cc: Chris Murphy , Ken D'Ambrosio , Btrfs BTRFS Subject: Re: Btrfs default on Fedora? Message-ID: <20200713091358.GC3703@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Andrei Borzenkov , Chris Murphy , Ken D'Ambrosio , Btrfs BTRFS References: <933824829995390cef16f757cab1ddbc@jots.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Sun, Jul 12, 2020 at 08:28:32AM +0300, Andrei Borzenkov wrote: > 12.07.2020 00:18, Chris Murphy пишет: > > On Sat, Jul 11, 2020 at 12:44 PM Ken D'Ambrosio wrote: > > > >> * Swap files. At least last time I checked, it was a PITA to take a > >> snapshot of a volume that had a swapfile on it -- I wound up writing a > >> wrapper that goes, does a swapoff, removes the file, creates the > >> snapshot, and then re-creates the file. Is this still "a thing"? Or > >> is there a way to work around that that isn't kludgey? > > > > Put the swapfile in its own subvolume and don't snapshot it. One way > > is to create a (nested) subvolume named "swap" inside of the "root" > > subvolume created at installation time; use chattr +C on it; now > > create the swapfile per 'man 5 btrfs'. > > > > Since btrfs snapshots aren't recursive, making a snapshot of 'root' > > will not cause a snapshot to be taken of 'swap' or its swapfiles. > > swap file requires calculation of absolute disk offset (that is what > kernel works with) and this is not supported on btrfs with by systemd: When the swapfile is not used for suspend/resume, the offsets don't matter. The reads and writes build on generic DIO infrastructure, in the same way swap-over-NFS works that also does not have any physical offsets in general. > https://github.com/systemd/systemd/blob/d67b1d18fcda2c8c5aacfc50f9591c8dc7a4a8a1/src/shared/sleep-config.c#L240 > > I believe with current systemd if you manually compute and provide > resume=btrfs-partition and resume_offset=absolute-offset-of-swapfile it > should take it, but using resume=file-on-btrfs will fail. Yeah, that's where the swapfile is not accessed through the filesystem, so the block offsets need to be calculated externally.