From: Eric W. Biederman Date: Fri, 1 Feb 2013 02:33:38 +0000 (-0800) Subject: gfs2: Introduce qd2index X-Git-Tag: next-20130218~8^2~55 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=2f6c9896f71e6b6c1c565ea76dd9f5e89579c120;p=karo-tx-linux.git gfs2: Introduce qd2index Both qd_alloc and qd2offset perform the exact same computation to get an index from a gfs2_quota_data. Make life a little simpler and factor out this index computation. Cc: Steven Whitehouse Signed-off-by: "Eric W. Biederman" --- 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: return (atomic_read(&qd_lru_count) * sysctl_vfs_cache_pressure) / 100; } +static u64 qd2index(struct gfs2_quota_data *qd) +{ + return (2 * (u64)qd->qd_id) + + test_bit(QDF_USER, &qd->qd_flags) ? 0 : 1; +} + static u64 qd2offset(struct gfs2_quota_data *qd) { u64 offset; - offset = 2 * (u64)qd->qd_id + !test_bit(QDF_USER, &qd->qd_flags); + offset = qd2index(qd); offset *= sizeof(struct gfs2_quota); return offset; @@ -147,7 +153,7 @@ static int qd_alloc(struct gfs2_sbd *sdp, int user, u32 id, qd->qd_slot = -1; INIT_LIST_HEAD(&qd->qd_reclaim); - error = gfs2_glock_get(sdp, 2 * (u64)id + !user, + error = gfs2_glock_get(sdp, qd2index(qd), &gfs2_quota_glops, CREATE, &qd->qd_gl); if (error) goto fail;