From patchwork Fri Feb 22 12:09:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Shilong X-Patchwork-Id: 2175771 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 64AE93FCFC for ; Fri, 22 Feb 2013 12:10:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756137Ab3BVMKI (ORCPT ); Fri, 22 Feb 2013 07:10:08 -0500 Received: from mail-pa0-f47.google.com ([209.85.220.47]:46415 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756135Ab3BVMJ4 (ORCPT ); Fri, 22 Feb 2013 07:09:56 -0500 Received: by mail-pa0-f47.google.com with SMTP id bj3so436222pad.34 for ; Fri, 22 Feb 2013 04:09:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=w0dTcCuKK4kThNtQVr8db9Jb3ab7s7s/HvIUq72LA/A=; b=IAdbL2yRriDSL99YgeWhgsVSLH71Cd4PctyAKWEgGScE/uNPc98KzpO/HY6z99hd4k 0n/alFmQTNM1c5ONtRdrum0lafjvGiY+EiRz8JclqrHuc5W/PmqxYWUS3IDV2PhTr1ox gD/J3SQ/W+xwwtbIpCnYtSCFnl7T0SAucRUJDI+7d0pxSgB0J6MVcvdWmg2aTgJxxjWQ OC+rsU5nALpK0dmLs2fP8Q78KwFiTsTu9tVoc9bcV0tIJGeQpjHmtGrczHVNsj95cfzS M+lUCwpgLbqucQkj5+2jp+R+XzRVz9rqiYjrMWflEUD2klA+I/rU/t8jTWt73vZ2152L u16A== X-Received: by 10.66.159.132 with SMTP id xc4mr3577502pab.145.1361534995571; Fri, 22 Feb 2013 04:09:55 -0800 (PST) Received: from localhost.localdomain ([223.65.185.63]) by mx.google.com with ESMTPS id z6sm2808987pav.3.2013.02.22.04.09.53 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 22 Feb 2013 04:09:55 -0800 (PST) From: Wang Shilong To: linux-btrfs@vger.kernel.org Cc: sensille@gmx.net Subject: [RESEND RFC PATCH 2/2] Btrfs: disable the qgroup level 0 for userspace use Date: Fri, 22 Feb 2013 20:09:50 +0800 Message-Id: <1361534990-2627-1-git-send-email-wangshilong1991@gmail.com> X-Mailer: git-send-email 1.7.11.7 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Wang Shilong This patch tries to stop users to create/destroy qgroup level 0, users can only create/destroy qgroup level more than 0. See the fact: a subvolume/snapshot qgroup was created automatically when creating subvolume/snapshot, so creating a qgroup level 0 can't be a subvolume/snapshot qgroup, the only way to use it is that assigning subvolume/snapshot qgroup to it, the point is that we don't want to have a parent qgroup whose level is 0. So we want to force users to use qgroup with clear relations which means a parent qgroup's level > child qgroup's level.For example: 2/0 / \ / \ / \ 1/0 1/1 / \ \ / \ \ / \ \ 0/256 0/257 0/258 This pattern of quota is nature and easy for users to understand, otherwise it will make the quota configuration confusing and difficult to maintain. Signed-off-by: Wang Shilong Acked-by: Miao Xie Cc: Arne Jansen --- fs/btrfs/ioctl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index a31cd93..3590c21 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -3755,7 +3755,7 @@ static long btrfs_ioctl_qgroup_create(struct file *file, void __user *arg) goto drop_write; } - if (!sa->qgroupid) { + if (!(sa->qgroupid >> 48)) { ret = -EINVAL; goto out; }