2004-04-23 19:37:22

by Jan Kara

[permalink] [raw]
Subject: [PATCH] Minor fixes in journalled quota

Hello Linus!

I'm sending you a few minor fixes to the quota code - it fixes one
memory leak when turning journalled quotas off and does a trivial code
cleanup. Please apply.

Honza

PS: Andrew, this patch is needed for the dirty-list patch I sent
yesterday to apply cleanly. Somehow I forgot to send you it :(. Should
I resend you it?

diff -ruX /home/jack/.kerndiffexclude linux-2.6.5-2-jquota/fs/ext3/super.c linux-2.6.5-3-jquota2/fs/ext3/super.c
--- linux-2.6.5-2-jquota/fs/ext3/super.c 2004-03-22 21:29:49.000000000 +0100
+++ linux-2.6.5-3-jquota2/fs/ext3/super.c 2004-03-30 16:06:18.000000000 +0200
@@ -405,6 +405,12 @@
kfree(sbi->s_group_desc);
kfree(sbi->s_debts);
brelse(sbi->s_sbh);
+#ifdef CONFIG_QUOTA
+ for (i = 0; i < MAXQUOTAS; i++) {
+ if (sbi->s_qf_names[i])
+ kfree(sbi->s_qf_names[i]);
+ }
+#endif

/* Debugging code just in case the in-memory inode orphan list
* isn't empty. The on-disk one can be non-empty if we've
@@ -893,7 +899,8 @@
}
}
#ifdef CONFIG_QUOTA
- if (!sbi->s_jquota_fmt && (sbi->s_qf_names[0] || sbi->s_qf_names[1])) {
+ if (!sbi->s_jquota_fmt && (sbi->s_qf_names[USRQUOTA] ||
+ sbi->s_qf_names[GRPQUOTA])) {
printk(KERN_ERR
"EXT3-fs: journalled quota format not specified.\n");
return 0;
@@ -2170,8 +2177,8 @@
static int ext3_mark_dquot_dirty(struct dquot * dquot)
{
/* Are we journalling quotas? */
- if (EXT3_SB(dquot->dq_sb)->s_qf_names[0] ||
- EXT3_SB(dquot->dq_sb)->s_qf_names[1])
+ if (EXT3_SB(dquot->dq_sb)->s_qf_names[USRQUOTA] ||
+ EXT3_SB(dquot->dq_sb)->s_qf_names[GRPQUOTA])
return ext3_write_dquot(dquot);
else
return dquot_mark_dquot_dirty(dquot);
@@ -2240,7 +2247,8 @@
struct nameidata nd;

/* Not journalling quota? */
- if (!EXT3_SB(sb)->s_qf_names[0] && !EXT3_SB(sb)->s_qf_names[1])
+ if (!EXT3_SB(sb)->s_qf_names[USRQUOTA] &&
+ !EXT3_SB(sb)->s_qf_names[GRPQUOTA])
return vfs_quota_on(sb, type, format_id, path);
err = path_lookup(path, LOOKUP_FOLLOW, &nd);
if (err)


2004-04-23 20:43:46

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] Minor fixes in journalled quota

Jan Kara <[email protected]> wrote:
>
> PS: Andrew, this patch is needed for the dirty-list patch I sent
> yesterday to apply cleanly. Somehow I forgot to send you it :(. Should
> I resend you it?

Is OK - I silently corrected it ;)