From patchwork Mon Aug 6 06:00:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 10556517 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A9A9B174A for ; Mon, 6 Aug 2018 06:00:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 985D729312 for ; Mon, 6 Aug 2018 06:00:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8CF1729317; Mon, 6 Aug 2018 06:00:25 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 2726A29312 for ; Mon, 6 Aug 2018 06:00:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727032AbeHFIHq (ORCPT ); Mon, 6 Aug 2018 04:07:46 -0400 Received: from mx2.suse.de ([195.135.220.15]:41386 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726412AbeHFIHq (ORCPT ); Mon, 6 Aug 2018 04:07:46 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2DE59AE1A for ; Mon, 6 Aug 2018 06:00:17 +0000 (UTC) From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH 3/3] btrfs-progs: Doc: Update btrfs-qgroup for the rescan condition Date: Mon, 6 Aug 2018 14:00:08 +0800 Message-Id: <20180806060008.9556-4-wqu@suse.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180806060008.9556-1-wqu@suse.com> References: <20180806060008.9556-1-wqu@suse.com> 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 Add a new section, RESCAN CONDITION, to explain why and when we need a full quota rescan when assigning/removing qgroup relationship. Also, since 'remove' shares the same options of 'assign', add reference to 'assign' options for 'remove' subcommand. Signed-off-by: Qu Wenruo --- Documentation/btrfs-qgroup.asciidoc | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Documentation/btrfs-qgroup.asciidoc b/Documentation/btrfs-qgroup.asciidoc index fee173860000..d1c8fedc94d4 100644 --- a/Documentation/btrfs-qgroup.asciidoc +++ b/Documentation/btrfs-qgroup.asciidoc @@ -49,8 +49,10 @@ identified by . --rescan:::: (Default) Automatically schedule quota rescan if the new qgroup assignment leads to quota inconsistency. +Check `RESCAN CONDITION` for more info. --no-rescan:::: -Explicitly ask not to do a rescan. +Explicitly ask not to do a rescan, even if the assigning makes quota +inconsistent. *create* :: Create a subvolume quota group. @@ -83,6 +85,10 @@ limit space exclusively assigned to this qgroup. *remove* :: Remove the relationship between child qgroup and parent qgroup in the btrfs filesystem identified by . ++ +`Options` ++ +The same as *assign* subcommand. *show* [options] :: Show all qgroups in the btrfs filesystem identified by . @@ -131,6 +137,20 @@ If multiple s is given, use comma to separate. To retrieve information after updating the state of qgroups, force sync of the filesystem identified by before getting information. +RESCAN CONDITION +---------------- +Btrfs quota only keep records of how many bytes are referred to ('rfer') and +how many bytes are owned exclusively ('excl'). +It doesn't keep any record of which extent is owned exclusively or shared. + +This means when qgroup relationship changes, extents owners change and qgroups +number are no longer consistent unless we do a full rescan. + +However there are cases we can avoid full rescan, if a subvolume whose 'rfer' +number equals its 'excl' number, which means all bytes are exclusive owned, +then assigning/removing this subvolume only needs to add/subtract 'rfer' number +from its parent qgroup. + EXIT STATUS ----------- *btrfs qgroup* returns a zero exit status if it succeeds. Non zero is