From patchwork Thu Jul 27 22:12:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Burkov X-Patchwork-Id: 13330822 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BF8BEB64DD for ; Thu, 27 Jul 2023 22:15:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232509AbjG0WPI (ORCPT ); Thu, 27 Jul 2023 18:15:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229866AbjG0WPH (ORCPT ); Thu, 27 Jul 2023 18:15:07 -0400 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6FAF19B for ; Thu, 27 Jul 2023 15:15:04 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id E9C73320090C; Thu, 27 Jul 2023 18:15:03 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 27 Jul 2023 18:15:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bur.io; h=cc :content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1690496103; x= 1690582503; bh=cdAF2g7upC4q8bhzChoEZzsUwDmUmT5k4kRthZMvmz4=; b=U xpJL9LqWYZ4nhbAY5rPEvXmS7PE3JN5aR4j6O3GtYgnfBKIEvxZDNXOTeH7tTBQ6 n5gJwN5bl4dewbaynaMe3NsQnNSOwr+XGyfPlZyflr9mVMzaVA1prUzF8NINmoZB uRTD4PUZVx9toLiZYlUM+VABAeshwJtuBQ+VynMSrW8YJYdj7laNyNXLwUGmu+p3 ghHGYhH8ClIBZWSdz/VlzVpLoIYZtg+MpwARq2oNaFbB2rZf3kUEmOA0n9c01yzm RylQKC8sgGbTbS9WSphUOsqLA5rHjvFmoLs3GQEutFv4EWjpdBYAqJro/ZxnsdGl +xN5621OaSP8bnLyzjE7Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1690496103; x=1690582503; bh=c dAF2g7upC4q8bhzChoEZzsUwDmUmT5k4kRthZMvmz4=; b=B9vDTWsC5vrwpp8Z6 cDz/brZBuk1QFBZleS2SmerHHptr8+lBsZzyyDXriyk5tSFE1da+3wEU3SKq7Lw1 DOLQQveTTpP2nejtt/A5cg+xtTN/lSU1hgkg2ewe0IQSqGDOZ3PVYDBze48HjRNt 1CPTva/6KPpoI98vlFzR6LVme11O5oceXGVIfc/zII04pzh2Or/Ai+d0WHUHB/Wl lvLZj8whYBsimdTdFYKY53PaF8kkvF2IbeJgKGdJ2DDI004NVDGcc+xbs2906LJ1 ZralEd8B9/hG5Nb7RDoTZyjyt2t0Lo+SsMo4TJMeDZSsSwjDYQCxYBtOpA0kCW2A Y2n4w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrieehgddtiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeeuohhrihhsuceuuhhrkhhovhcuoegsohhrihhssegsuhhrrdhi oheqnecuggftrfgrthhtvghrnhepieeuffeuvdeiueejhfehiefgkeevudejjeejffevvd ehtddufeeihfekgeeuheelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomhepsghorhhishessghurhdrihho X-ME-Proxy: Feedback-ID: i083147f8:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 27 Jul 2023 18:15:02 -0400 (EDT) From: Boris Burkov To: linux-btrfs@vger.kernel.org, kernel-team@fb.com Subject: [PATCH v5 01/18] btrfs: introduce quota mode Date: Thu, 27 Jul 2023 15:12:48 -0700 Message-ID: <0155748c3e1d0b92d942bb3026c0041c8ed933ae.1690495785.git.boris@bur.io> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org In preparation for introducing simple quotas, change from a binary setting for quotas to an enum based mode. Initially, the possible modes are disabled/full. Full quotas is normal btrfs qgroups. Signed-off-by: Boris Burkov Reviewed-by: Josef Bacik --- fs/btrfs/qgroup.c | 7 +++++++ fs/btrfs/qgroup.h | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 2637d6b157ff..0a2085ae9bcd 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -30,6 +30,13 @@ #include "root-tree.h" #include "tree-checker.h" +enum btrfs_qgroup_mode btrfs_qgroup_mode(struct btrfs_fs_info *fs_info) +{ + if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags)) + return BTRFS_QGROUP_MODE_DISABLED; + return BTRFS_QGROUP_MODE_FULL; +} + /* * Helpers to access qgroup reservation * diff --git a/fs/btrfs/qgroup.h b/fs/btrfs/qgroup.h index 7bffa10589d6..bb15e55f00b8 100644 --- a/fs/btrfs/qgroup.h +++ b/fs/btrfs/qgroup.h @@ -250,6 +250,12 @@ enum { }; int btrfs_quota_enable(struct btrfs_fs_info *fs_info); +enum btrfs_qgroup_mode { + BTRFS_QGROUP_MODE_DISABLED, + BTRFS_QGROUP_MODE_FULL, +}; + +enum btrfs_qgroup_mode btrfs_qgroup_mode(struct btrfs_fs_info *fs_info); int btrfs_quota_disable(struct btrfs_fs_info *fs_info); int btrfs_qgroup_rescan(struct btrfs_fs_info *fs_info); void btrfs_qgroup_rescan_resume(struct btrfs_fs_info *fs_info);