From patchwork Fri Sep 2 19:40:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 9311575 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 7749C60772 for ; Fri, 2 Sep 2016 19:41:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62C0029835 for ; Fri, 2 Sep 2016 19:41:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 577862984D; Fri, 2 Sep 2016 19:41:30 +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 C66B529835 for ; Fri, 2 Sep 2016 19:41:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932711AbcIBTlI (ORCPT ); Fri, 2 Sep 2016 15:41:08 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:45754 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932178AbcIBTlG (ORCPT ); Fri, 2 Sep 2016 15:41:06 -0400 Received: from pps.filterd (m0001303.ppops.net [127.0.0.1]) by m0001303.ppops.net (8.16.0.17/8.16.0.17) with SMTP id u82JatGr024482 for ; Fri, 2 Sep 2016 12:41:05 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=4tgb+2Ig1dZSpWfRra5Npby//EDaiCCTF6Yh4nur0ks=; b=Og3ggEvKewVQYlWibnWqhKAuAp7Dc+3czyHsvdzqWOywP6+epCVvYh0g2r4AwrqNmtP+ 9Ws++bPzCsMxAKTcrdyXjt9hfTu6I25JIzw94CTWMKfTbY+iuaybgZa1m/fLFfj2gWBt W+vjPnYpiy//CUArhdBfd480+Yp5dmPvuoE= Received: from mail.thefacebook.com ([199.201.64.23]) by m0001303.ppops.net with ESMTP id 25651ex251-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Fri, 02 Sep 2016 12:41:05 -0700 Received: from NAM01-BY2-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.15) with Microsoft SMTP Server (TLS) id 14.3.294.0; Fri, 2 Sep 2016 12:41:03 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=MIRz8mLc+tvGOy/sNQkKsybbLV9T3DZsfBAuYbDDVTk=; b=SpooKVnT8vDg08DJ4EkUfXP28UWc3ztLG/hdBulYSEJXklfXAFrWAreNBCL4vbs58BdyfeGss/bq5WiqxxGpAzXenxxZk5Q90m84EqsPfwf79xVZGXuyRl6gGoHkQeR3v/mbE4JchxcSMu84pT7Nwau+I1HlqUmXnvjGPgNj+4g= Received: from localhost (107.15.72.49) by BN6PR15MB1315.namprd15.prod.outlook.com (10.172.206.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.587.13; Fri, 2 Sep 2016 19:41:01 +0000 From: Josef Bacik To: , Subject: [PATCH 3/7] Btrfs: add a flags field to btrfs_fs_info Date: Fri, 2 Sep 2016 15:40:02 -0400 Message-ID: <1472845206-22870-4-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472845206-22870-1-git-send-email-jbacik@fb.com> References: <1472845206-22870-1-git-send-email-jbacik@fb.com> MIME-Version: 1.0 X-Originating-IP: [107.15.72.49] X-ClientProxiedBy: MWHPR05CA0022.namprd05.prod.outlook.com (10.168.242.160) To BN6PR15MB1315.namprd15.prod.outlook.com (10.172.206.141) X-MS-Office365-Filtering-Correlation-Id: e58f1f3f-dc22-424f-587c-08d3d3691242 X-Microsoft-Exchange-Diagnostics: 1; BN6PR15MB1315; 2:TYU8U0gNbG7zw+keWeZW3TXC9205ZqsXjg1BTtMUg5+A7dYz2CYK10H3x3Y6OqtomPWTj0/IBxDn+2W3f+Gc47JBhPbYqoMAlogp6HlUVo7xkMI9/aFdnM6yRQuiznv+Q6XhWWiwLJL5VCAG4s/aepyrijf3u/4eE4s/eo+CkmrzcfNWrUIMJsHNjd0S7RNt; 3:Iijh7En/gZuePoRwlfEYLyIC/tgXurfO1TZyiRkbv5tH9G8x1LVKq0aTW6lHLDLLvAknvyGxIOViZSddTq7H2IFONifhY/VyIR35Uh1q9cTcL8ULoTQ3Ke5Y4BVGW62z X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN6PR15MB1315; X-Microsoft-Exchange-Diagnostics: 1; BN6PR15MB1315; 25:5XShDoY4zLW1uFSeUJg9OYNNFuYLPMlJxxQlan3Qgc6qNT4UcrVS1AgO69IQIRmp+a4ChxRSmlZyVSm4vKNdRs2vkhndpRKVuBv5U6QW5KwrVy53ZtTSAmbIwsF29TViDksSCN+TD2flZBRBTywxgnqF7oDd3pjuYj5G/3oYC2tsjyYTMUN5f9SqMpGwFEpFTEdRo4/ezC+//j3/NPhTdyB+72+K7WDt61QlyO31FgAifykNbtv1Qq32DERcVaCFPd3GdhudNZE6LaArj2i+jdezR5CMoH2vZwvH+8hqKqA4zTEZDPIUNlvdw/RuW/DuOAOOZ80UXq+ChPrxhRMTokAcw3QmGkicpNqyRkSDA7szRM6M9tYfz8aaiHtBVFXg++qK1ct6RS083fFnx8Ar1UjLqx5PUrbCbBR78QvU1g8kLHczRg5NbqHwktboWy71MOW0cBPgS9apuVX67j0Koth0cXAQdV280imnybRKn3eYKKjVbQ/rbcdF9t4nLomU7wP7wXbwnU+GTALVaVgEoXiABMcdUi8r2LbVZPskLaDw6gYri54i4A/Vo2PWYLF5vRV6nwQGBCdc8tFeR9Zsn3IbuUPrkou3F9MShNcToOMo8AYhr/4FRvvsT3EN5mNybNjDQam8XCD59yVMaGU5FcsvOl7n4cR1lljDGSd134n5xH1Ixksxoyyg80fczRTbOU+S35IDK4cKzU2fUDl8e9ZHPDrLod7jcty6+xbFVKIgkMp4O3NfZ66CjmTUuoGW X-LD-Processed: 8ae927fe-1255-47a7-a2af-5f3a069daaa2,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; BN6PR15MB1315; 31:jrwDalRqY3lAXnRAAb7v6ORKNFXuZfIu4mxgykZ9qvs0sUF7G41bfq6s4kBVLu5ddCw8fj5rKdNNJ5EeYy080ZsOJp+pnnI403tFRv+tPu/nWrmts8z0r0N2GsqMpuh8n9bI6OMTq1Ig7qvScJxr28bAyvwv1TQ0O47YOcOzdRX3jesetau/i/eJPePf5QKtWa5VDrwIFoqfF8ueVh2E/qyrzFYp5DY/APAYsp7YkIU=; 20:+awksN4pGGX382dZr6DRA7xGBDlrvGhkyBEsS0sRxDUhsSUw5qyXdhYG3J1lzIDXHfabUrFgoZh4DHD7Znjar6zXin/GuosNtmaW8ct+u3Rew89CFr97oYY6lrgvxHsvIUI7GvJ8SYc8mWZLNX6Hrj+inlB5E+RWtbvxMWe8YS4=; 4:OF/yy6d1adX7WnK+JaeLv7FHEdlYJJ2Al1TurbKbusEd0QuSN9JMiXbqMHu6fFrN8tFjCFmfpGzTi1I5N+9OF2ChrJBvK7GHp2KsZSkQyznwEHQG5WaHSi3mMFg9rkctWkm43prmTZe2ZKdIuRxf0Hs8TwtSQXmGNItqWJObGrQjEx8dlB+eR5OrUYi4LHmd+9W+SqnvOKQhS8N69UPTXdKZlFNDxK4EcM8n0vRhlj2KEK+Hpf27JNLI/sbVtfOFoeANq2Rbxyto/WeyQiLqAFj5GYIGtGqRaHk06FyfrhkpCEgqp0vA1iWTARVA0geEe41t+qu/wtQlH+6ajXnhX1boQEc90vOD+SvVXgXYmw8DMhuGG3Z5UyDzmiiWyrmPPcYpXEoWq9K3v1WLGkfdeovrN9k/HlnwHNvA8MIywgu+kXg3ph0wMdfGPeJm4OxhG5EYLQqHUFpGwyWevkvYIw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089)(67672495146484); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001); SRVR:BN6PR15MB1315; BCL:0; PCL:0; RULEID:; SRVR:BN6PR15MB1315; X-Forefront-PRVS: 00531FAC2C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(6069001)(7916002)(189002)(199003)(50466002)(48376002)(66066001)(229853001)(2906002)(586003)(92566002)(50226002)(106356001)(5660300001)(101416001)(97736004)(19580405001)(5001770100001)(47776003)(76506005)(5003940100001)(36756003)(575784001)(50986999)(105586002)(76176999)(2950100001)(77096005)(86362001)(42186005)(33646002)(3846002)(6116002)(8676002)(81166006)(81156014)(107886002)(7736002)(7846002)(551934003)(189998001)(305945005)(68736007)(19580395003)(450100001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN6PR15MB1315; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR15MB1315; 23:6Dxb4TkCDPgB1Z8mMKeXdfsBbBqTVsRk8PyabNI8z?= =?us-ascii?Q?4BSLsXHHxcj9b4ePMSIFLbcUZIZP4dj7XMuwygnopmKCkM3uJbaMXNYIRFAW?= =?us-ascii?Q?28/dmHP5IYpBijiBkqLj/L1N/2huKHSi8ejiweNbn2BQD1bJdoTxv7NnAKu/?= =?us-ascii?Q?y40hWalq6/QauCI7s8FsdFxNrM2TGSxwMBBRBQgAPZjkrF4Ls2pnDZ9EuJQZ?= =?us-ascii?Q?WMywyJa+auqggl+/R8EyXN496Gz60zf0UNt8Vh65eSJuV/RJcBAKWbCvpBgP?= =?us-ascii?Q?Joyb2K2K0r2yrvk9NyjpP9+iPabI8kA0/ENAqW7GTgZhTykgcRyafi6mZCzM?= =?us-ascii?Q?vF06UW2u95766SM9mK15Hyv/jvR3KHxIRHONpp5qjrVqymRjMQyWrwsfKcxY?= =?us-ascii?Q?2KhRgRibPUgl+o2HchvTzPtSax9tIbF4sN2fpT42/oHe6XGp2QGoYp0uoYvg?= =?us-ascii?Q?4vPAZV5BoM25OaOMbxFihX656igC6zHdRLTBvaerB0ujMC5JjshabH1P55xG?= =?us-ascii?Q?dPNIkLgEmzgEnfcBrrwBvybsHOb3OrX7Ow4e+SMVgaUEED581YG+SXpTWRlv?= =?us-ascii?Q?jYQNe7660nPbo7WOPnTmSTtK6EgYuaNAJOvZGdakcXe215N4wzudw7j4wplV?= =?us-ascii?Q?J/iv7seJcPZzz7WBG7mmVAGLheYq6mDPgXi6/wmVuwZqMao1uWADMqiwFcx9?= =?us-ascii?Q?tOsHO0QR0i67vJPAMSHPbJB4yNJoStxmkimzMIAyHnm5QfSjx7tE0RMv42GT?= =?us-ascii?Q?FE0ZaNUTGplxi5ZIleqMaICj5ymcwdlxJHGfuSI73CATa+GnYg0JYxz8WLgF?= =?us-ascii?Q?ukaNM9WaAyTns/1cy6AZWWl4qHPUvV5WDIduCfXWl6BYEJ/3LLt8Lo+M+cFQ?= =?us-ascii?Q?16rpmCYUw4xR1WNSzBzy7NA2mJclWDsum8t0zlaZV69LncSyV46whELKPgG/?= =?us-ascii?Q?zR12KyXNfVPYWoJeKNZpvVBtbk3RMx7EjQ4EgjdkCwP8wO+oiiQ4Ebk5TdhY?= =?us-ascii?Q?fJZq+vwO4UM6aDnQniPezp0R8mnNW61BgfpQ376GPpEuAl7cvT9EuUDGBG2m?= =?us-ascii?Q?eOt5QPOsZJMdAbntxTYXO9RB6Bq5zrSJbssqbJ+qMLtlVUB7ONWPkY/oDozK?= =?us-ascii?Q?K7vR5gao1ZKGjhiq0VqCUncIq+5zzsGWlQObiUzFjtU0YrFsePUbpgHGNRy5?= =?us-ascii?Q?hqsSujVepCL6GcgHSflbK7bWmme+YbwZwk0?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR15MB1315; 6:WuHa2HIlgARLTsBULSCnyIUfJNspde+CogHkTw7SIYjSM+o6ShPVq7ycZUbnnfSdIywXcb7cpDDVtr9Sa4Pp6yZ+jc9RN4ulV7XDljlsLPeNzZyK0d27ZYz7sp02prHjFzu8jv3cNzeStkvawKR4dJs30XlLtnmMMCNdc8W/nS+eFE/A5P+m7Bv4DXpEMNRkJou4NkGlZz1HjOgXGQlbwwkWpYgdui/A/WitnmM9+Tb9AtZJo54+58Iws+HsPv97/EPx8fdzwMAzxfe/GS79gz8ZHydePsiP/P5dJpielL4=; 5:nrGx6O0tRFB9Y04d3fd2DfjUuKfNTPb+kjSiTPQY6MQOoVmOK3o7Cy10CziLgd46CP4gtI1E7Z7R4iI/JhOlGtP6EWfRWvUgvokiJiluPs42iETaOWUBEg0RGx1gCEW5cq0ejHPf8bKcjoXwtHQFwg==; 24:AT7/z6FtRVwjZAHfu8ueKkjdWT3vgdZ8fepLGbGD7u780N8TRdMZhsnkhxHyh4PLZLPQUw1j5z+XPGs4hlK3eDK60jK9x8+jhg/oL+Hpqnk=; 7:pJnWaes+G9G4N+kImT0KIctISp6Iaa4NnrsDaTbdqyy0bL4/TwLTyt6RpgBXJYFt4809SLRGLsHgrG+EXBBgNz5XwYviYgDYkG8+AjE0yug4wJVRrtLeCps+uzjZKXvK6NgykxAUjF9WU4rtvz/DiGVGHZ6LT8vu800p23CnjowEfa2Bnf2rXcB83duLkpnNBwAMb2tGugOYL5DYT3lm9npMwP4OeRXymy2iRw0cve81wFKQBpYWMm6lhwoJmYAi SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR15MB1315; 20:cwnD+jGQQ4bJ+8kS8Le9bHnOoElpaKiy6S1/L5tQfZJGM6Mw0SiWDP8CV9YDxpa9S8W5wB+ruNDDAcqj+ty5Q99EpqzTZ4NpaZuA6hYZ67xjDs2pmPI0CorwixmLYLGxMkVH0sQf6IUEwBA0fKSt93R3KYRB90hus+LJZ3PCLI4= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2016 19:41:01.6373 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR15MB1315 X-OriginatorOrg: fb.com X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-09-02_06:, , signatures=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 We have a lot of random ints in btrfs_fs_info that can be put into flags. This is mostly equivalent with the exception of how we deal with quota going on or off, now instead we set a flag when we are turning it on or off and deal with that appropriately, rather than just having a pending state that the current quota_enabled gets set to. Thanks, Signed-off-by: Josef Bacik Reviewed-by: David Sterba --- fs/btrfs/btrfs_inode.h | 11 --------- fs/btrfs/ctree.h | 44 +++++++++++++++++++----------------- fs/btrfs/delayed-inode.c | 3 ++- fs/btrfs/delayed-ref.c | 9 +++++--- fs/btrfs/disk-io.c | 23 +++++++------------ fs/btrfs/extent-tree.c | 14 ++++++------ fs/btrfs/extent_io.c | 7 +++--- fs/btrfs/free-space-tree.c | 6 ++--- fs/btrfs/inode.c | 4 ++-- fs/btrfs/qgroup.c | 52 +++++++++++++++++++++++-------------------- fs/btrfs/super.c | 2 +- fs/btrfs/tests/qgroup-tests.c | 2 +- fs/btrfs/transaction.c | 24 +++++++++----------- fs/btrfs/tree-log.c | 4 ++-- fs/btrfs/volumes.c | 2 +- 15 files changed, 98 insertions(+), 109 deletions(-) diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index 4919aed..1a8fa46 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h @@ -44,17 +44,6 @@ #define BTRFS_INODE_IN_DELALLOC_LIST 9 #define BTRFS_INODE_READDIO_NEED_LOCK 10 #define BTRFS_INODE_HAS_PROPS 11 -/* - * The following 3 bits are meant only for the btree inode. - * When any of them is set, it means an error happened while writing an - * extent buffer belonging to: - * 1) a non-log btree - * 2) a log btree and first log sub-transaction - * 3) a log btree and second log sub-transaction - */ -#define BTRFS_INODE_BTREE_ERR 12 -#define BTRFS_INODE_BTREE_LOG1_ERR 13 -#define BTRFS_INODE_BTREE_LOG2_ERR 14 /* in memory btrfs inode */ struct btrfs_inode { diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index bb50d7c..282a031 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -675,9 +675,25 @@ struct btrfs_device; struct btrfs_fs_devices; struct btrfs_balance_control; struct btrfs_delayed_root; + +#define BTRFS_FS_BARRIER 1 +#define BTRFS_FS_CLOSING_START 2 +#define BTRFS_FS_CLOSING_DONE 3 +#define BTRFS_FS_LOG_RECOVERING 4 +#define BTRFS_FS_OPEN 5 +#define BTRFS_FS_QUOTA_ENABLED 6 +#define BTRFS_FS_QUOTA_ENABLING 7 +#define BTRFS_FS_QUOTA_DISABLING 8 +#define BTRFS_FS_UPDATE_UUID_TREE_GEN 9 +#define BTRFS_FS_CREATING_FREE_SPACE_TREE 10 +#define BTRFS_FS_BTREE_ERR 11 +#define BTRFS_FS_LOG1_ERR 12 +#define BTRFS_FS_LOG2_ERR 13 + struct btrfs_fs_info { u8 fsid[BTRFS_FSID_SIZE]; u8 chunk_tree_uuid[BTRFS_UUID_SIZE]; + unsigned long flags; struct btrfs_root *extent_root; struct btrfs_root *tree_root; struct btrfs_root *chunk_root; @@ -906,10 +922,6 @@ struct btrfs_fs_info { int thread_pool_size; struct kobject *space_info_kobj; - int do_barriers; - int closing; - int log_root_recovering; - int open; u64 total_pinned; @@ -986,17 +998,6 @@ struct btrfs_fs_info { #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY u32 check_integrity_print_mask; #endif - /* - * quota information - */ - unsigned int quota_enabled:1; - - /* - * quota_enabled only changes state after a commit. This holds the - * next state. - */ - unsigned int pending_quota_state:1; - /* is qgroup tracking in a consistent state? */ u64 qgroup_flags; @@ -1059,7 +1060,6 @@ struct btrfs_fs_info { wait_queue_head_t replace_wait; struct semaphore uuid_tree_rescan_sem; - unsigned int update_uuid_tree_gen:1; /* Used to reclaim the metadata space in the background. */ struct work_struct async_reclaim_work; @@ -1077,8 +1077,6 @@ struct btrfs_fs_info { * and will be latter freed. Protected by fs_info->chunk_mutex. */ struct list_head pinned_chunks; - - int creating_free_space_tree; }; struct btrfs_subvolume_writers { @@ -2863,10 +2861,14 @@ int btrfs_drop_subtree(struct btrfs_trans_handle *trans, static inline int btrfs_fs_closing(struct btrfs_fs_info *fs_info) { /* - * Get synced with close_ctree() + * Do it this way so we only ever do one test_bit in the normal case. */ - smp_mb(); - return fs_info->closing; + if (test_bit(BTRFS_FS_CLOSING_START, &fs_info->flags)) { + if (test_bit(BTRFS_FS_CLOSING_DONE, &fs_info->flags)) + return 2; + return 1; + } + return 0; } /* diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index 3eeb9cd..982a168 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c @@ -1874,7 +1874,8 @@ int btrfs_delayed_delete_inode_ref(struct inode *inode) * leads to enospc problems. This means we also can't do * delayed inode refs */ - if (BTRFS_I(inode)->root->fs_info->log_root_recovering) + if (test_bit(BTRFS_FS_LOG_RECOVERING, + &BTRFS_I(inode)->root->fs_info->flags)) return -EAGAIN; delayed_node = btrfs_get_or_create_delayed_node(inode); diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c index b6d210e..1954465 100644 --- a/fs/btrfs/delayed-ref.c +++ b/fs/btrfs/delayed-ref.c @@ -773,7 +773,8 @@ int btrfs_add_delayed_tree_ref(struct btrfs_fs_info *fs_info, if (!head_ref) goto free_ref; - if (fs_info->quota_enabled && is_fstree(ref_root)) { + if (test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags) && + is_fstree(ref_root)) { record = kmalloc(sizeof(*record), GFP_NOFS); if (!record) goto free_head_ref; @@ -831,7 +832,8 @@ int btrfs_add_delayed_data_ref(struct btrfs_fs_info *fs_info, return -ENOMEM; } - if (fs_info->quota_enabled && is_fstree(ref_root)) { + if (test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags) && + is_fstree(ref_root)) { record = kmalloc(sizeof(*record), GFP_NOFS); if (!record) { kmem_cache_free(btrfs_delayed_data_ref_cachep, ref); @@ -870,7 +872,8 @@ int btrfs_add_delayed_qgroup_reserve(struct btrfs_fs_info *fs_info, struct btrfs_delayed_ref_head *ref_head; int ret = 0; - if (!fs_info->quota_enabled || !is_fstree(ref_root)) + if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags) || + !is_fstree(ref_root)) return 0; delayed_refs = &trans->transaction->delayed_refs; diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index c1d951a..ebd33ef 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1804,7 +1804,7 @@ static int cleaner_kthread(void *arg) * Do not do anything if we might cause open_ctree() to block * before we have finished mounting the filesystem. */ - if (!root->fs_info->open) + if (!test_bit(BTRFS_FS_OPEN, &root->fs_info->flags)) goto sleep; if (!mutex_trylock(&root->fs_info->cleaner_mutex)) @@ -2297,8 +2297,6 @@ static void btrfs_init_qgroup(struct btrfs_fs_info *fs_info) fs_info->qgroup_op_tree = RB_ROOT; INIT_LIST_HEAD(&fs_info->dirty_qgroups); fs_info->qgroup_seq = 1; - fs_info->quota_enabled = 0; - fs_info->pending_quota_state = 0; fs_info->qgroup_ulist = NULL; mutex_init(&fs_info->qgroup_rescan_lock); } @@ -2482,8 +2480,7 @@ static int btrfs_read_roots(struct btrfs_fs_info *fs_info, root = btrfs_read_tree_root(tree_root, &location); if (!IS_ERR(root)) { set_bit(BTRFS_ROOT_TRACK_DIRTY, &root->state); - fs_info->quota_enabled = 1; - fs_info->pending_quota_state = 1; + set_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); fs_info->quota_root = root; } @@ -2671,8 +2668,7 @@ int open_ctree(struct super_block *sb, extent_io_tree_init(&fs_info->freed_extents[0], NULL); extent_io_tree_init(&fs_info->freed_extents[1], NULL); fs_info->pinned_extents = &fs_info->freed_extents[0]; - fs_info->do_barriers = 1; - + set_bit(BTRFS_FS_BARRIER, &fs_info->flags); mutex_init(&fs_info->ordered_operations_mutex); mutex_init(&fs_info->tree_log_mutex); @@ -3160,10 +3156,9 @@ retry_root_backup: return ret; } } else { - fs_info->update_uuid_tree_gen = 1; + set_bit(BTRFS_FS_UPDATE_UUID_TREE_GEN, &fs_info->flags); } - - fs_info->open = 1; + set_bit(BTRFS_FS_OPEN, &fs_info->flags); /* * backuproot only affect mount behavior, and if open_ctree succeeded, @@ -3847,8 +3842,7 @@ void close_ctree(struct btrfs_root *root) struct btrfs_fs_info *fs_info = root->fs_info; int ret; - fs_info->closing = 1; - smp_mb(); + set_bit(BTRFS_FS_CLOSING_START, &fs_info->flags); /* wait for the qgroup rescan worker to stop */ btrfs_qgroup_wait_for_completion(fs_info); @@ -3893,8 +3887,7 @@ void close_ctree(struct btrfs_root *root) kthread_stop(fs_info->transaction_kthread); kthread_stop(fs_info->cleaner_kthread); - fs_info->closing = 2; - smp_mb(); + set_bit(BTRFS_FS_CLOSING_DONE, &fs_info->flags); btrfs_free_qgroup_config(fs_info); @@ -3919,7 +3912,7 @@ void close_ctree(struct btrfs_root *root) invalidate_inode_pages2(fs_info->btree_inode->i_mapping); btrfs_stop_all_workers(fs_info); - fs_info->open = 0; + clear_bit(BTRFS_FS_OPEN, &fs_info->flags); free_root_pointers(fs_info, 1); iput(fs_info->btree_inode); diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 20f9fa6..03da2f6 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -2954,7 +2954,7 @@ int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, if (trans->aborted) return 0; - if (root->fs_info->creating_free_space_tree) + if (test_bit(BTRFS_FS_CREATING_FREE_SPACE_TREE, &root->fs_info->flags)) return 0; if (root == root->fs_info->extent_root) @@ -5196,7 +5196,7 @@ static int __reserve_metadata_bytes(struct btrfs_root *root, * which means we won't have fs_info->fs_root set, so don't do * the async reclaim as we will panic. */ - if (!root->fs_info->log_root_recovering && + if (!test_bit(BTRFS_FS_LOG_RECOVERING, &root->fs_info->flags) && need_do_async_reclaim(space_info, root, used) && !work_busy(&root->fs_info->async_reclaim_work)) { trace_btrfs_trigger_flush(root->fs_info, @@ -5800,7 +5800,7 @@ int btrfs_subvolume_reserve_metadata(struct btrfs_root *root, int ret; struct btrfs_block_rsv *global_rsv = &root->fs_info->global_block_rsv; - if (root->fs_info->quota_enabled) { + if (test_bit(BTRFS_FS_QUOTA_ENABLED, &root->fs_info->flags)) { /* One for parent inode, two for dir entries */ num_bytes = 3 * root->nodesize; ret = btrfs_qgroup_reserve_meta(root, num_bytes); @@ -5978,7 +5978,7 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes) csum_bytes = BTRFS_I(inode)->csum_bytes; spin_unlock(&BTRFS_I(inode)->lock); - if (root->fs_info->quota_enabled) { + if (test_bit(BTRFS_FS_QUOTA_ENABLED, &root->fs_info->flags)) { ret = btrfs_qgroup_reserve_meta(root, nr_extents * root->nodesize); if (ret) @@ -8561,7 +8561,7 @@ static int account_leaf_items(struct btrfs_trans_handle *trans, u64 bytenr, num_bytes; /* We can be called directly from walk_up_proc() */ - if (!root->fs_info->quota_enabled) + if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &root->fs_info->flags)) return 0; for (i = 0; i < nr; i++) { @@ -8669,7 +8669,7 @@ static int account_shared_subtree(struct btrfs_trans_handle *trans, BUG_ON(root_level < 0 || root_level > BTRFS_MAX_LEVEL); BUG_ON(root_eb == NULL); - if (!root->fs_info->quota_enabled) + if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &root->fs_info->flags)) return 0; if (!extent_buffer_uptodate(root_eb)) { @@ -10799,7 +10799,7 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info) struct btrfs_trans_handle *trans; int ret = 0; - if (!fs_info->open) + if (!test_bit(BTRFS_FS_OPEN, &fs_info->flags)) return; spin_lock(&fs_info->unused_bgs_lock); diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 3132f1a..6036431 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3609,7 +3609,6 @@ static void end_extent_buffer_writeback(struct extent_buffer *eb) static void set_btree_ioerr(struct page *page) { struct extent_buffer *eb = (struct extent_buffer *)page->private; - struct btrfs_inode *btree_ino = BTRFS_I(eb->fs_info->btree_inode); SetPageError(page); if (test_and_set_bit(EXTENT_BUFFER_WRITE_ERR, &eb->bflags)) @@ -3655,13 +3654,13 @@ static void set_btree_ioerr(struct page *page) */ switch (eb->log_index) { case -1: - set_bit(BTRFS_INODE_BTREE_ERR, &btree_ino->runtime_flags); + set_bit(BTRFS_FS_BTREE_ERR, &eb->fs_info->flags); break; case 0: - set_bit(BTRFS_INODE_BTREE_LOG1_ERR, &btree_ino->runtime_flags); + set_bit(BTRFS_FS_LOG1_ERR, &eb->fs_info->flags); break; case 1: - set_bit(BTRFS_INODE_BTREE_LOG2_ERR, &btree_ino->runtime_flags); + set_bit(BTRFS_FS_LOG2_ERR, &eb->fs_info->flags); break; default: BUG(); /* unexpected, logic error */ diff --git a/fs/btrfs/free-space-tree.c b/fs/btrfs/free-space-tree.c index 87e7e3d..83ee63b 100644 --- a/fs/btrfs/free-space-tree.c +++ b/fs/btrfs/free-space-tree.c @@ -1163,7 +1163,7 @@ int btrfs_create_free_space_tree(struct btrfs_fs_info *fs_info) if (IS_ERR(trans)) return PTR_ERR(trans); - fs_info->creating_free_space_tree = 1; + set_bit(BTRFS_FS_CREATING_FREE_SPACE_TREE, &fs_info->flags); free_space_root = btrfs_create_tree(trans, fs_info, BTRFS_FREE_SPACE_TREE_OBJECTID); if (IS_ERR(free_space_root)) { @@ -1183,7 +1183,7 @@ int btrfs_create_free_space_tree(struct btrfs_fs_info *fs_info) } btrfs_set_fs_compat_ro(fs_info, FREE_SPACE_TREE); - fs_info->creating_free_space_tree = 0; + clear_bit(BTRFS_FS_CREATING_FREE_SPACE_TREE, &fs_info->flags); ret = btrfs_commit_transaction(trans, tree_root); if (ret) @@ -1192,7 +1192,7 @@ int btrfs_create_free_space_tree(struct btrfs_fs_info *fs_info) return 0; abort: - fs_info->creating_free_space_tree = 0; + clear_bit(BTRFS_FS_CREATING_FREE_SPACE_TREE, &fs_info->flags); btrfs_abort_transaction(trans, ret); btrfs_end_transaction(trans, tree_root); return ret; diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 66b7e0d..0b97cb4 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3932,7 +3932,7 @@ noinline int btrfs_update_inode(struct btrfs_trans_handle *trans, */ if (!btrfs_is_free_space_inode(inode) && root->root_key.objectid != BTRFS_DATA_RELOC_TREE_OBJECTID - && !root->fs_info->log_root_recovering) { + && !test_bit(BTRFS_FS_LOG_RECOVERING, &root->fs_info->flags)) { btrfs_update_root_times(trans, root); ret = btrfs_delayed_update_inode(trans, root, inode); @@ -5202,7 +5202,7 @@ void btrfs_evict_inode(struct inode *inode) btrfs_free_io_failure_record(inode, 0, (u64)-1); - if (root->fs_info->log_root_recovering) { + if (test_bit(BTRFS_FS_LOG_RECOVERING, &root->fs_info->flags)) { BUG_ON(test_bit(BTRFS_INODE_HAS_ORPHAN_ITEM, &BTRFS_I(inode)->runtime_flags)); goto no_delete; diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 93ee1c1..31dd30d 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -309,7 +309,7 @@ int btrfs_read_qgroup_config(struct btrfs_fs_info *fs_info) u64 flags = 0; u64 rescan_progress = 0; - if (!fs_info->quota_enabled) + if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags)) return 0; fs_info->qgroup_ulist = ulist_alloc(GFP_NOFS); @@ -463,13 +463,11 @@ next2: } out: fs_info->qgroup_flags |= flags; - if (!(fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_ON)) { - fs_info->quota_enabled = 0; - fs_info->pending_quota_state = 0; - } else if (fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN && - ret >= 0) { + if (!(fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_ON)) + clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); + else if (fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN && + ret >= 0) ret = qgroup_rescan_init(fs_info, rescan_progress, 0); - } btrfs_free_path(path); if (ret < 0) { @@ -847,7 +845,7 @@ static int btrfs_clean_quota_tree(struct btrfs_trans_handle *trans, } ret = 0; out: - root->fs_info->pending_quota_state = 0; + set_bit(BTRFS_FS_QUOTA_DISABLING, &root->fs_info->flags); btrfs_free_path(path); return ret; } @@ -868,7 +866,7 @@ int btrfs_quota_enable(struct btrfs_trans_handle *trans, mutex_lock(&fs_info->qgroup_ioctl_lock); if (fs_info->quota_root) { - fs_info->pending_quota_state = 1; + set_bit(BTRFS_FS_QUOTA_ENABLING, &fs_info->flags); goto out; } @@ -964,7 +962,7 @@ out_add_root: } spin_lock(&fs_info->qgroup_lock); fs_info->quota_root = quota_root; - fs_info->pending_quota_state = 1; + set_bit(BTRFS_FS_QUOTA_ENABLING, &fs_info->flags); spin_unlock(&fs_info->qgroup_lock); out_free_path: btrfs_free_path(path); @@ -993,8 +991,8 @@ int btrfs_quota_disable(struct btrfs_trans_handle *trans, mutex_lock(&fs_info->qgroup_ioctl_lock); if (!fs_info->quota_root) goto out; - fs_info->quota_enabled = 0; - fs_info->pending_quota_state = 0; + clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); + set_bit(BTRFS_FS_QUOTA_DISABLING, &fs_info->flags); btrfs_qgroup_wait_for_completion(fs_info); spin_lock(&fs_info->qgroup_lock); quota_root = fs_info->quota_root; @@ -1684,7 +1682,7 @@ btrfs_qgroup_account_extent(struct btrfs_trans_handle *trans, if (old_roots) nr_old_roots = old_roots->nnodes; - if (!fs_info->quota_enabled) + if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags)) goto out_free; BUG_ON(!fs_info->quota_root); @@ -1804,10 +1802,14 @@ int btrfs_run_qgroups(struct btrfs_trans_handle *trans, if (!quota_root) goto out; - if (!fs_info->quota_enabled && fs_info->pending_quota_state) + if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags) && + test_bit(BTRFS_FS_QUOTA_ENABLING, &fs_info->flags)) start_rescan_worker = 1; - fs_info->quota_enabled = fs_info->pending_quota_state; + if (test_and_clear_bit(BTRFS_FS_QUOTA_ENABLING, &fs_info->flags)) + set_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); + if (test_and_clear_bit(BTRFS_FS_QUOTA_DISABLING, &fs_info->flags)) + clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); spin_lock(&fs_info->qgroup_lock); while (!list_empty(&fs_info->dirty_qgroups)) { @@ -1826,7 +1828,7 @@ int btrfs_run_qgroups(struct btrfs_trans_handle *trans, BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT; spin_lock(&fs_info->qgroup_lock); } - if (fs_info->quota_enabled) + if (test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags)) fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_ON; else fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_ON; @@ -1871,7 +1873,7 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 nums; mutex_lock(&fs_info->qgroup_ioctl_lock); - if (!fs_info->quota_enabled) + if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags)) goto out; if (!quota_root) { @@ -2314,7 +2316,7 @@ static void btrfs_qgroup_rescan_worker(struct btrfs_work *work) err = PTR_ERR(trans); break; } - if (!fs_info->quota_enabled) { + if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags)) { err = -EINTR; } else { err = qgroup_rescan_leaf(fs_info, path, trans); @@ -2536,8 +2538,8 @@ int btrfs_qgroup_reserve_data(struct inode *inode, u64 start, u64 len) struct ulist_iterator uiter; int ret; - if (!root->fs_info->quota_enabled || !is_fstree(root->objectid) || - len == 0) + if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &root->fs_info->flags) || + !is_fstree(root->objectid) || len == 0) return 0; changeset.bytes_changed = 0; @@ -2634,8 +2636,8 @@ int btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes) { int ret; - if (!root->fs_info->quota_enabled || !is_fstree(root->objectid) || - num_bytes == 0) + if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &root->fs_info->flags) || + !is_fstree(root->objectid) || num_bytes == 0) return 0; BUG_ON(num_bytes != round_down(num_bytes, root->nodesize)); @@ -2650,7 +2652,8 @@ void btrfs_qgroup_free_meta_all(struct btrfs_root *root) { int reserved; - if (!root->fs_info->quota_enabled || !is_fstree(root->objectid)) + if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &root->fs_info->flags) || + !is_fstree(root->objectid)) return; reserved = atomic_xchg(&root->qgroup_meta_rsv, 0); @@ -2661,7 +2664,8 @@ void btrfs_qgroup_free_meta_all(struct btrfs_root *root) void btrfs_qgroup_free_meta(struct btrfs_root *root, int num_bytes) { - if (!root->fs_info->quota_enabled || !is_fstree(root->objectid)) + if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &root->fs_info->flags) || + !is_fstree(root->objectid)) return; BUG_ON(num_bytes != round_down(num_bytes, root->nodesize)); diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 864ce33..b9d4c43 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -1836,7 +1836,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) } sb->s_flags &= ~MS_RDONLY; - fs_info->open = 1; + set_bit(BTRFS_FS_OPEN, &fs_info->flags); } out: wake_up_process(fs_info->transaction_kthread); diff --git a/fs/btrfs/tests/qgroup-tests.c b/fs/btrfs/tests/qgroup-tests.c index 4407fef..ca7cb5e 100644 --- a/fs/btrfs/tests/qgroup-tests.c +++ b/fs/btrfs/tests/qgroup-tests.c @@ -480,7 +480,7 @@ int btrfs_test_qgroups(u32 sectorsize, u32 nodesize) */ root->fs_info->tree_root = root; root->fs_info->quota_root = root; - root->fs_info->quota_enabled = 1; + set_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); /* * Can't use bytenr 0, some things freak out diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 9de37b5..56bdb2f 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -441,7 +441,7 @@ static void wait_current_trans(struct btrfs_root *root) static int may_wait_transaction(struct btrfs_root *root, int type) { - if (root->fs_info->log_root_recovering) + if (test_bit(BTRFS_FS_LOG_RECOVERING, &root->fs_info->flags)) return 0; if (type == TRANS_USERSPACE) @@ -993,7 +993,6 @@ int btrfs_wait_marked_extents(struct btrfs_root *root, struct extent_state *cached_state = NULL; u64 start = 0; u64 end; - struct btrfs_inode *btree_ino = BTRFS_I(root->fs_info->btree_inode); bool errors = false; while (!find_first_extent_bit(dirty_pages, start, &start, &end, @@ -1025,17 +1024,17 @@ int btrfs_wait_marked_extents(struct btrfs_root *root, if (root->root_key.objectid == BTRFS_TREE_LOG_OBJECTID) { if ((mark & EXTENT_DIRTY) && - test_and_clear_bit(BTRFS_INODE_BTREE_LOG1_ERR, - &btree_ino->runtime_flags)) + test_and_clear_bit(BTRFS_FS_LOG1_ERR, + &root->fs_info->flags)) errors = true; if ((mark & EXTENT_NEW) && - test_and_clear_bit(BTRFS_INODE_BTREE_LOG2_ERR, - &btree_ino->runtime_flags)) + test_and_clear_bit(BTRFS_FS_LOG2_ERR, + &root->fs_info->flags)) errors = true; } else { - if (test_and_clear_bit(BTRFS_INODE_BTREE_ERR, - &btree_ino->runtime_flags)) + if (test_and_clear_bit(BTRFS_FS_BTREE_ERR, + &root->fs_info->flags)) errors = true; } @@ -1335,7 +1334,7 @@ static int qgroup_account_snapshot(struct btrfs_trans_handle *trans, * kick in anyway. */ mutex_lock(&fs_info->qgroup_ioctl_lock); - if (!fs_info->quota_enabled) { + if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags)) { mutex_unlock(&fs_info->qgroup_ioctl_lock); return 0; } @@ -1712,7 +1711,7 @@ static void update_super_roots(struct btrfs_root *root) super->root_level = root_item->level; if (btrfs_test_opt(root->fs_info, SPACE_CACHE)) super->cache_generation = root_item->generation; - if (root->fs_info->update_uuid_tree_gen) + if (test_bit(BTRFS_FS_UPDATE_UUID_TREE_GEN, &root->fs_info->flags)) super->uuid_tree_generation = root_item->generation; } @@ -1919,7 +1918,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, { struct btrfs_transaction *cur_trans = trans->transaction; struct btrfs_transaction *prev_trans = NULL; - struct btrfs_inode *btree_ino = BTRFS_I(root->fs_info->btree_inode); int ret; /* Stop the commit early if ->aborted is set */ @@ -2213,8 +2211,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, btrfs_update_commit_device_size(root->fs_info); btrfs_update_commit_device_bytes_used(root, cur_trans); - clear_bit(BTRFS_INODE_BTREE_LOG1_ERR, &btree_ino->runtime_flags); - clear_bit(BTRFS_INODE_BTREE_LOG2_ERR, &btree_ino->runtime_flags); + clear_bit(BTRFS_FS_LOG1_ERR, &root->fs_info->flags); + clear_bit(BTRFS_FS_LOG2_ERR, &root->fs_info->flags); btrfs_trans_release_chunk_metadata(trans); diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index d31a0c4..a25be18b 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -5492,7 +5492,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree) if (!path) return -ENOMEM; - fs_info->log_root_recovering = 1; + set_bit(BTRFS_FS_LOG_RECOVERING, &fs_info->flags); trans = btrfs_start_transaction(fs_info->tree_root, 0); if (IS_ERR(trans)) { @@ -5602,7 +5602,7 @@ again: free_extent_buffer(log_root_tree->node); log_root_tree->log_root = NULL; - fs_info->log_root_recovering = 0; + clear_bit(BTRFS_FS_LOG_RECOVERING, &fs_info->flags); kfree(log_root_tree); return 0; diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index bb0addc..89dc9c7 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -4210,7 +4210,7 @@ out: if (ret) btrfs_warn(fs_info, "btrfs_uuid_scan_kthread failed %d", ret); else - fs_info->update_uuid_tree_gen = 1; + set_bit(BTRFS_FS_UPDATE_UUID_TREE_GEN, &fs_info->flags); up(&fs_info->uuid_tree_rescan_sem); return 0; }