From patchwork Sat May 20 08:39:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sargun Dhillon X-Patchwork-Id: 9738525 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 98FD36034C for ; Sat, 20 May 2017 08:39:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E135285C8 for ; Sat, 20 May 2017 08:39:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82984285D4; Sat, 20 May 2017 08:39:27 +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 24D0E285C8 for ; Sat, 20 May 2017 08:39:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755645AbdETIjX (ORCPT ); Sat, 20 May 2017 04:39:23 -0400 Received: from mail-it0-f45.google.com ([209.85.214.45]:38645 "EHLO mail-it0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755635AbdETIjU (ORCPT ); Sat, 20 May 2017 04:39:20 -0400 Received: by mail-it0-f45.google.com with SMTP id r63so1904141itc.1 for ; Sat, 20 May 2017 01:39:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sargun.me; s=google; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=pCMIZ5Vz8e95DzOXY99OO0FHiQUDGwOLj/RVl9mc/2k=; b=zAyUfkOymH9knDWTNojc5Af1CdmW0Je5misYO+hne6++HESiR9WeAO2lnB4UIYbOLv xtnT0BAFN5OKLR+amEZR3g4CX1qvzeIY2rq43HE53vM6Y8Rr1iraamyUlCymLBnf6tks e2Qy8y5c4dNEJ0HdFCF/oD9G6pC/DDMWaUp88= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=pCMIZ5Vz8e95DzOXY99OO0FHiQUDGwOLj/RVl9mc/2k=; b=WC8qs0OqGDgNXfrUadK7se1uBV2IWmdJwZsIC/cweq/BwfLIOy1EDSg4GcnJv+Yt4x gtOT/ML7BT+rCZ5AgJy8JZpPlLeTY5Xhp4EzgYP7RRwTioWt6n6Nk85EO4NOKrL9DzqF LIZsmhyhhB1x9WlCf3Nw6eJ3WCDEvy/UGlVn79YZylMN+Nd/sydS66vV0zKPpF3YdLaT WmKUUWZ74wL3wWsSzFA3AElOWXw5Zxz8N2aSF659raE+a88Te3lgKInjdLOYZKrWiLR4 htju3i2gq/GtjV3mW72e9RUcQFm3GXtEeMsCuNZrFKUFALKSU5ZigiTG13c6//J5GSSV gqog== X-Gm-Message-State: AODbwcBD2YmcHWsLISqcLqHUMOrw30w19qidM6AR9I2xIDmubSQpZLfk DyQmBS+QchDsmGM07EPvEw== X-Received: by 10.36.162.72 with SMTP id o8mr14533354iti.42.1495269554217; Sat, 20 May 2017 01:39:14 -0700 (PDT) Received: from ircssh-2.c.rugged-nimbus-611.internal (80.60.198.104.bc.googleusercontent.com. [104.198.60.80]) by smtp.gmail.com with ESMTPSA id b10sm4958799iod.33.2017.05.20.01.39.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 20 May 2017 01:39:14 -0700 (PDT) Date: Sat, 20 May 2017 08:39:12 +0000 From: Sargun Dhillon To: linux-btrfs@vger.kernel.org Subject: [PATCH 3/8] btrfs: Split up btrfs_create_qgroup, no logic changes Message-ID: <20170520083911.GA4213@ircssh-2.c.rugged-nimbus-611.internal> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) 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 This change is purely a style change, so that btrfs_create_qgroup is split. There is some whitespace changes, but this shouldn't have any effect on the logic of the code. Signed-off-by: Sargun Dhillon --- fs/btrfs/qgroup.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 7e772ba..588248b 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -1247,24 +1247,21 @@ int btrfs_del_qgroup_relation(struct btrfs_trans_handle *trans, return ret; } -int btrfs_create_qgroup(struct btrfs_trans_handle *trans, - struct btrfs_fs_info *fs_info, u64 qgroupid) +/* Must be called with qgroup_ioctl_lock held */ +static int __btrfs_create_qgroup(struct btrfs_trans_handle *trans, + struct btrfs_fs_info *fs_info, u64 qgroupid) { struct btrfs_root *quota_root; struct btrfs_qgroup *qgroup; - int ret = 0; + int ret; - mutex_lock(&fs_info->qgroup_ioctl_lock); quota_root = fs_info->quota_root; - if (!quota_root) { - ret = -EINVAL; - goto out; - } + if (!quota_root) + return -EINVAL; + qgroup = find_qgroup_rb(fs_info, qgroupid); - if (qgroup) { - ret = -EEXIST; - goto out; - } + if (qgroup) + return -EEXIST; ret = add_qgroup_item(trans, quota_root, qgroupid); if (ret) @@ -1277,7 +1274,18 @@ int btrfs_create_qgroup(struct btrfs_trans_handle *trans, if (IS_ERR(qgroup)) ret = PTR_ERR(qgroup); out: + return ret; +} + +int btrfs_create_qgroup(struct btrfs_trans_handle *trans, + struct btrfs_fs_info *fs_info, u64 qgroupid) +{ + int ret; + + mutex_lock(&fs_info->qgroup_ioctl_lock); + ret = __btrfs_create_qgroup(trans, fs_info, qgroupid); mutex_unlock(&fs_info->qgroup_ioctl_lock); + return ret; }