From patchwork Fri Aug 15 02:58:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Luis R. Rodriguez" X-Patchwork-Id: 4726121 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B5E05C033A for ; Fri, 15 Aug 2014 02:59:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EA019201BF for ; Fri, 15 Aug 2014 02:59:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0AAAD201C8 for ; Fri, 15 Aug 2014 02:59:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932277AbaHOC7Y (ORCPT ); Thu, 14 Aug 2014 22:59:24 -0400 Received: from mail-pd0-f175.google.com ([209.85.192.175]:56559 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754915AbaHOC7V (ORCPT ); Thu, 14 Aug 2014 22:59:21 -0400 Received: by mail-pd0-f175.google.com with SMTP id r10so2640462pdi.20 for ; Thu, 14 Aug 2014 19:59:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=3XwE31rc6AcTiyk16HZ88GEnde2jzeVPE17IK52afH0=; b=decKrdqMH4SrnQdZsaU8dpOaz9/YfzFHygxfchN7xgJ9BbbU5g06Ptoe1Mq0VHL+x5 KqPTFUudJQ/tudeO5Z78rwjZ+kcrpNFfywjyFai9QnrtfvNOdR9pKBfVLv4F92ps1Wez l8aeoRLhFPihzBTsYTWDA1rulsGFHSI10U7TFuXv+rT2w8zFy4XMzM0GeKxnOxMHHnTY FpLgTdlII0OdtqlSoUAEQ2T+ZL+D0EIQja5deuIDTWiDoBYH87f+e5aUmuyKWkd5EfDf 0qofTtI+OHmNAK7xdxefiaS3OAefKQmAj/w/Zjgaf7gGIKEGkACvsMTxmaaLZzMCJRua W/vg== X-Received: by 10.67.15.172 with SMTP id fp12mr8633112pad.4.1408071560812; Thu, 14 Aug 2014 19:59:20 -0700 (PDT) Received: from mcgrof@gmail.com (c-98-234-145-61.hsd1.ca.comcast.net. [98.234.145.61]) by mx.google.com with ESMTPSA id xo10sm6705781pbc.36.2014.08.14.19.59.17 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 14 Aug 2014 19:59:19 -0700 (PDT) Received: by mcgrof@gmail.com (sSMTP sendmail emulation); Thu, 14 Aug 2014 19:59:16 -0700 From: "Luis R. Rodriguez" To: viro@zeniv.linux.org.uk, clm@fb.com, jbacik@fb.com, hch@infradead.org Cc: linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, jeffm@suse.com, fdmanana@suse.com, "Luis R. Rodriguez" Subject: [RFC v3 2/2] btrfs: use the new VFS super_block_dev Date: Thu, 14 Aug 2014 19:58:58 -0700 Message-Id: <1408071538-14354-3-git-send-email-mcgrof@do-not-panic.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1408071538-14354-1-git-send-email-mcgrof@do-not-panic.com> References: <1408071538-14354-1-git-send-email-mcgrof@do-not-panic.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 From: "Luis R. Rodriguez" Use the new VFS layer struct super_block_dev instead of carrying the anonymous bdev's on our own. This makes the VFS layer aware of all of our anonymous dev's on the super block. Signed-off-by: Luis R. Rodriguez Signed-off-by: Filipe Manana fdmanana: fix for running qgroup sanity tests --- fs/btrfs/ctree.h | 7 ++----- fs/btrfs/disk-io.c | 7 +++---- fs/btrfs/inode.c | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index be91397..0ece396 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1846,11 +1846,8 @@ struct btrfs_root { * protected by inode_lock */ struct radix_tree_root delayed_nodes_tree; - /* - * right now this just gets used so that a root has its own devid - * for stat. It may be used for more later - */ - dev_t anon_dev; + + struct super_block_dev sbdev; spinlock_t root_item_lock; atomic_t refs; diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 08e65e9..7c65307 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1270,7 +1270,6 @@ static void __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize, root->defrag_trans_start = 0; init_completion(&root->kobj_unregister); root->root_key.objectid = objectid; - root->anon_dev = 0; spin_lock_init(&root->root_item_lock); } @@ -1573,7 +1572,7 @@ int btrfs_init_fs_root(struct btrfs_root *root) spin_lock_init(&root->cache_lock); init_waitqueue_head(&root->cache_wait); - ret = get_anon_bdev(&root->anon_dev); + ret = insert_anon_sbdev(root->fs_info->sb, &root->sbdev); if (ret) goto free_writers; return 0; @@ -3532,8 +3531,8 @@ static void free_fs_root(struct btrfs_root *root) WARN_ON(!RB_EMPTY_ROOT(&root->inode_tree)); btrfs_free_block_rsv(root, root->orphan_block_rsv); root->orphan_block_rsv = NULL; - if (root->anon_dev) - free_anon_bdev(root->anon_dev); + if (likely(!test_bit(BTRFS_ROOT_DUMMY_ROOT, &root->state))) + remove_anon_sbdev(&root->sbdev); if (root->subv_writers) btrfs_free_subvolume_writers(root->subv_writers); free_extent_buffer(root->node); diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 3668048..0e8f604 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -8277,7 +8277,7 @@ static int btrfs_getattr(struct vfsmount *mnt, u32 blocksize = inode->i_sb->s_blocksize; generic_fillattr(inode, stat); - stat->dev = BTRFS_I(inode)->root->anon_dev; + stat->dev = BTRFS_I(inode)->root->sbdev.anon_dev; stat->blksize = PAGE_CACHE_SIZE; spin_lock(&BTRFS_I(inode)->lock);