From patchwork Sun Oct 2 19:44:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Monakhov X-Patchwork-Id: 117368 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 23483B6F76 for ; Mon, 3 Oct 2011 06:41:22 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754365Ab1JBTlT (ORCPT ); Sun, 2 Oct 2011 15:41:19 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:48569 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753973Ab1JBTlQ (ORCPT ); Sun, 2 Oct 2011 15:41:16 -0400 Received: by mail-bw0-f46.google.com with SMTP id zt4so4399490bkb.19 for ; Sun, 02 Oct 2011 12:41:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=+0PUSqwZyOHiqnUAPHicSbzNyWs765e2kWjjfHQ+zeI=; b=L24wwxEqUQAqgUqKGn925sdflytGkNGx+jKSWaId+x3jF0vuqsS3OthRuzmkoTxP7t 7Qc9yhHSoILy55WGIRDiEMePxyCPZ2+OQMvZv4jF5LfqH7Ce9+honoMv/IxbwBd03zFX XXOzTte/OFKxPL3PG3q/nYVdIHzDL+Xn7UkG8= Received: by 10.204.138.211 with SMTP id b19mr9391014bku.257.1317584476002; Sun, 02 Oct 2011 12:41:16 -0700 (PDT) Received: from localhost.localdomain (swsoft-msk-nat.sw.ru. [195.214.232.10]) by mx.google.com with ESMTPS id z7sm10882653bkt.5.2011.10.02.12.41.14 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 02 Oct 2011 12:41:15 -0700 (PDT) From: Dmitry Monakhov To: linux-fsdevel@vger.kernel.org Cc: linux-ext4@vger.kernel.org, jack@suse.cz, viro@ZenIV.linux.org.uk, adityakali@google.com, Dmitry Monakhov Subject: [PATCH 3/6] Implement project id support for generic quota Date: Sun, 2 Oct 2011 23:44:38 +0400 Message-Id: <1317584681-29967-3-git-send-email-dmonakhov@openvz.org> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1317584681-29967-1-git-send-email-dmonakhov@openvz.org> References: <1317584681-29967-1-git-send-email-dmonakhov@openvz.org> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Since all preparation code are already in quota-tree, So this patch is really small. Signed-off-by: Dmitry Monakhov --- fs/quota/dquot.c | 10 ++++++++++ fs/quota/quotaio_v2.h | 6 ++++-- include/linux/quota.h | 9 ++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 5b572c8..aca0430 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -1135,6 +1135,11 @@ static int need_print_warning(struct dquot *dquot) return current_fsuid() == dquot->dq_id; case GRPQUOTA: return in_group_p(dquot->dq_id); + case PRJQUOTA: + /* XXX: Currently there is no way to understand + which project_id this task belonges to, So print + a warn message unconditionally. -dmon */ + return 1; } return 0; } @@ -1380,6 +1385,11 @@ static void __dquot_initialize(struct inode *inode, int type) case GRPQUOTA: id = inode->i_gid; break; + case PRJQUOTA: + if (!inode->i_sb->s_op->get_prjid) + continue; + id = inode->i_sb->s_op->get_prjid(inode); + break; } got[cnt] = dqget(sb, id, cnt); } diff --git a/fs/quota/quotaio_v2.h b/fs/quota/quotaio_v2.h index f1966b4..bfab9df 100644 --- a/fs/quota/quotaio_v2.h +++ b/fs/quota/quotaio_v2.h @@ -13,12 +13,14 @@ */ #define V2_INITQMAGICS {\ 0xd9c01f11, /* USRQUOTA */\ - 0xd9c01927 /* GRPQUOTA */\ + 0xd9c01927, /* GRPQUOTA */\ + 0xd9c03f14 /* PRJQUOTA */\ } #define V2_INITQVERSIONS {\ 1, /* USRQUOTA */\ - 1 /* GRPQUOTA */\ + 1, /* GRPQUOTA */ \ + 1 /* PRJQUOTA */\ } /* First generic header */ diff --git a/include/linux/quota.h b/include/linux/quota.h index cb78556..f8696cd 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h @@ -36,11 +36,17 @@ #include #include -#define __DQUOT_VERSION__ "dquot_6.5.2" +#define __DQUOT_VERSION__ "dquot_6.6.0" +#ifdef CONFIG_PROJECT_ID +#define MAXQUOTAS 3 +#else #define MAXQUOTAS 2 +#endif + #define USRQUOTA 0 /* element used for user quotas */ #define GRPQUOTA 1 /* element used for group quotas */ +#define PRJQUOTA 2 /* element used for project quotas */ /* * Definitions for the default names of the quotas files. @@ -48,6 +54,7 @@ #define INITQFNAMES { \ "user", /* USRQUOTA */ \ "group", /* GRPQUOTA */ \ + "project", /* RPJQUOTA */ \ "undefined", \ };