diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-09-05 15:17:12 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-09-05 15:17:12 -0400 |
commit | 48fac1790935ef2f9548d92e7c8ba604d1b80c12 (patch) | |
tree | 307e099926f480fbb8540e04d3fdb8cc329e820c /fs | |
parent | a67cdbd4579c387c021a17c7447da8b88f2a94f4 (diff) |
[GFS2] Remove unused code from quota
As per Jan Engelhardt's request, some unused code is removed and
some consts added in the quota code.
Cc: Jan Engelhardt <jengelh@linux01.gwdg.de>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/quota.c | 63 |
1 files changed, 10 insertions, 53 deletions
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index f5830befc307..fe1828ffebfa 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c | |||
@@ -503,24 +503,22 @@ void gfs2_quota_unhold(struct gfs2_inode *ip) | |||
503 | 503 | ||
504 | static int sort_qd(const void *a, const void *b) | 504 | static int sort_qd(const void *a, const void *b) |
505 | { | 505 | { |
506 | struct gfs2_quota_data *qd_a = *(struct gfs2_quota_data **)a; | 506 | const struct gfs2_quota_data *qd_a = *(const struct gfs2_quota_data **)a; |
507 | struct gfs2_quota_data *qd_b = *(struct gfs2_quota_data **)b; | 507 | const struct gfs2_quota_data *qd_b = *(const struct gfs2_quota_data **)b; |
508 | int ret = 0; | ||
509 | 508 | ||
510 | if (!test_bit(QDF_USER, &qd_a->qd_flags) != | 509 | if (!test_bit(QDF_USER, &qd_a->qd_flags) != |
511 | !test_bit(QDF_USER, &qd_b->qd_flags)) { | 510 | !test_bit(QDF_USER, &qd_b->qd_flags)) { |
512 | if (test_bit(QDF_USER, &qd_a->qd_flags)) | 511 | if (test_bit(QDF_USER, &qd_a->qd_flags)) |
513 | ret = -1; | 512 | return -1; |
514 | else | 513 | else |
515 | ret = 1; | 514 | return 1; |
516 | } else { | ||
517 | if (qd_a->qd_id < qd_b->qd_id) | ||
518 | ret = -1; | ||
519 | else if (qd_a->qd_id > qd_b->qd_id) | ||
520 | ret = 1; | ||
521 | } | 515 | } |
516 | if (qd_a->qd_id < qd_b->qd_id) | ||
517 | return -1; | ||
518 | if (qd_a->qd_id > qd_b->qd_id) | ||
519 | return 1; | ||
522 | 520 | ||
523 | return ret; | 521 | return 0; |
524 | } | 522 | } |
525 | 523 | ||
526 | static void do_qc(struct gfs2_quota_data *qd, s64 change) | 524 | static void do_qc(struct gfs2_quota_data *qd, s64 change) |
@@ -622,17 +620,13 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc, | |||
622 | gfs2_trans_add_bh(ip->i_gl, bh, 0); | 620 | gfs2_trans_add_bh(ip->i_gl, bh, 0); |
623 | 621 | ||
624 | kaddr = kmap_atomic(page, KM_USER0); | 622 | kaddr = kmap_atomic(page, KM_USER0); |
625 | ptr = (__be64 *)(kaddr + offset); | 623 | ptr = kaddr + offset; |
626 | value = (s64)be64_to_cpu(*ptr) + change; | 624 | value = (s64)be64_to_cpu(*ptr) + change; |
627 | *ptr = cpu_to_be64(value); | 625 | *ptr = cpu_to_be64(value); |
628 | flush_dcache_page(page); | 626 | flush_dcache_page(page); |
629 | kunmap_atomic(kaddr, KM_USER0); | 627 | kunmap_atomic(kaddr, KM_USER0); |
630 | err = 0; | 628 | err = 0; |
631 | qd->qd_qb.qb_magic = cpu_to_be32(GFS2_MAGIC); | 629 | qd->qd_qb.qb_magic = cpu_to_be32(GFS2_MAGIC); |
632 | #if 0 | ||
633 | qd->qd_qb.qb_limit = cpu_to_be64(q.qu_limit); | ||
634 | qd->qd_qb.qb_warn = cpu_to_be64(q.qu_warn); | ||
635 | #endif | ||
636 | qd->qd_qb.qb_value = cpu_to_be64(value); | 630 | qd->qd_qb.qb_value = cpu_to_be64(value); |
637 | unlock: | 631 | unlock: |
638 | unlock_page(page); | 632 | unlock_page(page); |
@@ -1057,43 +1051,6 @@ int gfs2_quota_refresh(struct gfs2_sbd *sdp, int user, u32 id) | |||
1057 | return error; | 1051 | return error; |
1058 | } | 1052 | } |
1059 | 1053 | ||
1060 | #if 0 | ||
1061 | int gfs2_quota_read(struct gfs2_sbd *sdp, int user, u32 id, | ||
1062 | struct gfs2_quota *q) | ||
1063 | { | ||
1064 | struct gfs2_quota_data *qd; | ||
1065 | struct gfs2_holder q_gh; | ||
1066 | int error; | ||
1067 | |||
1068 | if (((user) ? (id != current->fsuid) : (!in_group_p(id))) && | ||
1069 | !capable(CAP_SYS_ADMIN)) | ||
1070 | return -EACCES; | ||
1071 | |||
1072 | error = qd_get(sdp, user, id, CREATE, &qd); | ||
1073 | if (error) | ||
1074 | return error; | ||
1075 | |||
1076 | error = do_glock(qd, NO_FORCE, &q_gh); | ||
1077 | if (error) | ||
1078 | goto out; | ||
1079 | |||
1080 | memset(q, 0, sizeof(struct gfs2_quota)); | ||
1081 | q->qu_limit = be64_to_cpu(qd->qd_qb.qb_limit); | ||
1082 | q->qu_warn = be64_to_cpu(qd->qd_qb.qb_warn); | ||
1083 | q->qu_value = be64_to_cpu(qd->qd_qb.qb_value); | ||
1084 | |||
1085 | spin_lock(&sdp->sd_quota_spin); | ||
1086 | q->qu_value += qd->qd_change; | ||
1087 | spin_unlock(&sdp->sd_quota_spin); | ||
1088 | |||
1089 | gfs2_glock_dq_uninit(&q_gh); | ||
1090 | |||
1091 | out: | ||
1092 | qd_put(qd); | ||
1093 | return error; | ||
1094 | } | ||
1095 | #endif /* 0 */ | ||
1096 | |||
1097 | int gfs2_quota_init(struct gfs2_sbd *sdp) | 1054 | int gfs2_quota_init(struct gfs2_sbd *sdp) |
1098 | { | 1055 | { |
1099 | struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode); | 1056 | struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode); |