aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/incore.h
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2012-07-31 10:21:20 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2012-09-24 05:46:56 -0400
commit4a993fb1503d11496974bd86c0b7123f63d9c8a2 (patch)
tree5d5d0da84412f95995cc6d1aa95d3bca1967f82c /fs/gfs2/incore.h
parent71f890f7f758f340215d48fed5223f9cce05b652 (diff)
GFS2: Add structure to contain rgrp, bitmap, offset tuple
This patch introduces a new structure, gfs2_rbm, which is a tuple of a resource group, a bitmap within the resource group and an offset within that bitmap. This is designed to make manipulating these sets of variables easier. There is also a new helper function which converts this representation back to a disk block address. In addition, the rbtree nodes which are used for the reservations were not being correctly initialised, which is now fixed. Also, the tracing was not passing through the inode where it should have been. That is mostly fixed aside from one corner case. This needs to be revisited since there can also be a NULL rgrp in some cases which results in the device being incorrect in the trace. This is intended to be the first step towards cleaning up some of the allocation code, and some further bug fixes. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/incore.h')
-rw-r--r--fs/gfs2/incore.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 52078a161ecd..d5e254604c72 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -102,6 +102,17 @@ struct gfs2_rgrpd {
102 u32 rd_rs_cnt; /* count of current reservations */ 102 u32 rd_rs_cnt; /* count of current reservations */
103}; 103};
104 104
105struct gfs2_rbm {
106 struct gfs2_rgrpd *rgd;
107 struct gfs2_bitmap *bi; /* Bitmap must belong to the rgd */
108 u32 offset; /* The offset is bitmap relative */
109};
110
111static inline u64 gfs2_rbm_to_block(const struct gfs2_rbm *rbm)
112{
113 return rbm->rgd->rd_data0 + (rbm->bi->bi_start * GFS2_NBBY) + rbm->offset;
114}
115
105enum gfs2_state_bits { 116enum gfs2_state_bits {
106 BH_Pinned = BH_PrivateStart, 117 BH_Pinned = BH_PrivateStart,
107 BH_Escaped = BH_PrivateStart + 1, 118 BH_Escaped = BH_PrivateStart + 1,
@@ -251,13 +262,11 @@ struct gfs2_blkreserv {
251 atomic_t rs_sizehint; /* hint of the write size */ 262 atomic_t rs_sizehint; /* hint of the write size */
252 263
253 /* components used during get_local_rgrp (step 3): */ 264 /* components used during get_local_rgrp (step 3): */
254 struct gfs2_rgrpd *rs_rgd; /* pointer to the gfs2_rgrpd */ 265 struct gfs2_rbm rs_rbm;
255 struct gfs2_holder rs_rgd_gh; /* Filled in by get_local_rgrp */ 266 struct gfs2_holder rs_rgd_gh; /* Filled in by get_local_rgrp */
256 struct rb_node rs_node; /* link to other block reservations */ 267 struct rb_node rs_node; /* link to other block reservations */
257 268
258 /* components used during block searches and assignments (step 4): */ 269 /* components used during block searches and assignments (step 4): */
259 struct gfs2_bitmap *rs_bi; /* bitmap for the current allocation */
260 u32 rs_biblk; /* start block relative to the bi */
261 u32 rs_free; /* how many blocks are still free */ 270 u32 rs_free; /* how many blocks are still free */
262 271
263 /* ancillary quota stuff */ 272 /* ancillary quota stuff */