diff options
-rw-r--r-- | fs/ocfs2/file.c | 4 | ||||
-rw-r--r-- | fs/ocfs2/quota.h | 5 | ||||
-rw-r--r-- | fs/ocfs2/quota_global.c | 4 | ||||
-rw-r--r-- | fs/ocfs2/quota_local.c | 33 | ||||
-rw-r--r-- | fs/ocfs2/super.c | 30 |
5 files changed, 42 insertions, 34 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 2930e231f3f9..0a8619a772ef 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -1125,7 +1125,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) | |||
1125 | struct ocfs2_super *osb = OCFS2_SB(sb); | 1125 | struct ocfs2_super *osb = OCFS2_SB(sb); |
1126 | struct buffer_head *bh = NULL; | 1126 | struct buffer_head *bh = NULL; |
1127 | handle_t *handle = NULL; | 1127 | handle_t *handle = NULL; |
1128 | struct dquot *transfer_to[MAXQUOTAS] = { }; | 1128 | struct dquot *transfer_to[OCFS2_MAXQUOTAS] = { }; |
1129 | int qtype; | 1129 | int qtype; |
1130 | 1130 | ||
1131 | trace_ocfs2_setattr(inode, dentry, | 1131 | trace_ocfs2_setattr(inode, dentry, |
@@ -1253,7 +1253,7 @@ bail: | |||
1253 | brelse(bh); | 1253 | brelse(bh); |
1254 | 1254 | ||
1255 | /* Release quota pointers in case we acquired them */ | 1255 | /* Release quota pointers in case we acquired them */ |
1256 | for (qtype = 0; qtype < MAXQUOTAS; qtype++) | 1256 | for (qtype = 0; qtype < OCFS2_MAXQUOTAS; qtype++) |
1257 | dqput(transfer_to[qtype]); | 1257 | dqput(transfer_to[qtype]); |
1258 | 1258 | ||
1259 | if (!status && attr->ia_valid & ATTR_MODE) { | 1259 | if (!status && attr->ia_valid & ATTR_MODE) { |
diff --git a/fs/ocfs2/quota.h b/fs/ocfs2/quota.h index f266d67df3c6..1eae330193a6 100644 --- a/fs/ocfs2/quota.h +++ b/fs/ocfs2/quota.h | |||
@@ -17,6 +17,9 @@ | |||
17 | 17 | ||
18 | #include "ocfs2.h" | 18 | #include "ocfs2.h" |
19 | 19 | ||
20 | /* Number of quota types we support */ | ||
21 | #define OCFS2_MAXQUOTAS 2 | ||
22 | |||
20 | /* | 23 | /* |
21 | * In-memory structures | 24 | * In-memory structures |
22 | */ | 25 | */ |
@@ -39,7 +42,7 @@ struct ocfs2_recovery_chunk { | |||
39 | }; | 42 | }; |
40 | 43 | ||
41 | struct ocfs2_quota_recovery { | 44 | struct ocfs2_quota_recovery { |
42 | struct list_head r_list[MAXQUOTAS]; /* List of chunks to recover */ | 45 | struct list_head r_list[OCFS2_MAXQUOTAS]; /* List of chunks to recover */ |
43 | }; | 46 | }; |
44 | 47 | ||
45 | /* In-memory structure with quota header information */ | 48 | /* In-memory structure with quota header information */ |
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c index b990a62cff50..c93d67220887 100644 --- a/fs/ocfs2/quota_global.c +++ b/fs/ocfs2/quota_global.c | |||
@@ -336,8 +336,8 @@ void ocfs2_unlock_global_qf(struct ocfs2_mem_dqinfo *oinfo, int ex) | |||
336 | int ocfs2_global_read_info(struct super_block *sb, int type) | 336 | int ocfs2_global_read_info(struct super_block *sb, int type) |
337 | { | 337 | { |
338 | struct inode *gqinode = NULL; | 338 | struct inode *gqinode = NULL; |
339 | unsigned int ino[MAXQUOTAS] = { USER_QUOTA_SYSTEM_INODE, | 339 | unsigned int ino[OCFS2_MAXQUOTAS] = { USER_QUOTA_SYSTEM_INODE, |
340 | GROUP_QUOTA_SYSTEM_INODE }; | 340 | GROUP_QUOTA_SYSTEM_INODE }; |
341 | struct ocfs2_global_disk_dqinfo dinfo; | 341 | struct ocfs2_global_disk_dqinfo dinfo; |
342 | struct mem_dqinfo *info = sb_dqinfo(sb, type); | 342 | struct mem_dqinfo *info = sb_dqinfo(sb, type); |
343 | struct ocfs2_mem_dqinfo *oinfo = info->dqi_priv; | 343 | struct ocfs2_mem_dqinfo *oinfo = info->dqi_priv; |
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c index 2001862bf2b1..10b653930ee2 100644 --- a/fs/ocfs2/quota_local.c +++ b/fs/ocfs2/quota_local.c | |||
@@ -166,12 +166,12 @@ static int ocfs2_read_quota_block(struct inode *inode, u64 v_block, | |||
166 | /* Check whether we understand format of quota files */ | 166 | /* Check whether we understand format of quota files */ |
167 | static int ocfs2_local_check_quota_file(struct super_block *sb, int type) | 167 | static int ocfs2_local_check_quota_file(struct super_block *sb, int type) |
168 | { | 168 | { |
169 | unsigned int lmagics[MAXQUOTAS] = OCFS2_LOCAL_QMAGICS; | 169 | unsigned int lmagics[OCFS2_MAXQUOTAS] = OCFS2_LOCAL_QMAGICS; |
170 | unsigned int lversions[MAXQUOTAS] = OCFS2_LOCAL_QVERSIONS; | 170 | unsigned int lversions[OCFS2_MAXQUOTAS] = OCFS2_LOCAL_QVERSIONS; |
171 | unsigned int gmagics[MAXQUOTAS] = OCFS2_GLOBAL_QMAGICS; | 171 | unsigned int gmagics[OCFS2_MAXQUOTAS] = OCFS2_GLOBAL_QMAGICS; |
172 | unsigned int gversions[MAXQUOTAS] = OCFS2_GLOBAL_QVERSIONS; | 172 | unsigned int gversions[OCFS2_MAXQUOTAS] = OCFS2_GLOBAL_QVERSIONS; |
173 | unsigned int ino[MAXQUOTAS] = { USER_QUOTA_SYSTEM_INODE, | 173 | unsigned int ino[OCFS2_MAXQUOTAS] = { USER_QUOTA_SYSTEM_INODE, |
174 | GROUP_QUOTA_SYSTEM_INODE }; | 174 | GROUP_QUOTA_SYSTEM_INODE }; |
175 | struct buffer_head *bh = NULL; | 175 | struct buffer_head *bh = NULL; |
176 | struct inode *linode = sb_dqopt(sb)->files[type]; | 176 | struct inode *linode = sb_dqopt(sb)->files[type]; |
177 | struct inode *ginode = NULL; | 177 | struct inode *ginode = NULL; |
@@ -336,7 +336,7 @@ void ocfs2_free_quota_recovery(struct ocfs2_quota_recovery *rec) | |||
336 | { | 336 | { |
337 | int type; | 337 | int type; |
338 | 338 | ||
339 | for (type = 0; type < MAXQUOTAS; type++) | 339 | for (type = 0; type < OCFS2_MAXQUOTAS; type++) |
340 | free_recovery_list(&(rec->r_list[type])); | 340 | free_recovery_list(&(rec->r_list[type])); |
341 | kfree(rec); | 341 | kfree(rec); |
342 | } | 342 | } |
@@ -382,7 +382,7 @@ static struct ocfs2_quota_recovery *ocfs2_alloc_quota_recovery(void) | |||
382 | rec = kmalloc(sizeof(struct ocfs2_quota_recovery), GFP_NOFS); | 382 | rec = kmalloc(sizeof(struct ocfs2_quota_recovery), GFP_NOFS); |
383 | if (!rec) | 383 | if (!rec) |
384 | return NULL; | 384 | return NULL; |
385 | for (type = 0; type < MAXQUOTAS; type++) | 385 | for (type = 0; type < OCFS2_MAXQUOTAS; type++) |
386 | INIT_LIST_HEAD(&(rec->r_list[type])); | 386 | INIT_LIST_HEAD(&(rec->r_list[type])); |
387 | return rec; | 387 | return rec; |
388 | } | 388 | } |
@@ -392,10 +392,11 @@ struct ocfs2_quota_recovery *ocfs2_begin_quota_recovery( | |||
392 | struct ocfs2_super *osb, | 392 | struct ocfs2_super *osb, |
393 | int slot_num) | 393 | int slot_num) |
394 | { | 394 | { |
395 | unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA, | 395 | unsigned int feature[OCFS2_MAXQUOTAS] = { |
396 | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA}; | 396 | OCFS2_FEATURE_RO_COMPAT_USRQUOTA, |
397 | unsigned int ino[MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE, | 397 | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA}; |
398 | LOCAL_GROUP_QUOTA_SYSTEM_INODE }; | 398 | unsigned int ino[OCFS2_MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE, |
399 | LOCAL_GROUP_QUOTA_SYSTEM_INODE }; | ||
399 | struct super_block *sb = osb->sb; | 400 | struct super_block *sb = osb->sb; |
400 | struct ocfs2_local_disk_dqinfo *ldinfo; | 401 | struct ocfs2_local_disk_dqinfo *ldinfo; |
401 | struct inode *lqinode; | 402 | struct inode *lqinode; |
@@ -412,7 +413,7 @@ struct ocfs2_quota_recovery *ocfs2_begin_quota_recovery( | |||
412 | return ERR_PTR(-ENOMEM); | 413 | return ERR_PTR(-ENOMEM); |
413 | /* First init... */ | 414 | /* First init... */ |
414 | 415 | ||
415 | for (type = 0; type < MAXQUOTAS; type++) { | 416 | for (type = 0; type < OCFS2_MAXQUOTAS; type++) { |
416 | if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) | 417 | if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) |
417 | continue; | 418 | continue; |
418 | /* At this point, journal of the slot is already replayed so | 419 | /* At this point, journal of the slot is already replayed so |
@@ -589,8 +590,8 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb, | |||
589 | struct ocfs2_quota_recovery *rec, | 590 | struct ocfs2_quota_recovery *rec, |
590 | int slot_num) | 591 | int slot_num) |
591 | { | 592 | { |
592 | unsigned int ino[MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE, | 593 | unsigned int ino[OCFS2_MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE, |
593 | LOCAL_GROUP_QUOTA_SYSTEM_INODE }; | 594 | LOCAL_GROUP_QUOTA_SYSTEM_INODE }; |
594 | struct super_block *sb = osb->sb; | 595 | struct super_block *sb = osb->sb; |
595 | struct ocfs2_local_disk_dqinfo *ldinfo; | 596 | struct ocfs2_local_disk_dqinfo *ldinfo; |
596 | struct buffer_head *bh; | 597 | struct buffer_head *bh; |
@@ -604,7 +605,7 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb, | |||
604 | "slot %u\n", osb->dev_str, slot_num); | 605 | "slot %u\n", osb->dev_str, slot_num); |
605 | 606 | ||
606 | mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); | 607 | mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); |
607 | for (type = 0; type < MAXQUOTAS; type++) { | 608 | for (type = 0; type < OCFS2_MAXQUOTAS; type++) { |
608 | if (list_empty(&(rec->r_list[type]))) | 609 | if (list_empty(&(rec->r_list[type]))) |
609 | continue; | 610 | continue; |
610 | trace_ocfs2_finish_quota_recovery(slot_num); | 611 | trace_ocfs2_finish_quota_recovery(slot_num); |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index ddb662b32447..aa35d6309b93 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -899,11 +899,12 @@ static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend) | |||
899 | { | 899 | { |
900 | int type; | 900 | int type; |
901 | struct super_block *sb = osb->sb; | 901 | struct super_block *sb = osb->sb; |
902 | unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA, | 902 | unsigned int feature[OCFS2_MAXQUOTAS] = { |
903 | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA}; | 903 | OCFS2_FEATURE_RO_COMPAT_USRQUOTA, |
904 | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA}; | ||
904 | int status = 0; | 905 | int status = 0; |
905 | 906 | ||
906 | for (type = 0; type < MAXQUOTAS; type++) { | 907 | for (type = 0; type < OCFS2_MAXQUOTAS; type++) { |
907 | if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) | 908 | if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) |
908 | continue; | 909 | continue; |
909 | if (unsuspend) | 910 | if (unsuspend) |
@@ -927,17 +928,19 @@ static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend) | |||
927 | 928 | ||
928 | static int ocfs2_enable_quotas(struct ocfs2_super *osb) | 929 | static int ocfs2_enable_quotas(struct ocfs2_super *osb) |
929 | { | 930 | { |
930 | struct inode *inode[MAXQUOTAS] = { NULL, NULL }; | 931 | struct inode *inode[OCFS2_MAXQUOTAS] = { NULL, NULL }; |
931 | struct super_block *sb = osb->sb; | 932 | struct super_block *sb = osb->sb; |
932 | unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA, | 933 | unsigned int feature[OCFS2_MAXQUOTAS] = { |
933 | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA}; | 934 | OCFS2_FEATURE_RO_COMPAT_USRQUOTA, |
934 | unsigned int ino[MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE, | 935 | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA}; |
936 | unsigned int ino[OCFS2_MAXQUOTAS] = { | ||
937 | LOCAL_USER_QUOTA_SYSTEM_INODE, | ||
935 | LOCAL_GROUP_QUOTA_SYSTEM_INODE }; | 938 | LOCAL_GROUP_QUOTA_SYSTEM_INODE }; |
936 | int status; | 939 | int status; |
937 | int type; | 940 | int type; |
938 | 941 | ||
939 | sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE | DQUOT_NEGATIVE_USAGE; | 942 | sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE | DQUOT_NEGATIVE_USAGE; |
940 | for (type = 0; type < MAXQUOTAS; type++) { | 943 | for (type = 0; type < OCFS2_MAXQUOTAS; type++) { |
941 | if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) | 944 | if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) |
942 | continue; | 945 | continue; |
943 | inode[type] = ocfs2_get_system_file_inode(osb, ino[type], | 946 | inode[type] = ocfs2_get_system_file_inode(osb, ino[type], |
@@ -952,12 +955,12 @@ static int ocfs2_enable_quotas(struct ocfs2_super *osb) | |||
952 | goto out_quota_off; | 955 | goto out_quota_off; |
953 | } | 956 | } |
954 | 957 | ||
955 | for (type = 0; type < MAXQUOTAS; type++) | 958 | for (type = 0; type < OCFS2_MAXQUOTAS; type++) |
956 | iput(inode[type]); | 959 | iput(inode[type]); |
957 | return 0; | 960 | return 0; |
958 | out_quota_off: | 961 | out_quota_off: |
959 | ocfs2_disable_quotas(osb); | 962 | ocfs2_disable_quotas(osb); |
960 | for (type = 0; type < MAXQUOTAS; type++) | 963 | for (type = 0; type < OCFS2_MAXQUOTAS; type++) |
961 | iput(inode[type]); | 964 | iput(inode[type]); |
962 | mlog_errno(status); | 965 | mlog_errno(status); |
963 | return status; | 966 | return status; |
@@ -972,7 +975,7 @@ static void ocfs2_disable_quotas(struct ocfs2_super *osb) | |||
972 | 975 | ||
973 | /* We mostly ignore errors in this function because there's not much | 976 | /* We mostly ignore errors in this function because there's not much |
974 | * we can do when we see them */ | 977 | * we can do when we see them */ |
975 | for (type = 0; type < MAXQUOTAS; type++) { | 978 | for (type = 0; type < OCFS2_MAXQUOTAS; type++) { |
976 | if (!sb_has_quota_loaded(sb, type)) | 979 | if (!sb_has_quota_loaded(sb, type)) |
977 | continue; | 980 | continue; |
978 | /* Cancel periodic syncing before we grab dqonoff_mutex */ | 981 | /* Cancel periodic syncing before we grab dqonoff_mutex */ |
@@ -993,8 +996,9 @@ static void ocfs2_disable_quotas(struct ocfs2_super *osb) | |||
993 | /* Handle quota on quotactl */ | 996 | /* Handle quota on quotactl */ |
994 | static int ocfs2_quota_on(struct super_block *sb, int type, int format_id) | 997 | static int ocfs2_quota_on(struct super_block *sb, int type, int format_id) |
995 | { | 998 | { |
996 | unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA, | 999 | unsigned int feature[OCFS2_MAXQUOTAS] = { |
997 | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA}; | 1000 | OCFS2_FEATURE_RO_COMPAT_USRQUOTA, |
1001 | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA}; | ||
998 | 1002 | ||
999 | if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) | 1003 | if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) |
1000 | return -EINVAL; | 1004 | return -EINVAL; |