From patchwork Fri Jun 24 22:15:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Mahoney X-Patchwork-Id: 9198193 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 85DB06077D for ; Fri, 24 Jun 2016 22:15:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6FF30284D7 for ; Fri, 24 Jun 2016 22:15:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64ABF284DD; Fri, 24 Jun 2016 22:15:52 +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.9 required=2.0 tests=BAYES_00,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 E1834284D7 for ; Fri, 24 Jun 2016 22:15:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751531AbcFXWPr (ORCPT ); Fri, 24 Jun 2016 18:15:47 -0400 Received: from mx2.suse.de ([195.135.220.15]:37873 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751501AbcFXWPc (ORCPT ); Fri, 24 Jun 2016 18:15:32 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 6FE80ADE8 for ; Fri, 24 Jun 2016 22:15:28 +0000 (UTC) Received: by starscream.home.jeffm.io (Postfix, from userid 1000) id 73B5585046; Fri, 24 Jun 2016 18:15:25 -0400 (EDT) From: jeffm@suse.com To: linux-btrfs@vger.kernel.org Subject: [PATCH 28/31] btrfs: root->fs_info cleanup, access fs_info->delayed_root directly Date: Fri, 24 Jun 2016 18:15:21 -0400 Message-Id: <1466806524-27508-29-git-send-email-jeffm@suse.com> X-Mailer: git-send-email 2.7.1 In-Reply-To: <1466806524-27508-1-git-send-email-jeffm@suse.com> References: <1466806524-27508-1-git-send-email-jeffm@suse.com> 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: Jeff Mahoney This results in btrfs_assert_delayed_root_empty and btrfs_destroy_delayed_inode taking an fs_info instead of a root. Signed-off-by: Jeff Mahoney --- fs/btrfs/delayed-inode.c | 23 ++++++----------------- fs/btrfs/delayed-inode.h | 4 ++-- fs/btrfs/disk-io.c | 8 ++++---- fs/btrfs/transaction.c | 2 +- 4 files changed, 13 insertions(+), 24 deletions(-) diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index 370f398..733d7bc 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c @@ -72,12 +72,6 @@ static inline int btrfs_is_continuous_delayed_item( return 0; } -static inline struct btrfs_delayed_root *btrfs_get_delayed_root( - struct btrfs_root *root) -{ - return root->fs_info->delayed_root; -} - static struct btrfs_delayed_node *btrfs_get_delayed_node(struct inode *inode) { struct btrfs_inode *btrfs_inode = BTRFS_I(inode); @@ -1184,7 +1178,7 @@ static int __btrfs_run_delayed_items(struct btrfs_trans_handle *trans, block_rsv = trans->block_rsv; trans->block_rsv = &fs_info->delayed_block_rsv; - delayed_root = btrfs_get_delayed_root(root); + delayed_root = fs_info->delayed_root; curr_node = btrfs_first_delayed_node(delayed_root); while (curr_node && (!count || (count && nr--))) { @@ -1411,11 +1405,9 @@ static int btrfs_wq_run_delayed_node(struct btrfs_delayed_root *delayed_root, return 0; } -void btrfs_assert_delayed_root_empty(struct btrfs_root *root) +void btrfs_assert_delayed_root_empty(struct btrfs_fs_info *fs_info) { - struct btrfs_delayed_root *delayed_root; - delayed_root = btrfs_get_delayed_root(root); - WARN_ON(btrfs_first_delayed_node(delayed_root)); + WARN_ON(btrfs_first_delayed_node(fs_info->delayed_root)); } static int could_end_wait(struct btrfs_delayed_root *delayed_root, int seq) @@ -1436,7 +1428,7 @@ void btrfs_balance_delayed_items(struct btrfs_root *root) struct btrfs_delayed_root *delayed_root; struct btrfs_fs_info *fs_info = root->fs_info; - delayed_root = btrfs_get_delayed_root(root); + delayed_root = fs_info->delayed_root; if (atomic_read(&delayed_root->items) < BTRFS_DELAYED_BACKGROUND) return; @@ -1990,14 +1982,11 @@ void btrfs_kill_all_delayed_nodes(struct btrfs_root *root) } } -void btrfs_destroy_delayed_inodes(struct btrfs_root *root) +void btrfs_destroy_delayed_inodes(struct btrfs_fs_info *fs_info) { - struct btrfs_delayed_root *delayed_root; struct btrfs_delayed_node *curr_node, *prev_node; - delayed_root = btrfs_get_delayed_root(root); - - curr_node = btrfs_first_delayed_node(delayed_root); + curr_node = btrfs_first_delayed_node(fs_info->delayed_root); while (curr_node) { __btrfs_kill_delayed_node(curr_node); diff --git a/fs/btrfs/delayed-inode.h b/fs/btrfs/delayed-inode.h index 0167853..67b2153 100644 --- a/fs/btrfs/delayed-inode.h +++ b/fs/btrfs/delayed-inode.h @@ -134,7 +134,7 @@ int btrfs_delayed_delete_inode_ref(struct inode *inode); void btrfs_kill_all_delayed_nodes(struct btrfs_root *root); /* Used for clean the transaction */ -void btrfs_destroy_delayed_inodes(struct btrfs_root *root); +void btrfs_destroy_delayed_inodes(struct btrfs_fs_info *fs_info); /* Used for readdir() */ void btrfs_get_delayed_items(struct inode *inode, struct list_head *ins_list, @@ -151,6 +151,6 @@ int __init btrfs_delayed_inode_init(void); void btrfs_delayed_inode_exit(void); /* for debugging */ -void btrfs_assert_delayed_root_empty(struct btrfs_root *root); +void btrfs_assert_delayed_root_empty(struct btrfs_fs_info *fs_info); #endif diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 867a69d..a428e4e3 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -4466,8 +4466,8 @@ void btrfs_cleanup_one_transaction(struct btrfs_transaction *cur_trans, cur_trans->state = TRANS_STATE_UNBLOCKED; wake_up(&fs_info->transaction_wait); - btrfs_destroy_delayed_inodes(root); - btrfs_assert_delayed_root_empty(root); + btrfs_destroy_delayed_inodes(fs_info); + btrfs_assert_delayed_root_empty(fs_info); btrfs_destroy_marked_extents(root, &cur_trans->dirty_pages, EXTENT_DIRTY); @@ -4528,8 +4528,8 @@ static int btrfs_cleanup_transaction(struct btrfs_root *root) } spin_unlock(&fs_info->trans_lock); btrfs_destroy_all_ordered_extents(fs_info); - btrfs_destroy_delayed_inodes(root); - btrfs_assert_delayed_root_empty(root); + btrfs_destroy_delayed_inodes(fs_info); + btrfs_assert_delayed_root_empty(fs_info); btrfs_destroy_pinned_extent(root, fs_info->pinned_extents); btrfs_destroy_all_delalloc_inodes(fs_info); mutex_unlock(&fs_info->transaction_kthread_mutex); diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index ede1bea..a976373 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -2140,7 +2140,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, * make sure none of the code above managed to slip in a * delayed item */ - btrfs_assert_delayed_root_empty(root); + btrfs_assert_delayed_root_empty(fs_info); WARN_ON(cur_trans != trans->transaction);