From patchwork Fri Sep 7 07:39:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 10591775 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 351116CB for ; Fri, 7 Sep 2018 07:39:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28F2B2A63B for ; Fri, 7 Sep 2018 07:39:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D2C32A65D; Fri, 7 Sep 2018 07:39:42 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88E322A63B for ; Fri, 7 Sep 2018 07:39:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7376D6B7D2C; Fri, 7 Sep 2018 03:39:38 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6E7776B7D2D; Fri, 7 Sep 2018 03:39:38 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5FC1D6B7D2E; Fri, 7 Sep 2018 03:39:38 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id 1D1AE6B7D2C for ; Fri, 7 Sep 2018 03:39:38 -0400 (EDT) Received: by mail-pf1-f199.google.com with SMTP id x19-v6so7171466pfh.15 for ; Fri, 07 Sep 2018 00:39:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id; bh=2I8C52TVw7bv1SfuKFyR5TpS70Q9+ucmYJd+IOpKv6o=; b=L6TypDNXMXy53Xx8agAfMbHe01PPY3wDOgDW8UOv2zYWuh4gKxkmPkwKg0EdLKKgqk KJQtR6x+uLc/u+6+M25n20WKVvEhC8VsFUoH7LLXhzqPCUlpK4/hDj3cOANntMbsg98A LNEDjEczIetHKHkUhi40mdpQbo0Omqkxtn/62sDhp/xPhacy+j41rBCYdJHvHaL/FfsX RyV8lFG5RASqM/QC3l4dUuyv2yzlTLaNBN9SEQtYiEmliCi4+WqsBEQ+jU3nrQJMS6oV Adn3gJMLRLC4oHiN1Jv4WLfRZMbVQGD8yHIrL3Rt5h7CIhBD0RaW4x0bsmFUVFLj82ir hzfQ== X-Gm-Message-State: APzg51CZnM6A9ZzDTHuPnDWQuHq2XF6MEfjt/h5x3f8QRR5EjXOzJ4ns nNpvdasuBtmnMPQnc75ZK09NLHAv8yBQA8a73YLMfCujle89MfmHuFqZqo/4LzVdzPkfWFTH5O8 ef31vfh/KtzjNAUKX/pSABYFp8YdEY36cmhumU9yMu8BKoRs2hFxnwG/iaGj+E9szvrv4HK+8mv +XIBWgqOlNLCxhd1NIyGcMKn6c3pdNN/5N/aQf8VqjyUOZKbleiod3K2bEfkJCjUXgLC1Cbc8p9 TOmpSJUigB8Bf8LtbBUPok+i2uMKpDHlAlijd/1FEgdB2xH2uIwmTP0b5Kc6Wt/0ODlW7EwAK/p 8sa7mVYMpxYhqnzEPHZlWSWL+vDZtzlS6NcbnWqEiL9gpNJsYjfNBR4kPdLF9lK/0EPwLfWhcf1 S X-Received: by 2002:a62:c218:: with SMTP id l24-v6mr7055864pfg.185.1536305977754; Fri, 07 Sep 2018 00:39:37 -0700 (PDT) X-Received: by 2002:a62:c218:: with SMTP id l24-v6mr7055825pfg.185.1536305976954; Fri, 07 Sep 2018 00:39:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536305976; cv=none; d=google.com; s=arc-20160816; b=cnAqrttgj+7tV2mWMGdEhrBQtEDZCJ/WJcdojgIA68zyrYOi1PSnMu12LejfvMc99d cB753XICU/0jkksoGAyqeLCESMQ0TtoTKTtL8mXsHOc62qfKJGkP2vixN8/iOcN1A3d9 fb2jEurmIxEMlMfle5FlNldmMrtoFG5CCChkluGYv4kTAbAwpS3+tewYaTxuifkN+BBy 5rsFnGUNFMbvHkpKVWLqQraeWBL6j6qtnZ6jHbNiw0Qd8Ndz16IKh9y+HGRDYSxsEyve X4ylupFujILbySk9WjsSLaOz9sq2HDJFcoWz/HXtRkrevJeep4Kv4yCsCN8z9+zZEEam PekA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature; bh=2I8C52TVw7bv1SfuKFyR5TpS70Q9+ucmYJd+IOpKv6o=; b=ZE6KE0BynXxZTv1YeAZ3gjC483l/YprzBEd3oAZ6AxKz6TpI9HYFofLvf1y4dWrqZv 7ldM/lxJWzlYj7VmH67B2tCNJGzgKDG2m6uo6RCdWtyXI6UBI/KCyp9VDqYCV/bwPKe5 fFMBROABvdt/Rd+osT2dq8SW3m4viBDx/bESyudTcxPcRNj1ufIApVRuPHZQXEcmQqTj HNxlhD14a9QqSvQIITt0WWZf+q2GiM7Ye4ffiXa2RkIzWTeyNk0Xxt1U8yLZt4X0JhYu dYRPtXAOrgCdbh1Gn+1NaFZaV/zcrRqeQHZl3gsf/bI8GeUO1DYNpuhwQwKP4zYibteY 3D3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@osandov-com.20150623.gappssmtp.com header.s=20150623 header.b=dCKcDkXa; spf=neutral (google.com: 209.85.220.65 is neither permitted nor denied by best guess record for domain of osandov@osandov.com) smtp.mailfrom=osandov@osandov.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id d18-v6sor1321394pgp.3.2018.09.07.00.39.36 for (Google Transport Security); Fri, 07 Sep 2018 00:39:36 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.65 is neither permitted nor denied by best guess record for domain of osandov@osandov.com) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@osandov-com.20150623.gappssmtp.com header.s=20150623 header.b=dCKcDkXa; spf=neutral (google.com: 209.85.220.65 is neither permitted nor denied by best guess record for domain of osandov@osandov.com) smtp.mailfrom=osandov@osandov.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=2I8C52TVw7bv1SfuKFyR5TpS70Q9+ucmYJd+IOpKv6o=; b=dCKcDkXatPW3FsppqMZ/KB6xplZ4Bh7JGwHBH3rA0Uq3sRwgPaiaq06Fbd2aSvtu8j 7BHEQCpAZMYT3JDdcaZ7D1IV9moJG+wOnRBHpvhlOwSuNqANTmqWQzqaEWlRETKYHymO 2Zd8znezUys0ZqMlEL+pvgAyXPa+BBaiX27CPA4Q9z7QerA//ZZhUtceFg5wTgU3qWpP 35stJOtIF/hwkM6kAyFj7q5LHegBePFHX8DzRurR0ltfoSO0MRPpsiiTsF/mdlbB3UpE hVzQeBvgLbfE/Gmsg648uS/omtuRAIHLNnY/O+gTO2cvZFgVV9uUEiTsoLzYI8kQDC1t vC6Q== X-Google-Smtp-Source: ANB0VdYR4p6Hg/NdKGjhNzCmBeIrgNkWqCse1qSu+VTqA/Us1YifjuGMTc0MdfTI8H/naqOt8yJLHw== X-Received: by 2002:a63:5465:: with SMTP id e37-v6mr6914717pgm.316.1536305976186; Fri, 07 Sep 2018 00:39:36 -0700 (PDT) Received: from vader.thefacebook.com ([2620:10d:c090:180::1:904c]) by smtp.gmail.com with ESMTPSA id i65-v6sm16276914pfk.43.2018.09.07.00.39.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Sep 2018 00:39:35 -0700 (PDT) From: Omar Sandoval To: linux-btrfs@vger.kernel.org Cc: kernel-team@fb.com, linux-mm@kvack.org Subject: [PATCH v6 0/6] Btrfs: implement swap file support Date: Fri, 7 Sep 2018 00:39:14 -0700 Message-Id: X-Mailer: git-send-email 2.18.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Omar Sandoval Hi, This series implements swap file support for Btrfs. Compared to v5 [1], this is pretty much feature-complete. It now supports: - Balance (skips block groups containing an active swap file) - Resize (error if trying to shrink past a block group containing an active swap file, allowed otherwise) - Device delete/replace (as long as the device in question does not contain an active swap file) This implementation Chris and I came up with is much cleaner than my earlier ideas: instead of adding any counters to struct btrfs_block_group_cache or struct btrfs_device, we just have a small red-black tree of block groups and devices which contain an active swapfile. I updated the xfstests for this series [2] to test this new functionality, and put it through the same tests as v5. Based on v4.19-rc2, please take a look. Thanks! 1: https://www.spinics.net/lists/linux-btrfs/msg81550.html 2: https://github.com/osandov/xfstests/tree/btrfs-swap Omar Sandoval (6): mm: split SWP_FILE into SWP_ACTIVATED and SWP_FS mm: export add_swap_extent() vfs: update swap_{,de}activate documentation Btrfs: prevent ioctls from interfering with a swap file Btrfs: rename get_chunk_map() and make it non-static Btrfs: support swap files Documentation/filesystems/Locking | 17 +- Documentation/filesystems/vfs.txt | 12 +- fs/btrfs/ctree.h | 24 +++ fs/btrfs/dev-replace.c | 8 + fs/btrfs/disk-io.c | 4 + fs/btrfs/inode.c | 316 ++++++++++++++++++++++++++++++ fs/btrfs/ioctl.c | 31 ++- fs/btrfs/relocation.c | 18 +- fs/btrfs/volumes.c | 71 +++++-- fs/btrfs/volumes.h | 9 + include/linux/swap.h | 13 +- mm/page_io.c | 6 +- mm/swapfile.c | 14 +- 13 files changed, 492 insertions(+), 51 deletions(-)