diff options
Diffstat (limited to 'fs/gfs2/quota.c')
-rw-r--r-- | fs/gfs2/quota.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 40c7cf87eb44..c57b5cf1d583 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c | |||
@@ -44,13 +44,17 @@ | |||
44 | #include <linux/tty.h> | 44 | #include <linux/tty.h> |
45 | #include <linux/sort.h> | 45 | #include <linux/sort.h> |
46 | #include <linux/fs.h> | 46 | #include <linux/fs.h> |
47 | #include <linux/gfs2_ondisk.h> | ||
47 | #include <asm/semaphore.h> | 48 | #include <asm/semaphore.h> |
48 | 49 | ||
49 | #include "gfs2.h" | 50 | #include "gfs2.h" |
51 | #include "lm_interface.h" | ||
52 | #include "incore.h" | ||
50 | #include "bmap.h" | 53 | #include "bmap.h" |
51 | #include "glock.h" | 54 | #include "glock.h" |
52 | #include "glops.h" | 55 | #include "glops.h" |
53 | #include "log.h" | 56 | #include "log.h" |
57 | #include "lvb.h" | ||
54 | #include "meta_io.h" | 58 | #include "meta_io.h" |
55 | #include "quota.h" | 59 | #include "quota.h" |
56 | #include "rgrp.h" | 60 | #include "rgrp.h" |
@@ -59,6 +63,7 @@ | |||
59 | #include "inode.h" | 63 | #include "inode.h" |
60 | #include "ops_file.h" | 64 | #include "ops_file.h" |
61 | #include "ops_address.h" | 65 | #include "ops_address.h" |
66 | #include "util.h" | ||
62 | 67 | ||
63 | #define QUOTA_USER 1 | 68 | #define QUOTA_USER 1 |
64 | #define QUOTA_GROUP 0 | 69 | #define QUOTA_GROUP 0 |
@@ -244,7 +249,7 @@ static void slot_put(struct gfs2_quota_data *qd) | |||
244 | static int bh_get(struct gfs2_quota_data *qd) | 249 | static int bh_get(struct gfs2_quota_data *qd) |
245 | { | 250 | { |
246 | struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; | 251 | struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; |
247 | struct gfs2_inode *ip = get_v2ip(sdp->sd_qc_inode); | 252 | struct gfs2_inode *ip = sdp->sd_qc_inode->u.generic_ip; |
248 | unsigned int block, offset; | 253 | unsigned int block, offset; |
249 | uint64_t dblock; | 254 | uint64_t dblock; |
250 | int new = 0; | 255 | int new = 0; |
@@ -526,7 +531,7 @@ static int sort_qd(const void *a, const void *b) | |||
526 | static void do_qc(struct gfs2_quota_data *qd, int64_t change) | 531 | static void do_qc(struct gfs2_quota_data *qd, int64_t change) |
527 | { | 532 | { |
528 | struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; | 533 | struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; |
529 | struct gfs2_inode *ip = get_v2ip(sdp->sd_qc_inode); | 534 | struct gfs2_inode *ip = sdp->sd_qc_inode->u.generic_ip; |
530 | struct gfs2_quota_change *qc = qd->qd_bh_qc; | 535 | struct gfs2_quota_change *qc = qd->qd_bh_qc; |
531 | int64_t x; | 536 | int64_t x; |
532 | 537 | ||
@@ -642,7 +647,7 @@ unlock: | |||
642 | static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda) | 647 | static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda) |
643 | { | 648 | { |
644 | struct gfs2_sbd *sdp = (*qda)->qd_gl->gl_sbd; | 649 | struct gfs2_sbd *sdp = (*qda)->qd_gl->gl_sbd; |
645 | struct gfs2_inode *ip = get_v2ip(sdp->sd_quota_inode); | 650 | struct gfs2_inode *ip = sdp->sd_quota_inode->u.generic_ip; |
646 | unsigned int data_blocks, ind_blocks; | 651 | unsigned int data_blocks, ind_blocks; |
647 | struct file_ra_state ra_state; | 652 | struct file_ra_state ra_state; |
648 | struct gfs2_holder *ghs, i_gh; | 653 | struct gfs2_holder *ghs, i_gh; |
@@ -753,6 +758,7 @@ static int do_glock(struct gfs2_quota_data *qd, int force_refresh, | |||
753 | struct gfs2_holder *q_gh) | 758 | struct gfs2_holder *q_gh) |
754 | { | 759 | { |
755 | struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; | 760 | struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; |
761 | struct gfs2_inode *ip = sdp->sd_quota_inode->u.generic_ip; | ||
756 | struct gfs2_holder i_gh; | 762 | struct gfs2_holder i_gh; |
757 | struct gfs2_quota q; | 763 | struct gfs2_quota q; |
758 | char buf[sizeof(struct gfs2_quota)]; | 764 | char buf[sizeof(struct gfs2_quota)]; |
@@ -776,7 +782,7 @@ static int do_glock(struct gfs2_quota_data *qd, int force_refresh, | |||
776 | if (error) | 782 | if (error) |
777 | return error; | 783 | return error; |
778 | 784 | ||
779 | error = gfs2_glock_nq_init(get_v2ip(sdp->sd_quota_inode)->i_gl, | 785 | error = gfs2_glock_nq_init(ip->i_gl, |
780 | LM_ST_SHARED, 0, | 786 | LM_ST_SHARED, 0, |
781 | &i_gh); | 787 | &i_gh); |
782 | if (error) | 788 | if (error) |
@@ -784,7 +790,7 @@ static int do_glock(struct gfs2_quota_data *qd, int force_refresh, | |||
784 | 790 | ||
785 | memset(buf, 0, sizeof(struct gfs2_quota)); | 791 | memset(buf, 0, sizeof(struct gfs2_quota)); |
786 | pos = qd2offset(qd); | 792 | pos = qd2offset(qd); |
787 | error = gfs2_internal_read(get_v2ip(sdp->sd_quota_inode), | 793 | error = gfs2_internal_read(ip, |
788 | &ra_state, buf, | 794 | &ra_state, buf, |
789 | &pos, | 795 | &pos, |
790 | sizeof(struct gfs2_quota)); | 796 | sizeof(struct gfs2_quota)); |
@@ -1118,7 +1124,7 @@ int gfs2_quota_read(struct gfs2_sbd *sdp, int user, uint32_t id, | |||
1118 | 1124 | ||
1119 | int gfs2_quota_init(struct gfs2_sbd *sdp) | 1125 | int gfs2_quota_init(struct gfs2_sbd *sdp) |
1120 | { | 1126 | { |
1121 | struct gfs2_inode *ip = get_v2ip(sdp->sd_qc_inode); | 1127 | struct gfs2_inode *ip = sdp->sd_qc_inode->u.generic_ip; |
1122 | unsigned int blocks = ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift; | 1128 | unsigned int blocks = ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift; |
1123 | unsigned int x, slot = 0; | 1129 | unsigned int x, slot = 0; |
1124 | unsigned int found = 0; | 1130 | unsigned int found = 0; |
@@ -1133,7 +1139,7 @@ int gfs2_quota_init(struct gfs2_sbd *sdp) | |||
1133 | return -EIO; | 1139 | return -EIO; |
1134 | } | 1140 | } |
1135 | sdp->sd_quota_slots = blocks * sdp->sd_qc_per_block; | 1141 | sdp->sd_quota_slots = blocks * sdp->sd_qc_per_block; |
1136 | sdp->sd_quota_chunks = DIV_RU(sdp->sd_quota_slots, 8 * PAGE_SIZE); | 1142 | sdp->sd_quota_chunks = DIV_ROUND_UP(sdp->sd_quota_slots, 8 * PAGE_SIZE); |
1137 | 1143 | ||
1138 | error = -ENOMEM; | 1144 | error = -ENOMEM; |
1139 | 1145 | ||