From patchwork Mon Nov 17 13:05:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Dressler X-Patchwork-Id: 5318861 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 871929F2ED for ; Mon, 17 Nov 2014 13:05:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AE8992015E for ; Mon, 17 Nov 2014 13:05:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C623A2015A for ; Mon, 17 Nov 2014 13:05:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751949AbaKQNFf (ORCPT ); Mon, 17 Nov 2014 08:05:35 -0500 Received: from mail-pd0-f175.google.com ([209.85.192.175]:48899 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751192AbaKQNFe (ORCPT ); Mon, 17 Nov 2014 08:05:34 -0500 Received: by mail-pd0-f175.google.com with SMTP id y10so2400534pdj.20 for ; Mon, 17 Nov 2014 05:05:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WEd6Uw6I0DXhJ/VzFbApcyf6CM5aaJrRGYGLvMSQr+Y=; b=CJQrL0qYGOCMysX+coo8KpbgYPUfOw6JSHZAL+IK4AX7iE3A5mbA2AkAbN8OMsGC9Q vRfirasQpktafy2QkBEy+E4Fpy33kxLfUkcDXqlrbNsXEn9Lb0ZHVpxT+NaRgNXl/knv mVdw9K1P/1zMJApmS6VpeaPHuiH5tgFz0oKpYZOMZeCiGZVrEGQpu9NEOQx0FiTqcuJ9 8XDJLRCEs5KNW5X0u4Ke/K1JmM882dY4WGX1J0tgwu6dPl0pqtZCHn81jHkfa/1fVt4I WRgv9BhSuuc5vuAR/6//DRGBWhTzO9PfSUCoOsgWobEw8yqFylMkmuJb8DfTrDsoN98/ Ef5g== X-Received: by 10.70.89.200 with SMTP id bq8mr29533801pdb.57.1416229534154; Mon, 17 Nov 2014 05:05:34 -0800 (PST) Received: from localhost.localdomain (g192.61-205-219.ppp.wakwak.ne.jp. [61.205.219.192]) by mx.google.com with ESMTPSA id pd9sm35090974pbb.7.2014.11.17.05.05.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Nov 2014 05:05:33 -0800 (PST) From: Daniel Dressler To: danieru.dressler@gmail.com Cc: Chris Mason , Josef Bacik , linux-btrfs@vger.kernel.org (open list:BTRFS FILE SYSTEM), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] Btrfs: delayed-inode: replace root args iff only fs_info used Date: Mon, 17 Nov 2014 22:05:02 +0900 Message-Id: <1416229502-22368-1-git-send-email-danieru.dressler@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: References: Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is the second independent patch of a larger project to cleanup btrfs's internal usage of btrfs_root. Many functions take btrfs_root only to grab the fs_info struct. By requiring a root these functions cause programmer overhead. That these functions can accept any valid root is not obvious until inspection. This patch reduces the specificity of such functions to accept the fs_info directly. These patches can be applied independently and thus are not being submitted as a patch series. There should be about 26 patches by the project's completion. Each patch will cleanup between 1 and 34 functions apiece. Each patch covers a single file's functions. This patch affects the following function(s): 1) btrfs_wq_run_delayed_node Signed-off-by: Daniel Dressler Reviewed-by: David Sterba --- fs/btrfs/delayed-inode.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index 054577b..e590da6 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c @@ -1383,7 +1383,7 @@ out: static int btrfs_wq_run_delayed_node(struct btrfs_delayed_root *delayed_root, - struct btrfs_root *root, int nr) + struct btrfs_fs_info *fs_info, int nr) { struct btrfs_async_delayed_work *async_work; @@ -1399,7 +1399,7 @@ static int btrfs_wq_run_delayed_node(struct btrfs_delayed_root *delayed_root, btrfs_async_run_delayed_root, NULL, NULL); async_work->nr = nr; - btrfs_queue_work(root->fs_info->delayed_workers, &async_work->work); + btrfs_queue_work(fs_info->delayed_workers, &async_work->work); return 0; } @@ -1426,6 +1426,7 @@ static int could_end_wait(struct btrfs_delayed_root *delayed_root, int seq) 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); @@ -1438,7 +1439,7 @@ void btrfs_balance_delayed_items(struct btrfs_root *root) seq = atomic_read(&delayed_root->items_seq); - ret = btrfs_wq_run_delayed_node(delayed_root, root, 0); + ret = btrfs_wq_run_delayed_node(delayed_root, fs_info, 0); if (ret) return; @@ -1447,7 +1448,7 @@ void btrfs_balance_delayed_items(struct btrfs_root *root) return; } - btrfs_wq_run_delayed_node(delayed_root, root, BTRFS_DELAYED_BATCH); + btrfs_wq_run_delayed_node(delayed_root, fs_info, BTRFS_DELAYED_BATCH); } /* Will return 0 or -ENOMEM */