From patchwork Tue Jul 21 08:37:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Dongsheng X-Patchwork-Id: 6833271 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 88049C05AC for ; Tue, 21 Jul 2015 08:43:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8D1F520690 for ; Tue, 21 Jul 2015 08:43:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A487720678 for ; Tue, 21 Jul 2015 08:43:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754179AbbGUInx (ORCPT ); Tue, 21 Jul 2015 04:43:53 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:57008 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753453AbbGUIns (ORCPT ); Tue, 21 Jul 2015 04:43:48 -0400 X-IronPort-AV: E=Sophos;i="5.13,665,1427731200"; d="scan'208";a="98671208" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 21 Jul 2015 16:47:21 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id t6L8fpwW005025; Tue, 21 Jul 2015 16:41:51 +0800 Received: from yds-PC.g08.fujitsu.local (10.167.226.66) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Tue, 21 Jul 2015 16:43:38 +0800 From: Dongsheng Yang To: , , CC: , , Dongsheng Yang Subject: [PATCH 12/25] ubifs: introduce quota related mount options Date: Tue, 21 Jul 2015 16:37:43 +0800 Message-ID: <1437467876-22106-13-git-send-email-yangds.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1437467876-22106-1-git-send-email-yangds.fnst@cn.fujitsu.com> References: <1437467876-22106-1-git-send-email-yangds.fnst@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.66] Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This commit introduce mount options of quota, noquota, usrquota and grpquota. These options are used to make ubifs support quota. But with this commit, quota will not working on ubifs actually. We just introduce options here and will make ubifs support quota later. Signed-off-by: Dongsheng Yang --- fs/ubifs/super.c | 30 ++++++++++++++++++++++++++++++ fs/ubifs/ubifs.h | 7 +++++++ 2 files changed, 37 insertions(+) diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 161b1a6..2491fff 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include "ubifs.h" @@ -439,6 +440,12 @@ static int ubifs_show_options(struct seq_file *s, struct dentry *root) else if (c->mount_opts.chk_data_crc == 1) seq_puts(s, ",no_chk_data_crc"); + if (c->usrquota) + seq_puts(s, ",usrquota"); + + if (c->grpquota) + seq_puts(s, ",grpquota"); + if (c->mount_opts.override_compr) { seq_printf(s, ",compr=%s", ubifs_compr_name(c->mount_opts.compr_type)); @@ -930,6 +937,10 @@ enum { Opt_chk_data_crc, Opt_no_chk_data_crc, Opt_override_compr, + Opt_ignore, + Opt_quota, + Opt_usrquota, + Opt_grpquota, Opt_err, }; @@ -941,6 +952,10 @@ static const match_table_t tokens = { {Opt_chk_data_crc, "chk_data_crc"}, {Opt_no_chk_data_crc, "no_chk_data_crc"}, {Opt_override_compr, "compr=%s"}, + {Opt_ignore, "noquota"}, + {Opt_quota, "quota"}, + {Opt_usrquota, "usrquota"}, + {Opt_grpquota, "grpquota"}, {Opt_err, NULL}, }; @@ -1041,6 +1056,21 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options, c->default_compr = c->mount_opts.compr_type; break; } +#ifdef CONFIG_QUOTA + case Opt_quota: + case Opt_usrquota: + c->usrquota = 1; + break; + case Opt_grpquota: + c->grpquota = 1; + break; +#else + case Opt_quota: + case Opt_usrquota: + case Opt_grpquota: + ubifs_err(c, "quota operations not supported"); + break; +#endif default: { unsigned long flag; diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index a6ad955..9754bb6 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h @@ -418,6 +418,9 @@ struct ubifs_inode { loff_t synced_i_size; loff_t ui_size; int flags; +#ifdef CONFIG_QUOTA + struct dquot *i_dquot[MAXQUOTAS]; +#endif pgoff_t last_page_read; pgoff_t read_in_a_row; int data_len; @@ -1039,6 +1042,8 @@ struct ubifs_debug_info; * @bulk_read: enable bulk-reads * @default_compr: default compression algorithm (%UBIFS_COMPR_LZO, etc) * @rw_incompat: the media is not R/W compatible + * @usrquota: enable usrquota + * @grpquota: enable grpquota * * @tnc_mutex: protects the Tree Node Cache (TNC), @zroot, @cnext, @enext, and * @calc_idx_sz @@ -1280,6 +1285,8 @@ struct ubifs_info { unsigned int bulk_read:1; unsigned int default_compr:2; unsigned int rw_incompat:1; + unsigned int usrquota:1; + unsigned int grpquota:1; struct mutex tnc_mutex; struct ubifs_zbranch zroot;