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: 10591773 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 79BB913AC for ; Fri, 7 Sep 2018 07:39:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F6DA2A630 for ; Fri, 7 Sep 2018 07:39:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 506B12A661; Fri, 7 Sep 2018 07:39:41 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7337C2A630 for ; Fri, 7 Sep 2018 07:39:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726692AbeIGMTQ (ORCPT ); Fri, 7 Sep 2018 08:19:16 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:42633 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725940AbeIGMTQ (ORCPT ); Fri, 7 Sep 2018 08:19:16 -0400 Received: by mail-pf1-f193.google.com with SMTP id l9-v6so6602143pff.9 for ; Fri, 07 Sep 2018 00:39:37 -0700 (PDT) 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-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2I8C52TVw7bv1SfuKFyR5TpS70Q9+ucmYJd+IOpKv6o=; b=sDzL8surA3DG9Dpq8w4DB3BzZlDvWY1crG0lcq5WGLoalb43LTG0kKqa6PZRczi95H yMWNIjFJx7iod08YWUytQzpFxMWbnlV0PLNjC4TTo8Upt1IflKMOjlK3ua7mDHggd5zm izstFg6xpdw27aMdyJ3dbWuSmse5RfT2VCNH9UOj39fIN7tcy36Xp6LrBcKgj+SFRERe jZXHY/ORs45pLh4BZ6fLncg42wkk8N7CSCLoxLUqOoKmGQYVbDVn1ZyquBfMhIQ17xSW BsF2e/TZGWR9C3nN8MlZBeLuBki+1b+vnKz8tmpJTYOeOd42wqqVjt2qPxDeXlmwHpuv jncA== X-Gm-Message-State: APzg51DGFVaQ/dDZUFTsl/arvJkjEDvja4SMHnGD2zDEJmiDhfEvdaVY d4WhjDNUvJdr6W/rS6oOWB5tHPVareE= 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 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org 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(-)