From patchwork Thu Jan 25 23:56:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 10184939 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3BC91601D2 for ; Thu, 25 Jan 2018 23:56:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D4A728795 for ; Thu, 25 Jan 2018 23:56:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 21E0328BB4; Thu, 25 Jan 2018 23:56:31 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 805EA28795 for ; Thu, 25 Jan 2018 23:56:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751802AbeAYX42 (ORCPT ); Thu, 25 Jan 2018 18:56:28 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:39988 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751650AbeAYX41 (ORCPT ); Thu, 25 Jan 2018 18:56:27 -0500 Received: by mail-pf0-f194.google.com with SMTP id i66so6986821pfd.7 for ; Thu, 25 Jan 2018 15:56:26 -0800 (PST) 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=ikOuYc9ZeTFblSFggXbTF0QEteAzofg9IBWqUMUfzf0=; b=yJquedkt08lNCy8Kfy98GsdMODrdfCPCv/VOllDhNhlNstqNi1qM82Jpb1OBS70XgY C52+jbkesFprQEMs9WYW4GAEDEReL3iVN5HToHgvILAUaNrG43sdYW38QBgLHXdJAdPI xz7rvz9XjmPbvFTv9QlkXNSayMQSnlTj/cyZ8ba3QbGDumzb2OvnLgjD9jHyBZrzGFUn dtWaK6m53JpB+SN0IbKUADFF/lQt7hypHpYPUVLjLJnwRfs77UnxUx1bPjUQnnfwrrye F95FQ1MxrDwsD1JVZkZlNQGnXgqgzwBY4ExhC16h5fWaFxQ6Lxjy9qz6EU7iP4ogZ2pj AQgA== 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=ikOuYc9ZeTFblSFggXbTF0QEteAzofg9IBWqUMUfzf0=; b=ZmkZzG+wTLJGTcA/ScKPWgD3BP3riW9fbd9qibfnKqgEmb9b8H+B8J+x17qhuZ2JF3 GmjEKmp+k5o9ownyrSxjTjdL57SDKvYSuCwWUhmNAFzabvDxGZKlRjyytMg9DHCniDx5 BmBW735O2dCeP6wh7flv5VPZIF1imSFi04rab512Ku+65P8mLAiJk9cUMk4GMrZ++7bc aIGZUPnW7dtPOlWC3XcgBz+zOLC/3cHB2QtWyJPMG04iDs4aEeMYYENZmRf+Ct+VZAXF z5MIea1a+4hIWuhzi05/ZNy329g8c8e36X/+riaS6t9Mz4cstQM54kctOPuoe6BNht7Z s+gw== X-Gm-Message-State: AKwxytcBwfoya3on09Mvvnat5FFo1Eje98VzOet5DinC4+kr6jTdrThK kcHy0t+NRR74jEbZQttjneg+9WIMkj8= X-Google-Smtp-Source: AH8x226xE7+VToIcPx9DJbhFPigavbNbynpG/raw+Bau8Fvrd41kFoyRyPiKuvTIafJd197TyHfbGQ== X-Received: by 2002:a17:902:8b8a:: with SMTP id ay10-v6mr12511191plb.156.1516924585817; Thu, 25 Jan 2018 15:56:25 -0800 (PST) Received: from vader.thefacebook.com ([2620:10d:c090:200::6:6c0]) by smtp.gmail.com with ESMTPSA id p75sm18041580pfi.148.2018.01.25.15.56.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jan 2018 15:56:25 -0800 (PST) From: Omar Sandoval To: linux-btrfs@vger.kernel.org Cc: kernel-team@fb.com Subject: [PATCH] Btrfs: delete dead code in btrfs_orphan_add() Date: Thu, 25 Jan 2018 15:56:17 -0800 Message-Id: X-Mailer: git-send-email 2.16.1 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 btrfs_orphan_add() has had this case commented out since it was first introduced in commit d68fc57b7e32 ("Btrfs: Metadata reservation for orphan inodes"). Most of the orphan cleanup code has been rewritten since then, so it's safe to say that this code isn't needed. Signed-off-by: Omar Sandoval Reviewed-by: Nikolay Borisov --- fs/btrfs/inode.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index e1a7f3cb5be9..d4e3a09c0ea4 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3334,17 +3334,6 @@ int btrfs_orphan_add(struct btrfs_trans_handle *trans, if (!test_and_set_bit(BTRFS_INODE_HAS_ORPHAN_ITEM, &inode->runtime_flags)) { -#if 0 - /* - * For proper ENOSPC handling, we should do orphan - * cleanup when mounting. But this introduces backward - * compatibility issue. - */ - if (!xchg(&root->orphan_item_inserted, 1)) - insert = 2; - else - insert = 1; -#endif insert = 1; atomic_inc(&root->orphan_inodes); } @@ -3370,7 +3359,7 @@ int btrfs_orphan_add(struct btrfs_trans_handle *trans, } /* insert an orphan item to track this unlinked/truncated file */ - if (insert >= 1) { + if (insert) { ret = btrfs_insert_orphan_item(trans, root, btrfs_ino(inode)); if (ret) { atomic_dec(&root->orphan_inodes); @@ -3389,15 +3378,6 @@ int btrfs_orphan_add(struct btrfs_trans_handle *trans, ret = 0; } - /* insert an orphan item to track subvolume contains orphan files */ - if (insert >= 2) { - ret = btrfs_insert_orphan_item(trans, fs_info->tree_root, - root->root_key.objectid); - if (ret && ret != -EEXIST) { - btrfs_abort_transaction(trans, ret); - return ret; - } - } return 0; }