aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/quota.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/quota.c')
-rw-r--r--fs/gfs2/quota.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 572b92eac367..f5830befc307 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -65,17 +65,17 @@
65#define QUOTA_USER 1 65#define QUOTA_USER 1
66#define QUOTA_GROUP 0 66#define QUOTA_GROUP 0
67 67
68static uint64_t qd2offset(struct gfs2_quota_data *qd) 68static u64 qd2offset(struct gfs2_quota_data *qd)
69{ 69{
70 uint64_t offset; 70 u64 offset;
71 71
72 offset = 2 * (uint64_t)qd->qd_id + !test_bit(QDF_USER, &qd->qd_flags); 72 offset = 2 * (u64)qd->qd_id + !test_bit(QDF_USER, &qd->qd_flags);
73 offset *= sizeof(struct gfs2_quota); 73 offset *= sizeof(struct gfs2_quota);
74 74
75 return offset; 75 return offset;
76} 76}
77 77
78static int qd_alloc(struct gfs2_sbd *sdp, int user, uint32_t id, 78static int qd_alloc(struct gfs2_sbd *sdp, int user, u32 id,
79 struct gfs2_quota_data **qdp) 79 struct gfs2_quota_data **qdp)
80{ 80{
81 struct gfs2_quota_data *qd; 81 struct gfs2_quota_data *qd;
@@ -91,7 +91,7 @@ static int qd_alloc(struct gfs2_sbd *sdp, int user, uint32_t id,
91 set_bit(QDF_USER, &qd->qd_flags); 91 set_bit(QDF_USER, &qd->qd_flags);
92 qd->qd_slot = -1; 92 qd->qd_slot = -1;
93 93
94 error = gfs2_glock_get(sdp, 2 * (uint64_t)id + !user, 94 error = gfs2_glock_get(sdp, 2 * (u64)id + !user,
95 &gfs2_quota_glops, CREATE, &qd->qd_gl); 95 &gfs2_quota_glops, CREATE, &qd->qd_gl);
96 if (error) 96 if (error)
97 goto fail; 97 goto fail;
@@ -110,7 +110,7 @@ fail:
110 return error; 110 return error;
111} 111}
112 112
113static int qd_get(struct gfs2_sbd *sdp, int user, uint32_t id, int create, 113static int qd_get(struct gfs2_sbd *sdp, int user, u32 id, int create,
114 struct gfs2_quota_data **qdp) 114 struct gfs2_quota_data **qdp)
115{ 115{
116 struct gfs2_quota_data *qd = NULL, *new_qd = NULL; 116 struct gfs2_quota_data *qd = NULL, *new_qd = NULL;
@@ -248,7 +248,7 @@ static int bh_get(struct gfs2_quota_data *qd)
248 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; 248 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
249 struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode); 249 struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode);
250 unsigned int block, offset; 250 unsigned int block, offset;
251 uint64_t dblock; 251 u64 dblock;
252 int new = 0; 252 int new = 0;
253 struct buffer_head *bh; 253 struct buffer_head *bh;
254 int error; 254 int error;
@@ -405,7 +405,7 @@ static void qd_unlock(struct gfs2_quota_data *qd)
405 qd_put(qd); 405 qd_put(qd);
406} 406}
407 407
408static int qdsb_get(struct gfs2_sbd *sdp, int user, uint32_t id, int create, 408static int qdsb_get(struct gfs2_sbd *sdp, int user, u32 id, int create,
409 struct gfs2_quota_data **qdp) 409 struct gfs2_quota_data **qdp)
410{ 410{
411 int error; 411 int error;
@@ -438,7 +438,7 @@ static void qdsb_put(struct gfs2_quota_data *qd)
438 qd_put(qd); 438 qd_put(qd);
439} 439}
440 440
441int gfs2_quota_hold(struct gfs2_inode *ip, uint32_t uid, uint32_t gid) 441int gfs2_quota_hold(struct gfs2_inode *ip, u32 uid, u32 gid)
442{ 442{
443 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); 443 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
444 struct gfs2_alloc *al = &ip->i_alloc; 444 struct gfs2_alloc *al = &ip->i_alloc;
@@ -523,12 +523,12 @@ static int sort_qd(const void *a, const void *b)
523 return ret; 523 return ret;
524} 524}
525 525
526static void do_qc(struct gfs2_quota_data *qd, int64_t change) 526static void do_qc(struct gfs2_quota_data *qd, s64 change)
527{ 527{
528 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; 528 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
529 struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode); 529 struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode);
530 struct gfs2_quota_change *qc = qd->qd_bh_qc; 530 struct gfs2_quota_change *qc = qd->qd_bh_qc;
531 int64_t x; 531 s64 x;
532 532
533 mutex_lock(&sdp->sd_quota_mutex); 533 mutex_lock(&sdp->sd_quota_mutex);
534 gfs2_trans_add_bh(ip->i_gl, qd->qd_bh, 1); 534 gfs2_trans_add_bh(ip->i_gl, qd->qd_bh, 1);
@@ -571,7 +571,7 @@ static void do_qc(struct gfs2_quota_data *qd, int64_t change)
571 * in turn mostly borrowed from ext3 571 * in turn mostly borrowed from ext3
572 */ 572 */
573static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc, 573static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc,
574 int64_t change, struct gfs2_quota_data *qd) 574 s64 change, struct gfs2_quota_data *qd)
575{ 575{
576 struct inode *inode = &ip->i_inode; 576 struct inode *inode = &ip->i_inode;
577 struct address_space *mapping = inode->i_mapping; 577 struct address_space *mapping = inode->i_mapping;
@@ -811,7 +811,7 @@ fail:
811 return error; 811 return error;
812} 812}
813 813
814int gfs2_quota_lock(struct gfs2_inode *ip, uint32_t uid, uint32_t gid) 814int gfs2_quota_lock(struct gfs2_inode *ip, u32 uid, u32 gid)
815{ 815{
816 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); 816 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
817 struct gfs2_alloc *al = &ip->i_alloc; 817 struct gfs2_alloc *al = &ip->i_alloc;
@@ -848,7 +848,7 @@ static int need_sync(struct gfs2_quota_data *qd)
848{ 848{
849 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; 849 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
850 struct gfs2_tune *gt = &sdp->sd_tune; 850 struct gfs2_tune *gt = &sdp->sd_tune;
851 int64_t value; 851 s64 value;
852 unsigned int num, den; 852 unsigned int num, den;
853 int do_sync = 1; 853 int do_sync = 1;
854 854
@@ -873,7 +873,7 @@ static int need_sync(struct gfs2_quota_data *qd)
873 value *= gfs2_jindex_size(sdp) * num; 873 value *= gfs2_jindex_size(sdp) * num;
874 do_div(value, den); 874 do_div(value, den);
875 value += (s64)be64_to_cpu(qd->qd_qb.qb_value); 875 value += (s64)be64_to_cpu(qd->qd_qb.qb_value);
876 if (value < (int64_t)be64_to_cpu(qd->qd_qb.qb_limit)) 876 if (value < (s64)be64_to_cpu(qd->qd_qb.qb_limit))
877 do_sync = 0; 877 do_sync = 0;
878 } 878 }
879 879
@@ -927,12 +927,12 @@ static int print_message(struct gfs2_quota_data *qd, char *type)
927 return 0; 927 return 0;
928} 928}
929 929
930int gfs2_quota_check(struct gfs2_inode *ip, uint32_t uid, uint32_t gid) 930int gfs2_quota_check(struct gfs2_inode *ip, u32 uid, u32 gid)
931{ 931{
932 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); 932 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
933 struct gfs2_alloc *al = &ip->i_alloc; 933 struct gfs2_alloc *al = &ip->i_alloc;
934 struct gfs2_quota_data *qd; 934 struct gfs2_quota_data *qd;
935 int64_t value; 935 s64 value;
936 unsigned int x; 936 unsigned int x;
937 int error = 0; 937 int error = 0;
938 938
@@ -954,12 +954,12 @@ int gfs2_quota_check(struct gfs2_inode *ip, uint32_t uid, uint32_t gid)
954 value += qd->qd_change; 954 value += qd->qd_change;
955 spin_unlock(&sdp->sd_quota_spin); 955 spin_unlock(&sdp->sd_quota_spin);
956 956
957 if (be64_to_cpu(qd->qd_qb.qb_limit) && (int64_t)be64_to_cpu(qd->qd_qb.qb_limit) < value) { 957 if (be64_to_cpu(qd->qd_qb.qb_limit) && (s64)be64_to_cpu(qd->qd_qb.qb_limit) < value) {
958 print_message(qd, "exceeded"); 958 print_message(qd, "exceeded");
959 error = -EDQUOT; 959 error = -EDQUOT;
960 break; 960 break;
961 } else if (be64_to_cpu(qd->qd_qb.qb_warn) && 961 } else if (be64_to_cpu(qd->qd_qb.qb_warn) &&
962 (int64_t)be64_to_cpu(qd->qd_qb.qb_warn) < value && 962 (s64)be64_to_cpu(qd->qd_qb.qb_warn) < value &&
963 time_after_eq(jiffies, qd->qd_last_warn + 963 time_after_eq(jiffies, qd->qd_last_warn +
964 gfs2_tune_get(sdp, 964 gfs2_tune_get(sdp,
965 gt_quota_warn_period) * HZ)) { 965 gt_quota_warn_period) * HZ)) {
@@ -971,8 +971,8 @@ int gfs2_quota_check(struct gfs2_inode *ip, uint32_t uid, uint32_t gid)
971 return error; 971 return error;
972} 972}
973 973
974void gfs2_quota_change(struct gfs2_inode *ip, int64_t change, 974void gfs2_quota_change(struct gfs2_inode *ip, s64 change,
975 uint32_t uid, uint32_t gid) 975 u32 uid, u32 gid)
976{ 976{
977 struct gfs2_alloc *al = &ip->i_alloc; 977 struct gfs2_alloc *al = &ip->i_alloc;
978 struct gfs2_quota_data *qd; 978 struct gfs2_quota_data *qd;
@@ -1038,7 +1038,7 @@ int gfs2_quota_sync(struct gfs2_sbd *sdp)
1038 return error; 1038 return error;
1039} 1039}
1040 1040
1041int gfs2_quota_refresh(struct gfs2_sbd *sdp, int user, uint32_t id) 1041int gfs2_quota_refresh(struct gfs2_sbd *sdp, int user, u32 id)
1042{ 1042{
1043 struct gfs2_quota_data *qd; 1043 struct gfs2_quota_data *qd;
1044 struct gfs2_holder q_gh; 1044 struct gfs2_holder q_gh;
@@ -1058,7 +1058,7 @@ int gfs2_quota_refresh(struct gfs2_sbd *sdp, int user, uint32_t id)
1058} 1058}
1059 1059
1060#if 0 1060#if 0
1061int gfs2_quota_read(struct gfs2_sbd *sdp, int user, uint32_t id, 1061int gfs2_quota_read(struct gfs2_sbd *sdp, int user, u32 id,
1062 struct gfs2_quota *q) 1062 struct gfs2_quota *q)
1063{ 1063{
1064 struct gfs2_quota_data *qd; 1064 struct gfs2_quota_data *qd;
@@ -1100,8 +1100,8 @@ int gfs2_quota_init(struct gfs2_sbd *sdp)
1100 unsigned int blocks = ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift; 1100 unsigned int blocks = ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift;
1101 unsigned int x, slot = 0; 1101 unsigned int x, slot = 0;
1102 unsigned int found = 0; 1102 unsigned int found = 0;
1103 uint64_t dblock; 1103 u64 dblock;
1104 uint32_t extlen = 0; 1104 u32 extlen = 0;
1105 int error; 1105 int error;
1106 1106
1107 if (!ip->i_di.di_size || 1107 if (!ip->i_di.di_size ||