aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/super.c')
-rw-r--r--fs/ocfs2/super.c30
1 files changed, 17 insertions, 13 deletions
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
928static int ocfs2_enable_quotas(struct ocfs2_super *osb) 929static 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;
958out_quota_off: 961out_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 */
994static int ocfs2_quota_on(struct super_block *sb, int type, int format_id) 997static 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;