From patchwork Fri Aug 31 22:36:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 10584515 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 6EC8F920 for ; Fri, 31 Aug 2018 22:36:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 617EF2BB98 for ; Fri, 31 Aug 2018 22:36:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53FA62C6B9; Fri, 31 Aug 2018 22:36:51 +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 CFBAD2BB98 for ; Fri, 31 Aug 2018 22:36:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727430AbeIACqX (ORCPT ); Fri, 31 Aug 2018 22:46:23 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:42628 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726915AbeIACqX (ORCPT ); Fri, 31 Aug 2018 22:46:23 -0400 Received: by mail-pf1-f193.google.com with SMTP id l9-v6so6114922pff.9 for ; Fri, 31 Aug 2018 15:36:48 -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=NDdHdOR6YCLHOZmT4bvgpAiavIMzMAStBDBf5WfKspI=; b=xTStNqYPCdBWBQNVATOqY5mvTXSTczZcgKtsSLOBM4rBZdGyceGRNNS8vevyWj4V3/ oCbl0qDYt9oongbIUh8CJoK1nmzVdLq/hBZb6ouR4L+85QBvTiMZVCiN0LAzuNFbmcZT 43TL7+mws1dzVe7YJFIf4w4Kaq3P0tB3Fa4/RoaPfUod3WOjar3g1cQefHpkuEWwWO6/ PO1NCJZ7dr7puIMjuYDTXOYUadGewYEt7EX6IMYq8kbjwsaHFrqR+piBSYFtnCXmsBUW Kcsx0eMn7gwl9P+BMCsbK6XNna0i2gUDKZMDcQmCgnFka/6tiHUIZP5gg1ppKhnuBI91 0c8A== 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=NDdHdOR6YCLHOZmT4bvgpAiavIMzMAStBDBf5WfKspI=; b=C/LAn1hHU/7cODEMy4r3VQchT32yqOO7JP4MBa9xcTkPs2L4x0iOIiGDtOlpWXNbP7 iSqpHqKSZJ9+Rxs7Q59fkof+N4tp4/w/bJ+w/odIIcF1IgrpwWLQY84QBstus0qfA/JL jkzDbvx+WQdUyMnZ2mlEsgvPwHXRaKKRs/YW8QLD5TCIrdzuVoQUjI39zt6Dio66B2gM D9+jukkgiVjJfgxrly+n4bUwcO/evIKayRseTA/S4jAolVDCwZCmZeUtZDaiVmldUl7U CTPsxIRZanHXfI+ee+N3/RoTRpMz0seWWUesPEyhPJySHNKOrvaXGMkry9Irteb4nFk0 3ztQ== X-Gm-Message-State: APzg51AG6jEmglCgV3I+nCPIe2TaIGSUAkJC7rhrqYTXWHZjqChKAFuM 1BEPfzq1xC7G8tMNt+9Hs0VJ5dfwxew= X-Google-Smtp-Source: ANB0VdZs3AmAyATeIcTIOr/a7nz5iQ6H3J4IrrzvehgqSBymZFd26M9aKgOLOnBFpV+kAM+8ls9Ldw== X-Received: by 2002:a63:d10c:: with SMTP id k12-v6mr16650361pgg.49.1535755007429; Fri, 31 Aug 2018 15:36:47 -0700 (PDT) Received: from vader.thefacebook.com ([2620:10d:c090:200::4:9733]) by smtp.gmail.com with ESMTPSA id r19-v6sm43427403pgo.43.2018.08.31.15.36.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Aug 2018 15:36:47 -0700 (PDT) From: Omar Sandoval To: linux-btrfs@vger.kernel.org Cc: kernel-team@fb.com Subject: [PATCH v5 0/6] Btrfs: implement swap file support Date: Fri, 31 Aug 2018 15:36:35 -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. Changes since v4 [1]: - Added a kernel doc for btrfs_get_chunk_map() - Got rid of "Btrfs: push EXCL_OP set into btrfs_rm_device()" - Made activate error messages more clear and consistent - Changed clear vs unlock order in activate error case - Added "mm: export add_swap_extent()" as a separate patch - Added a btrfs_wait_ordered_range() at the beginning of btrfs_swap_activate() to catch newly created files - Added some Reviewed-bys from Nikolay I took a stab at adding support for balance when a swap file is active, but it's a major pain: we need to mark block groups which contain swap file extents, check the block group counter in relocate/scrub, then unmark the block groups when the swap file is deactivated, which gets really messy because the file can grow while it is an active swap file. If this is a deal breaker, I can work something out, but I don't think it's worth the trouble. This was tested with the swap tests in xfstests plus my new tests here [2]. Additionally, I used my swapme test program [3] and ran a few memory-intensive workloads (e.g., a highly parallel kernel build), verifying that swap was being used. All of this was done with lockdep enabled. This series is based on v4.19-rc1. Please take a look. Thanks! 1: https://www.spinics.net/lists/linux-btrfs/msg78731.html 2: https://github.com/osandov/xfstests/tree/btrfs-swap 3: https://github.com/osandov/osandov-linux/blob/master/scripts/swapme.c 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 | 6 + fs/btrfs/disk-io.c | 3 + fs/btrfs/inode.c | 232 ++++++++++++++++++++++++++++++ fs/btrfs/ioctl.c | 51 ++++++- fs/btrfs/volumes.c | 28 ++-- fs/btrfs/volumes.h | 9 ++ include/linux/swap.h | 13 +- mm/page_io.c | 6 +- mm/swapfile.c | 14 +- 11 files changed, 348 insertions(+), 43 deletions(-)