diff options
Diffstat (limited to 'fs/gfs2/incore.h')
-rw-r--r-- | fs/gfs2/incore.h | 54 |
1 files changed, 39 insertions, 15 deletions
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 67fd6beffece..aaecc8085fc5 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -84,17 +84,22 @@ struct gfs2_rgrpd { | |||
84 | u32 rd_data; /* num of data blocks in rgrp */ | 84 | u32 rd_data; /* num of data blocks in rgrp */ |
85 | u32 rd_bitbytes; /* number of bytes in data bitmaps */ | 85 | u32 rd_bitbytes; /* number of bytes in data bitmaps */ |
86 | u32 rd_free; | 86 | u32 rd_free; |
87 | u32 rd_reserved; /* number of blocks reserved */ | ||
87 | u32 rd_free_clone; | 88 | u32 rd_free_clone; |
88 | u32 rd_dinodes; | 89 | u32 rd_dinodes; |
89 | u64 rd_igeneration; | 90 | u64 rd_igeneration; |
90 | struct gfs2_bitmap *rd_bits; | 91 | struct gfs2_bitmap *rd_bits; |
91 | struct gfs2_sbd *rd_sbd; | 92 | struct gfs2_sbd *rd_sbd; |
93 | struct gfs2_rgrp_lvb *rd_rgl; | ||
92 | u32 rd_last_alloc; | 94 | u32 rd_last_alloc; |
93 | u32 rd_flags; | 95 | u32 rd_flags; |
94 | #define GFS2_RDF_CHECK 0x10000000 /* check for unlinked inodes */ | 96 | #define GFS2_RDF_CHECK 0x10000000 /* check for unlinked inodes */ |
95 | #define GFS2_RDF_UPTODATE 0x20000000 /* rg is up to date */ | 97 | #define GFS2_RDF_UPTODATE 0x20000000 /* rg is up to date */ |
96 | #define GFS2_RDF_ERROR 0x40000000 /* error in rg */ | 98 | #define GFS2_RDF_ERROR 0x40000000 /* error in rg */ |
97 | #define GFS2_RDF_MASK 0xf0000000 /* mask for internal flags */ | 99 | #define GFS2_RDF_MASK 0xf0000000 /* mask for internal flags */ |
100 | spinlock_t rd_rsspin; /* protects reservation related vars */ | ||
101 | struct rb_root rd_rstree; /* multi-block reservation tree */ | ||
102 | u32 rd_rs_cnt; /* count of current reservations */ | ||
98 | }; | 103 | }; |
99 | 104 | ||
100 | enum gfs2_state_bits { | 105 | enum gfs2_state_bits { |
@@ -232,6 +237,38 @@ struct gfs2_holder { | |||
232 | unsigned long gh_ip; | 237 | unsigned long gh_ip; |
233 | }; | 238 | }; |
234 | 239 | ||
240 | /* Resource group multi-block reservation, in order of appearance: | ||
241 | |||
242 | Step 1. Function prepares to write, allocates a mb, sets the size hint. | ||
243 | Step 2. User calls inplace_reserve to target an rgrp, sets the rgrp info | ||
244 | Step 3. Function get_local_rgrp locks the rgrp, determines which bits to use | ||
245 | Step 4. Bits are assigned from the rgrp based on either the reservation | ||
246 | or wherever it can. | ||
247 | */ | ||
248 | |||
249 | struct gfs2_blkreserv { | ||
250 | /* components used during write (step 1): */ | ||
251 | atomic_t rs_sizehint; /* hint of the write size */ | ||
252 | |||
253 | /* components used during inplace_reserve (step 2): */ | ||
254 | u32 rs_requested; /* Filled in by caller of gfs2_inplace_reserve() */ | ||
255 | |||
256 | /* components used during get_local_rgrp (step 3): */ | ||
257 | struct gfs2_rgrpd *rs_rgd; /* pointer to the gfs2_rgrpd */ | ||
258 | struct gfs2_holder rs_rgd_gh; /* Filled in by get_local_rgrp */ | ||
259 | struct rb_node rs_node; /* link to other block reservations */ | ||
260 | |||
261 | /* components used during block searches and assignments (step 4): */ | ||
262 | struct gfs2_bitmap *rs_bi; /* bitmap for the current allocation */ | ||
263 | u32 rs_biblk; /* start block relative to the bi */ | ||
264 | u32 rs_free; /* how many blocks are still free */ | ||
265 | |||
266 | /* ancillary quota stuff */ | ||
267 | struct gfs2_quota_data *rs_qa_qd[2 * MAXQUOTAS]; | ||
268 | struct gfs2_holder rs_qa_qd_ghs[2 * MAXQUOTAS]; | ||
269 | unsigned int rs_qa_qd_num; | ||
270 | }; | ||
271 | |||
235 | enum { | 272 | enum { |
236 | GLF_LOCK = 1, | 273 | GLF_LOCK = 1, |
237 | GLF_DEMOTE = 3, | 274 | GLF_DEMOTE = 3, |
@@ -289,18 +326,6 @@ struct gfs2_glock { | |||
289 | 326 | ||
290 | #define GFS2_MIN_LVB_SIZE 32 /* Min size of LVB that gfs2 supports */ | 327 | #define GFS2_MIN_LVB_SIZE 32 /* Min size of LVB that gfs2 supports */ |
291 | 328 | ||
292 | struct gfs2_qadata { /* quota allocation data */ | ||
293 | /* Quota stuff */ | ||
294 | struct gfs2_quota_data *qa_qd[2*MAXQUOTAS]; | ||
295 | struct gfs2_holder qa_qd_ghs[2*MAXQUOTAS]; | ||
296 | unsigned int qa_qd_num; | ||
297 | }; | ||
298 | |||
299 | struct gfs2_blkreserv { | ||
300 | u32 rs_requested; /* Filled in by caller of gfs2_inplace_reserve() */ | ||
301 | struct gfs2_holder rs_rgd_gh; /* Filled in by gfs2_inplace_reserve() */ | ||
302 | }; | ||
303 | |||
304 | enum { | 329 | enum { |
305 | GIF_INVALID = 0, | 330 | GIF_INVALID = 0, |
306 | GIF_QD_LOCKED = 1, | 331 | GIF_QD_LOCKED = 1, |
@@ -308,7 +333,6 @@ enum { | |||
308 | GIF_SW_PAGED = 3, | 333 | GIF_SW_PAGED = 3, |
309 | }; | 334 | }; |
310 | 335 | ||
311 | |||
312 | struct gfs2_inode { | 336 | struct gfs2_inode { |
313 | struct inode i_inode; | 337 | struct inode i_inode; |
314 | u64 i_no_addr; | 338 | u64 i_no_addr; |
@@ -319,8 +343,7 @@ struct gfs2_inode { | |||
319 | struct gfs2_glock *i_gl; /* Move into i_gh? */ | 343 | struct gfs2_glock *i_gl; /* Move into i_gh? */ |
320 | struct gfs2_holder i_iopen_gh; | 344 | struct gfs2_holder i_iopen_gh; |
321 | struct gfs2_holder i_gh; /* for prepare/commit_write only */ | 345 | struct gfs2_holder i_gh; /* for prepare/commit_write only */ |
322 | struct gfs2_qadata *i_qadata; /* quota allocation data */ | 346 | struct gfs2_blkreserv *i_res; /* rgrp multi-block reservation */ |
323 | struct gfs2_blkreserv *i_res; /* resource group block reservation */ | ||
324 | struct gfs2_rgrpd *i_rgd; | 347 | struct gfs2_rgrpd *i_rgd; |
325 | u64 i_goal; /* goal block for allocations */ | 348 | u64 i_goal; /* goal block for allocations */ |
326 | struct rw_semaphore i_rw_mutex; | 349 | struct rw_semaphore i_rw_mutex; |
@@ -473,6 +496,7 @@ struct gfs2_args { | |||
473 | unsigned int ar_discard:1; /* discard requests */ | 496 | unsigned int ar_discard:1; /* discard requests */ |
474 | unsigned int ar_errors:2; /* errors=withdraw | panic */ | 497 | unsigned int ar_errors:2; /* errors=withdraw | panic */ |
475 | unsigned int ar_nobarrier:1; /* do not send barriers */ | 498 | unsigned int ar_nobarrier:1; /* do not send barriers */ |
499 | unsigned int ar_rgrplvb:1; /* use lvbs for rgrp info */ | ||
476 | int ar_commit; /* Commit interval */ | 500 | int ar_commit; /* Commit interval */ |
477 | int ar_statfs_quantum; /* The fast statfs interval */ | 501 | int ar_statfs_quantum; /* The fast statfs interval */ |
478 | int ar_quota_quantum; /* The quota interval */ | 502 | int ar_quota_quantum; /* The quota interval */ |