From: Aditya Kali <adityakali@google.com>
To: adilger@dilger.ca, tytso.mit.edu@google.com, niu@whamcloud.com,
linux-ext4@vger.kernel.org
Cc: Aditya Kali <adityakali@google.com>
Subject: [PATCH 2/3] tune2fs: Compute quota usage when turning on the 'quota' feature
Date: Thu, 3 Nov 2011 17:18:32 -0700 [thread overview]
Message-ID: <1320365913-25857-2-git-send-email-adityakali@google.com> (raw)
In-Reply-To: <1320365913-25857-1-git-send-email-adityakali@google.com>
When turning on the quota feature, tune2fs would create empty quota inodes and
set their inode numbers in superblock. This required e2fsck to be ran before
using the quota feature. This patch adds adds call to compute_quota() and make
sure that we write correct quota information in the quota files at tune2fs time
itself. This gets rid of the necessity for running e2fsck after setting the
quota feature. Also, tune2fs now does not use existing old quota files
(aquota.user and aquota.group) even if they exist.
Signed-off-by: Aditya Kali <adityakali@google.com>
---
misc/tune2fs.c | 23 +++++++++--------------
1 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 112b258..8bcf667 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -709,23 +709,18 @@ void handle_quota_options(ext2_filsys fs)
quota_init_context(&qctx, fs, -1);
- if (usrquota == QOPT_ENABLE && !fs->super->s_usr_quota_inum) {
- if ((qf_ino = quota_file_exists(fs, USRQUOTA, QFMT_VFS_V1)) > 0)
- quota_set_sb_inum(fs, qf_ino, USRQUOTA);
- else
- quota_write_inode(qctx, USRQUOTA);
- } else if (usrquota == QOPT_DISABLE) {
+ if (usrquota == QOPT_ENABLE || grpquota == QOPT_ENABLE)
+ quota_compute_usage(qctx);
+
+ if (usrquota == QOPT_ENABLE)
+ quota_write_inode(qctx, USRQUOTA);
+ else if (usrquota == QOPT_DISABLE)
quota_remove_inode(fs, USRQUOTA);
- }
- if (grpquota == QOPT_ENABLE && !fs->super->s_grp_quota_inum) {
- if ((qf_ino = quota_file_exists(fs, GRPQUOTA, QFMT_VFS_V1)) > 0)
- quota_set_sb_inum(fs, qf_ino, GRPQUOTA);
- else
- quota_write_inode(qctx, GRPQUOTA);
- } else if (grpquota == QOPT_DISABLE) {
+ if (grpquota == QOPT_ENABLE)
+ quota_write_inode(qctx, GRPQUOTA);
+ else if (grpquota == QOPT_DISABLE)
quota_remove_inode(fs, GRPQUOTA);
- }
quota_release_context(&qctx);
--
1.7.3.1
next prev parent reply other threads:[~2011-11-04 0:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-04 0:18 [PATCH 1/3] libquota: cleanup libquota code Aditya Kali
2011-11-04 0:18 ` Aditya Kali [this message]
2011-11-14 15:57 ` [PATCH 2/3] tune2fs: Compute quota usage when turning on the 'quota' feature Ted Ts'o
2011-11-04 0:18 ` [PATCH 3/3] mke2fs: Add extended option to select quota type Aditya Kali
2011-11-14 15:57 ` Ted Ts'o
2011-11-14 15:57 ` [PATCH 1/3] libquota: cleanup libquota code Ted Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1320365913-25857-2-git-send-email-adityakali@google.com \
--to=adityakali@google.com \
--cc=adilger@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
--cc=niu@whamcloud.com \
--cc=tytso.mit.edu@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).