--- fs/ext3/super.c | 61 +++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 43 insertions(+), 18 deletions(-) diff -puN fs/ext3/super.c~ext3-journalled-quotas-cleanups fs/ext3/super.c --- 25/fs/ext3/super.c~ext3-journalled-quotas-cleanups 2004-02-16 03:41:18.000000000 -0800 +++ 25-akpm/fs/ext3/super.c 2004-02-16 03:41:25.000000000 -0800 @@ -1042,7 +1042,12 @@ static void ext3_orphan_cleanup (struct struct ext3_super_block * es) { unsigned int s_flags = sb->s_flags; - int nr_orphans = 0, nr_truncates = 0, i; + int nr_orphans = 0; + int nr_truncates = 0; +#ifdef CONFIG_QUOTA + int i; +#endif + if (!es->s_last_orphan) { jbd_debug(4, "no orphan inodes to clean up\n"); return; @@ -1063,14 +1068,17 @@ static void ext3_orphan_cleanup (struct sb->s_flags &= ~MS_RDONLY; } #ifdef CONFIG_QUOTA - sb->s_flags |= MS_ACTIVE; /* Needed for iput() to work correctly and not trash data */ + sb->s_flags |= MS_ACTIVE; /* Needed for iput() to work correctly + and not trash data */ /* Turn on quotas so that they are updated correctly */ - for (i=0; i < MAXQUOTAS; i++) + for (i = 0; i < MAXQUOTAS; i++) { if (EXT3_SB(sb)->s_qf_names[i]) { int ret = ext3_quota_on_mount(sb, i); if (ret < 0) - printk(KERN_ERR "EXT3-fs: Cannot turn on journalled quota: error %d\n", ret); + printk(KERN_ERR "EXT3-fs: Cannot turn on " + "journalled quota: error %d\n", ret); } + } #endif while (es->s_last_orphan) { @@ -1113,9 +1121,10 @@ static void ext3_orphan_cleanup (struct sb->s_id, PLURAL(nr_truncates)); #ifdef CONFIG_QUOTA /* Turn quotas off */ - for (i = 0; i < MAXQUOTAS; i++) + for (i = 0; i < MAXQUOTAS; i++) { if (sb_dqopt(sb)->files[i]) ext3_quota_off_mount(sb, i); + } #endif sb->s_flags = s_flags; /* Restore MS_RDONLY status */ } @@ -2076,8 +2085,9 @@ int ext3_statfs (struct super_block * sb return 0; } -/* Helper function for writing quotas on sync - we need to start transaction before quota file - * is locked for write. Otherwise the are possible deadlocks: +/* + * Helper function for writing quotas on sync - we need to start transaction + * before quota file is locked for write. Otherwise the are possible deadlocks: * Process 1 Process 2 * ext3_create() quota_sync() * journal_start() write_dquot() @@ -2103,7 +2113,8 @@ static int ext3_write_dquot(struct dquot int ret, err; handle_t *handle; - handle = ext3_journal_start(dquot_to_inode(dquot), init ? EXT3_QUOTA_INIT_BLOCKS : EXT3_QUOTA_TRANS_BLOCKS); + handle = ext3_journal_start(dquot_to_inode(dquot), + init ? EXT3_QUOTA_INIT_BLOCKS : EXT3_QUOTA_TRANS_BLOCKS); if (IS_ERR(handle)) { ret = PTR_ERR(handle); goto out; @@ -2119,7 +2130,8 @@ out: 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[0] || + EXT3_SB(dquot->dq_sb)->s_qf_names[1]) return ext3_write_dquot(dquot, 0); else return dquot_mark_dquot_dirty(dquot); @@ -2143,7 +2155,9 @@ out: return ret; } -/* Turn on quotas during mount time - we need to find the quota file and such... */ +/* + * Turn on quotas during mount time - we need to find the quota file and such. + */ static int ext3_quota_on_mount(struct super_block *sb, int type) { int err; @@ -2158,7 +2172,10 @@ static int ext3_quota_on_mount(struct su err = vfs_quota_on_mount(type, EXT3_SB(sb)->s_jquota_fmt, dentry); if (err) dput(dentry); - /* We keep the dentry reference if everything went ok - we drop it on quota_off time */ + /* + * We keep the dentry reference if everything went ok - we drop it on + * quota_off time + */ return err; } @@ -2170,27 +2187,35 @@ static int ext3_quota_off_mount(struct s dentry = sb_dqopt(sb)->files[type]->f_dentry; err = vfs_quota_off_mount(sb, type); - d_invalidate(dentry); /* We invalidate dentry - it has at least wrong hash... */ + + /* We invalidate dentry - it has at least wrong hash... */ + d_invalidate(dentry); dput(dentry); return err; } -static int ext3_quota_on(struct super_block *sb, int type, int format_id, char *path) +static int +ext3_quota_on(struct super_block *sb, int type, int format_id, char *path) { int err; struct nameidata nd; - if (!EXT3_SB(sb)->s_qf_names[0] && !EXT3_SB(sb)->s_qf_names[1]) /* Not journalling quota? */ + if (!EXT3_SB(sb)->s_qf_names[0] && !EXT3_SB(sb)->s_qf_names[1]) { + /* Not journalling quota? */ return vfs_quota_on(sb, type, format_id, path); + } err = path_lookup(path, LOOKUP_FOLLOW, &nd); if (err) return err; - if (nd.mnt->mnt_sb != sb) /* Quotafile not on the same filesystem? */ + if (nd.mnt->mnt_sb != sb) /* Quotafile not on the same fs? */ return -EXDEV; - if (nd.dentry->d_parent->d_inode != sb->s_root->d_inode) /* Quotafile not of fs root? */ - printk(KERN_WARNING "EXT3-fs: Quota file not on filesystem root. Journalled quota will not work.\n"); + if (nd.dentry->d_parent->d_inode != sb->s_root->d_inode) + /* Quotafile not of fs root? */ + printk(KERN_WARNING "EXT3-fs: Quota file not on filesystem " + "root. Journalled quota will not work\n"); if (!ext3_should_journal_data(nd.dentry->d_inode)) - printk(KERN_WARNING "EXT3-fs: Quota file does not have data-journalling. Journalled quota will not work.\n"); + printk(KERN_WARNING "EXT3-fs: Quota file does not have " + "data-journalling. Journalled quota will not work\n"); path_release(&nd); return vfs_quota_on(sb, type, format_id, path); } _