From patchwork Tue Jan 8 11:43:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 10751907 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 2EDA391E for ; Tue, 8 Jan 2019 11:43:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D9301FFE6 for ; Tue, 8 Jan 2019 11:43:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 102FA28BD5; Tue, 8 Jan 2019 11:43:23 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 AA4831FFE6 for ; Tue, 8 Jan 2019 11:43:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728767AbfAHLnV (ORCPT ); Tue, 8 Jan 2019 06:43:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:50004 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727701AbfAHLnV (ORCPT ); Tue, 8 Jan 2019 06:43:21 -0500 Received: from localhost.localdomain (bl8-197-74.dsl.telepac.pt [85.241.197.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9472C206B7 for ; Tue, 8 Jan 2019 11:43:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546947801; bh=3vL/rRppxFo6EHrCqxEhe0EvIcqb3zH2dsfE2IYqMQA=; h=From:To:Subject:Date:From; b=thWWjQwnat2Sz10EUbBXhpKg29vQh0ckfv6ZFyY2wNsvV/oPLO9fQh/Byn1f6do7N UL5PbG/j6IDiC+YW8CccT0Uecdr52XQrh5JzDRvUipplU8KzVV11E6heZOc+rxrFW3 74a7YPXnOEL5VGN89irlJZCOPPrwp1sR9Bs/l4kk= From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH] Btrfs: remove redundant check for swapfiles when reflinking Date: Tue, 8 Jan 2019 11:43:18 +0000 Message-Id: <20190108114318.3711-1-fdmanana@kernel.org> X-Mailer: git-send-email 2.11.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: Filipe Manana Checking if either of the inodes corresponds to a swapfile is already performed by generic_remap_file_range_prep(), so we do not need to do it in the btrfs clone and deduplication functions. Signed-off-by: Filipe Manana Reviewed-by: David Sterba --- fs/btrfs/ioctl.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 996a26befc1d..c8749e0a36f3 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -3286,9 +3286,6 @@ static int btrfs_extent_same(struct inode *src, u64 loff, u64 olen, (BTRFS_I(dst)->flags & BTRFS_INODE_NODATASUM)) return -EINVAL; - if (IS_SWAPFILE(src) || IS_SWAPFILE(dst)) - return -ETXTBSY; - tail_len = olen % BTRFS_MAX_DEDUPE_LEN; chunk_count = div_u64(olen, BTRFS_MAX_DEDUPE_LEN); if (chunk_count == 0) @@ -3913,9 +3910,6 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src, (BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM)) return -EINVAL; - if (IS_SWAPFILE(src) || IS_SWAPFILE(inode)) - return -ETXTBSY; - /* * VFS's generic_remap_file_range_prep() protects us from cloning the * eof block into the middle of a file, which would result in corruption