Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 186086
b: refs/heads/master
c: e1f5c67
h: refs/heads/master
v: v3
  • Loading branch information
Dmitry Monakhov authored and Jan Kara committed Mar 4, 2010
1 parent 8f4582e commit f2380c7
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 55 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e3c9643597ac4bd6b5db62b5e7d915f8c8fa34b6
refs/heads/master: e1f5c67a1994312300ebc41195e6f5bea2f6c065
121 changes: 67 additions & 54 deletions trunk/fs/ext3/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,63 @@ static ext3_fsblk_t get_sb_block(void **data, struct super_block *sb)
return sb_block;
}

#ifdef CONFIG_QUOTA
static int set_qf_name(struct super_block *sb, int qtype, substring_t *args)
{
struct ext3_sb_info *sbi = EXT3_SB(sb);
char *qname;

if (sb_any_quota_loaded(sb) &&
!sbi->s_qf_names[qtype]) {
ext3_msg(sb, KERN_ERR,
"Cannot change journaled "
"quota options when quota turned on");
return 0;
}
qname = match_strdup(args);
if (!qname) {
ext3_msg(sb, KERN_ERR,
"Not enough memory for storing quotafile name");
return 0;
}
if (sbi->s_qf_names[qtype] &&
strcmp(sbi->s_qf_names[qtype], qname)) {
ext3_msg(sb, KERN_ERR,
"%s quota file already specified", QTYPE2NAME(qtype));
kfree(qname);
return 0;
}
sbi->s_qf_names[qtype] = qname;
if (strchr(sbi->s_qf_names[qtype], '/')) {
ext3_msg(sb, KERN_ERR,
"quotafile must be on filesystem root");
kfree(sbi->s_qf_names[qtype]);
sbi->s_qf_names[qtype] = NULL;
return 0;
}
set_opt(sbi->s_mount_opt, QUOTA);
return 1;
}

static int clear_qf_name(struct super_block *sb, int qtype) {

struct ext3_sb_info *sbi = EXT3_SB(sb);

if (sb_any_quota_loaded(sb) &&
sbi->s_qf_names[qtype]) {
ext3_msg(sb, KERN_ERR, "Cannot change journaled quota options"
" when quota turned on");
return 0;
}
/*
* The space will be released later when all options are confirmed
* to be correct
*/
sbi->s_qf_names[qtype] = NULL;
return 1;
}
#endif

static int parse_options (char *options, struct super_block *sb,
unsigned int *inum, unsigned long *journal_devnum,
ext3_fsblk_t *n_blocks_count, int is_remount)
Expand All @@ -905,8 +962,7 @@ static int parse_options (char *options, struct super_block *sb,
int data_opt = 0;
int option;
#ifdef CONFIG_QUOTA
int qtype, qfmt;
char *qname;
int qfmt;
#endif

if (!options)
Expand Down Expand Up @@ -1088,62 +1144,20 @@ static int parse_options (char *options, struct super_block *sb,
break;
#ifdef CONFIG_QUOTA
case Opt_usrjquota:
qtype = USRQUOTA;
goto set_qf_name;
case Opt_grpjquota:
qtype = GRPQUOTA;
set_qf_name:
if (sb_any_quota_loaded(sb) &&
!sbi->s_qf_names[qtype]) {
ext3_msg(sb, KERN_ERR,
"error: cannot change journaled "
"quota options when quota turned on.");
if (!set_qf_name(sb, USRQUOTA, &args[0]))
return 0;
}
qname = match_strdup(&args[0]);
if (!qname) {
ext3_msg(sb, KERN_ERR,
"error: not enough memory for "
"storing quotafile name.");
return 0;
}
if (sbi->s_qf_names[qtype] &&
strcmp(sbi->s_qf_names[qtype], qname)) {
ext3_msg(sb, KERN_ERR,
"error: %s quota file already "
"specified.", QTYPE2NAME(qtype));
kfree(qname);
return 0;
}
sbi->s_qf_names[qtype] = qname;
if (strchr(sbi->s_qf_names[qtype], '/')) {
ext3_msg(sb, KERN_ERR,
"error: quotafile must be on "
"filesystem root.");
kfree(sbi->s_qf_names[qtype]);
sbi->s_qf_names[qtype] = NULL;
break;
case Opt_grpjquota:
if (!set_qf_name(sb, GRPQUOTA, &args[0]))
return 0;
}
set_opt(sbi->s_mount_opt, QUOTA);
break;
case Opt_offusrjquota:
qtype = USRQUOTA;
goto clear_qf_name;
if (!clear_qf_name(sb, USRQUOTA))
return 0;
break;
case Opt_offgrpjquota:
qtype = GRPQUOTA;
clear_qf_name:
if (sb_any_quota_loaded(sb) &&
sbi->s_qf_names[qtype]) {
ext3_msg(sb, KERN_ERR, "error: cannot change "
"journaled quota options when "
"quota turned on.");
if (!clear_qf_name(sb, GRPQUOTA))
return 0;
}
/*
* The space will be released later when all options
* are confirmed to be correct
*/
sbi->s_qf_names[qtype] = NULL;
break;
case Opt_jqfmt_vfsold:
qfmt = QFMT_VFS_OLD;
Expand Down Expand Up @@ -1247,8 +1261,7 @@ static int parse_options (char *options, struct super_block *sb,
if (test_opt(sb, GRPQUOTA) && sbi->s_qf_names[GRPQUOTA])
clear_opt(sbi->s_mount_opt, GRPQUOTA);

if ((sbi->s_qf_names[USRQUOTA] && test_opt(sb, GRPQUOTA)) ||
(sbi->s_qf_names[GRPQUOTA] && test_opt(sb, USRQUOTA))) {
if (test_opt(sb, GRPQUOTA) || test_opt(sb, USRQUOTA)) {
ext3_msg(sb, KERN_ERR, "error: old and new quota "
"format mixing.");
return 0;
Expand Down

0 comments on commit f2380c7

Please sign in to comment.