aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/quota.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index f8279eed56e1..0e7c982377a1 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -120,11 +120,17 @@ out:
120 return (atomic_read(&qd_lru_count) * sysctl_vfs_cache_pressure) / 100; 120 return (atomic_read(&qd_lru_count) * sysctl_vfs_cache_pressure) / 100;
121} 121}
122 122
123static u64 qd2index(struct gfs2_quota_data *qd)
124{
125 return (2 * (u64)qd->qd_id) +
126 test_bit(QDF_USER, &qd->qd_flags) ? 0 : 1;
127}
128
123static u64 qd2offset(struct gfs2_quota_data *qd) 129static u64 qd2offset(struct gfs2_quota_data *qd)
124{ 130{
125 u64 offset; 131 u64 offset;
126 132
127 offset = 2 * (u64)qd->qd_id + !test_bit(QDF_USER, &qd->qd_flags); 133 offset = qd2index(qd);
128 offset *= sizeof(struct gfs2_quota); 134 offset *= sizeof(struct gfs2_quota);
129 135
130 return offset; 136 return offset;
@@ -147,7 +153,7 @@ static int qd_alloc(struct gfs2_sbd *sdp, int user, u32 id,
147 qd->qd_slot = -1; 153 qd->qd_slot = -1;
148 INIT_LIST_HEAD(&qd->qd_reclaim); 154 INIT_LIST_HEAD(&qd->qd_reclaim);
149 155
150 error = gfs2_glock_get(sdp, 2 * (u64)id + !user, 156 error = gfs2_glock_get(sdp, qd2index(qd),
151 &gfs2_quota_glops, CREATE, &qd->qd_gl); 157 &gfs2_quota_glops, CREATE, &qd->qd_gl);
152 if (error) 158 if (error)
153 goto fail; 159 goto fail;