GFS2: Add structure to contain rgrp, bitmap, offset tuple
[deliverable/linux.git] / fs / gfs2 / incore.h
1 /*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
7 * of the GNU General Public License version 2.
8 */
9
10 #ifndef __INCORE_DOT_H__
11 #define __INCORE_DOT_H__
12
13 #include <linux/fs.h>
14 #include <linux/kobject.h>
15 #include <linux/workqueue.h>
16 #include <linux/dlm.h>
17 #include <linux/buffer_head.h>
18 #include <linux/rcupdate.h>
19 #include <linux/rculist_bl.h>
20 #include <linux/completion.h>
21 #include <linux/rbtree.h>
22 #include <linux/ktime.h>
23 #include <linux/percpu.h>
24
25 #define DIO_WAIT 0x00000010
26 #define DIO_METADATA 0x00000020
27
28 struct gfs2_log_operations;
29 struct gfs2_bufdata;
30 struct gfs2_holder;
31 struct gfs2_glock;
32 struct gfs2_quota_data;
33 struct gfs2_trans;
34 struct gfs2_ail;
35 struct gfs2_jdesc;
36 struct gfs2_sbd;
37 struct lm_lockops;
38
39 typedef void (*gfs2_glop_bh_t) (struct gfs2_glock *gl, unsigned int ret);
40
41 struct gfs2_log_header_host {
42 u64 lh_sequence; /* Sequence number of this transaction */
43 u32 lh_flags; /* GFS2_LOG_HEAD_... */
44 u32 lh_tail; /* Block number of log tail */
45 u32 lh_blkno;
46 u32 lh_hash;
47 };
48
49 /*
50 * Structure of operations that are associated with each
51 * type of element in the log.
52 */
53
54 struct gfs2_log_operations {
55 void (*lo_add) (struct gfs2_sbd *sdp, struct gfs2_bufdata *bd);
56 void (*lo_before_commit) (struct gfs2_sbd *sdp);
57 void (*lo_after_commit) (struct gfs2_sbd *sdp, struct gfs2_ail *ai);
58 void (*lo_before_scan) (struct gfs2_jdesc *jd,
59 struct gfs2_log_header_host *head, int pass);
60 int (*lo_scan_elements) (struct gfs2_jdesc *jd, unsigned int start,
61 struct gfs2_log_descriptor *ld, __be64 *ptr,
62 int pass);
63 void (*lo_after_scan) (struct gfs2_jdesc *jd, int error, int pass);
64 const char *lo_name;
65 };
66
67 #define GBF_FULL 1
68
69 struct gfs2_bitmap {
70 struct buffer_head *bi_bh;
71 char *bi_clone;
72 unsigned long bi_flags;
73 u32 bi_offset;
74 u32 bi_start;
75 u32 bi_len;
76 };
77
78 struct gfs2_rgrpd {
79 struct rb_node rd_node; /* Link with superblock */
80 struct gfs2_glock *rd_gl; /* Glock for this rgrp */
81 u64 rd_addr; /* grp block disk address */
82 u64 rd_data0; /* first data location */
83 u32 rd_length; /* length of rgrp header in fs blocks */
84 u32 rd_data; /* num of data blocks in rgrp */
85 u32 rd_bitbytes; /* number of bytes in data bitmaps */
86 u32 rd_free;
87 u32 rd_reserved; /* number of blocks reserved */
88 u32 rd_free_clone;
89 u32 rd_dinodes;
90 u64 rd_igeneration;
91 struct gfs2_bitmap *rd_bits;
92 struct gfs2_sbd *rd_sbd;
93 struct gfs2_rgrp_lvb *rd_rgl;
94 u32 rd_last_alloc;
95 u32 rd_flags;
96 #define GFS2_RDF_CHECK 0x10000000 /* check for unlinked inodes */
97 #define GFS2_RDF_UPTODATE 0x20000000 /* rg is up to date */
98 #define GFS2_RDF_ERROR 0x40000000 /* error in rg */
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 */
103 };
104
105 struct 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
111 static 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
116 enum gfs2_state_bits {
117 BH_Pinned = BH_PrivateStart,
118 BH_Escaped = BH_PrivateStart + 1,
119 BH_Zeronew = BH_PrivateStart + 2,
120 };
121
122 BUFFER_FNS(Pinned, pinned)
123 TAS_BUFFER_FNS(Pinned, pinned)
124 BUFFER_FNS(Escaped, escaped)
125 TAS_BUFFER_FNS(Escaped, escaped)
126 BUFFER_FNS(Zeronew, zeronew)
127 TAS_BUFFER_FNS(Zeronew, zeronew)
128
129 struct gfs2_bufdata {
130 struct buffer_head *bd_bh;
131 struct gfs2_glock *bd_gl;
132 u64 bd_blkno;
133
134 struct list_head bd_list;
135 const struct gfs2_log_operations *bd_ops;
136
137 struct gfs2_ail *bd_ail;
138 struct list_head bd_ail_st_list;
139 struct list_head bd_ail_gl_list;
140 };
141
142 /*
143 * Internally, we prefix things with gdlm_ and GDLM_ (for gfs-dlm) since a
144 * prefix of lock_dlm_ gets awkward.
145 */
146
147 #define GDLM_STRNAME_BYTES 25
148 #define GDLM_LVB_SIZE 32
149
150 /*
151 * ls_recover_flags:
152 *
153 * DFL_BLOCK_LOCKS: dlm is in recovery and will grant locks that had been
154 * held by failed nodes whose journals need recovery. Those locks should
155 * only be used for journal recovery until the journal recovery is done.
156 * This is set by the dlm recover_prep callback and cleared by the
157 * gfs2_control thread when journal recovery is complete. To avoid
158 * races between recover_prep setting and gfs2_control clearing, recover_spin
159 * is held while changing this bit and reading/writing recover_block
160 * and recover_start.
161 *
162 * DFL_NO_DLM_OPS: dlm lockspace ops/callbacks are not being used.
163 *
164 * DFL_FIRST_MOUNT: this node is the first to mount this fs and is doing
165 * recovery of all journals before allowing other nodes to mount the fs.
166 * This is cleared when FIRST_MOUNT_DONE is set.
167 *
168 * DFL_FIRST_MOUNT_DONE: this node was the first mounter, and has finished
169 * recovery of all journals, and now allows other nodes to mount the fs.
170 *
171 * DFL_MOUNT_DONE: gdlm_mount has completed successfully and cleared
172 * BLOCK_LOCKS for the first time. The gfs2_control thread should now
173 * control clearing BLOCK_LOCKS for further recoveries.
174 *
175 * DFL_UNMOUNT: gdlm_unmount sets to keep sdp off gfs2_control_wq.
176 *
177 * DFL_DLM_RECOVERY: set while dlm is in recovery, between recover_prep()
178 * and recover_done(), i.e. set while recover_block == recover_start.
179 */
180
181 enum {
182 DFL_BLOCK_LOCKS = 0,
183 DFL_NO_DLM_OPS = 1,
184 DFL_FIRST_MOUNT = 2,
185 DFL_FIRST_MOUNT_DONE = 3,
186 DFL_MOUNT_DONE = 4,
187 DFL_UNMOUNT = 5,
188 DFL_DLM_RECOVERY = 6,
189 };
190
191 struct lm_lockname {
192 u64 ln_number;
193 unsigned int ln_type;
194 };
195
196 #define lm_name_equal(name1, name2) \
197 (((name1)->ln_number == (name2)->ln_number) && \
198 ((name1)->ln_type == (name2)->ln_type))
199
200
201 struct gfs2_glock_operations {
202 void (*go_xmote_th) (struct gfs2_glock *gl);
203 int (*go_xmote_bh) (struct gfs2_glock *gl, struct gfs2_holder *gh);
204 void (*go_inval) (struct gfs2_glock *gl, int flags);
205 int (*go_demote_ok) (const struct gfs2_glock *gl);
206 int (*go_lock) (struct gfs2_holder *gh);
207 void (*go_unlock) (struct gfs2_holder *gh);
208 int (*go_dump)(struct seq_file *seq, const struct gfs2_glock *gl);
209 void (*go_callback) (struct gfs2_glock *gl);
210 const int go_type;
211 const unsigned long go_flags;
212 #define GLOF_ASPACE 1
213 };
214
215 enum {
216 GFS2_LKS_SRTT = 0, /* Non blocking smoothed round trip time */
217 GFS2_LKS_SRTTVAR = 1, /* Non blocking smoothed variance */
218 GFS2_LKS_SRTTB = 2, /* Blocking smoothed round trip time */
219 GFS2_LKS_SRTTVARB = 3, /* Blocking smoothed variance */
220 GFS2_LKS_SIRT = 4, /* Smoothed Inter-request time */
221 GFS2_LKS_SIRTVAR = 5, /* Smoothed Inter-request variance */
222 GFS2_LKS_DCOUNT = 6, /* Count of dlm requests */
223 GFS2_LKS_QCOUNT = 7, /* Count of gfs2_holder queues */
224 GFS2_NR_LKSTATS
225 };
226
227 struct gfs2_lkstats {
228 s64 stats[GFS2_NR_LKSTATS];
229 };
230
231 enum {
232 /* States */
233 HIF_HOLDER = 6, /* Set for gh that "holds" the glock */
234 HIF_FIRST = 7,
235 HIF_WAIT = 10,
236 };
237
238 struct gfs2_holder {
239 struct list_head gh_list;
240
241 struct gfs2_glock *gh_gl;
242 struct pid *gh_owner_pid;
243 unsigned int gh_state;
244 unsigned gh_flags;
245
246 int gh_error;
247 unsigned long gh_iflags; /* HIF_... */
248 unsigned long gh_ip;
249 };
250
251 /* Resource group multi-block reservation, in order of appearance:
252
253 Step 1. Function prepares to write, allocates a mb, sets the size hint.
254 Step 2. User calls inplace_reserve to target an rgrp, sets the rgrp info
255 Step 3. Function get_local_rgrp locks the rgrp, determines which bits to use
256 Step 4. Bits are assigned from the rgrp based on either the reservation
257 or wherever it can.
258 */
259
260 struct gfs2_blkreserv {
261 /* components used during write (step 1): */
262 atomic_t rs_sizehint; /* hint of the write size */
263
264 /* components used during get_local_rgrp (step 3): */
265 struct gfs2_rbm rs_rbm;
266 struct gfs2_holder rs_rgd_gh; /* Filled in by get_local_rgrp */
267 struct rb_node rs_node; /* link to other block reservations */
268
269 /* components used during block searches and assignments (step 4): */
270 u32 rs_free; /* how many blocks are still free */
271
272 /* ancillary quota stuff */
273 struct gfs2_quota_data *rs_qa_qd[2 * MAXQUOTAS];
274 struct gfs2_holder rs_qa_qd_ghs[2 * MAXQUOTAS];
275 unsigned int rs_qa_qd_num;
276 };
277
278 enum {
279 GLF_LOCK = 1,
280 GLF_DEMOTE = 3,
281 GLF_PENDING_DEMOTE = 4,
282 GLF_DEMOTE_IN_PROGRESS = 5,
283 GLF_DIRTY = 6,
284 GLF_LFLUSH = 7,
285 GLF_INVALIDATE_IN_PROGRESS = 8,
286 GLF_REPLY_PENDING = 9,
287 GLF_INITIAL = 10,
288 GLF_FROZEN = 11,
289 GLF_QUEUED = 12,
290 GLF_LRU = 13,
291 GLF_OBJECT = 14, /* Used only for tracing */
292 GLF_BLOCKING = 15,
293 };
294
295 struct gfs2_glock {
296 struct hlist_bl_node gl_list;
297 struct gfs2_sbd *gl_sbd;
298 unsigned long gl_flags; /* GLF_... */
299 struct lm_lockname gl_name;
300 atomic_t gl_ref;
301
302 spinlock_t gl_spin;
303
304 /* State fields protected by gl_spin */
305 unsigned int gl_state:2, /* Current state */
306 gl_target:2, /* Target state */
307 gl_demote_state:2, /* State requested by remote node */
308 gl_req:2, /* State in last dlm request */
309 gl_reply:8; /* Last reply from the dlm */
310
311 unsigned int gl_hash;
312 unsigned long gl_demote_time; /* time of first demote request */
313 long gl_hold_time;
314 struct list_head gl_holders;
315
316 const struct gfs2_glock_operations *gl_ops;
317 ktime_t gl_dstamp;
318 struct gfs2_lkstats gl_stats;
319 struct dlm_lksb gl_lksb;
320 char gl_lvb[32];
321 unsigned long gl_tchange;
322 void *gl_object;
323
324 struct list_head gl_lru;
325 struct list_head gl_ail_list;
326 atomic_t gl_ail_count;
327 atomic_t gl_revokes;
328 struct delayed_work gl_work;
329 struct work_struct gl_delete;
330 struct rcu_head gl_rcu;
331 };
332
333 #define GFS2_MIN_LVB_SIZE 32 /* Min size of LVB that gfs2 supports */
334
335 enum {
336 GIF_INVALID = 0,
337 GIF_QD_LOCKED = 1,
338 GIF_ALLOC_FAILED = 2,
339 GIF_SW_PAGED = 3,
340 };
341
342 struct gfs2_inode {
343 struct inode i_inode;
344 u64 i_no_addr;
345 u64 i_no_formal_ino;
346 u64 i_generation;
347 u64 i_eattr;
348 unsigned long i_flags; /* GIF_... */
349 struct gfs2_glock *i_gl; /* Move into i_gh? */
350 struct gfs2_holder i_iopen_gh;
351 struct gfs2_holder i_gh; /* for prepare/commit_write only */
352 struct gfs2_blkreserv *i_res; /* rgrp multi-block reservation */
353 struct gfs2_rgrpd *i_rgd;
354 u64 i_goal; /* goal block for allocations */
355 struct rw_semaphore i_rw_mutex;
356 struct list_head i_trunc_list;
357 __be64 *i_hash_cache;
358 u32 i_entries;
359 u32 i_diskflags;
360 u8 i_height;
361 u8 i_depth;
362 };
363
364 /*
365 * Since i_inode is the first element of struct gfs2_inode,
366 * this is effectively a cast.
367 */
368 static inline struct gfs2_inode *GFS2_I(struct inode *inode)
369 {
370 return container_of(inode, struct gfs2_inode, i_inode);
371 }
372
373 static inline struct gfs2_sbd *GFS2_SB(const struct inode *inode)
374 {
375 return inode->i_sb->s_fs_info;
376 }
377
378 struct gfs2_file {
379 struct mutex f_fl_mutex;
380 struct gfs2_holder f_fl_gh;
381 };
382
383 struct gfs2_revoke_replay {
384 struct list_head rr_list;
385 u64 rr_blkno;
386 unsigned int rr_where;
387 };
388
389 enum {
390 QDF_USER = 0,
391 QDF_CHANGE = 1,
392 QDF_LOCKED = 2,
393 QDF_REFRESH = 3,
394 };
395
396 struct gfs2_quota_data {
397 struct list_head qd_list;
398 struct list_head qd_reclaim;
399
400 atomic_t qd_count;
401
402 u32 qd_id;
403 unsigned long qd_flags; /* QDF_... */
404
405 s64 qd_change;
406 s64 qd_change_sync;
407
408 unsigned int qd_slot;
409 unsigned int qd_slot_count;
410
411 struct buffer_head *qd_bh;
412 struct gfs2_quota_change *qd_bh_qc;
413 unsigned int qd_bh_count;
414
415 struct gfs2_glock *qd_gl;
416 struct gfs2_quota_lvb qd_qb;
417
418 u64 qd_sync_gen;
419 unsigned long qd_last_warn;
420 };
421
422 struct gfs2_trans {
423 unsigned long tr_ip;
424
425 unsigned int tr_blocks;
426 unsigned int tr_revokes;
427 unsigned int tr_reserved;
428
429 struct gfs2_holder tr_t_gh;
430
431 int tr_touched;
432
433 unsigned int tr_num_buf_new;
434 unsigned int tr_num_databuf_new;
435 unsigned int tr_num_buf_rm;
436 unsigned int tr_num_databuf_rm;
437 unsigned int tr_num_revoke;
438 unsigned int tr_num_revoke_rm;
439 };
440
441 struct gfs2_ail {
442 struct list_head ai_list;
443
444 unsigned int ai_first;
445 struct list_head ai_ail1_list;
446 struct list_head ai_ail2_list;
447 };
448
449 struct gfs2_journal_extent {
450 struct list_head extent_list;
451
452 unsigned int lblock; /* First logical block */
453 u64 dblock; /* First disk block */
454 u64 blocks;
455 };
456
457 struct gfs2_jdesc {
458 struct list_head jd_list;
459 struct list_head extent_list;
460 struct work_struct jd_work;
461 struct inode *jd_inode;
462 unsigned long jd_flags;
463 #define JDF_RECOVERY 1
464 unsigned int jd_jid;
465 unsigned int jd_blocks;
466 int jd_recover_error;
467 };
468
469 struct gfs2_statfs_change_host {
470 s64 sc_total;
471 s64 sc_free;
472 s64 sc_dinodes;
473 };
474
475 #define GFS2_QUOTA_DEFAULT GFS2_QUOTA_OFF
476 #define GFS2_QUOTA_OFF 0
477 #define GFS2_QUOTA_ACCOUNT 1
478 #define GFS2_QUOTA_ON 2
479
480 #define GFS2_DATA_DEFAULT GFS2_DATA_ORDERED
481 #define GFS2_DATA_WRITEBACK 1
482 #define GFS2_DATA_ORDERED 2
483
484 #define GFS2_ERRORS_DEFAULT GFS2_ERRORS_WITHDRAW
485 #define GFS2_ERRORS_WITHDRAW 0
486 #define GFS2_ERRORS_CONTINUE 1 /* place holder for future feature */
487 #define GFS2_ERRORS_RO 2 /* place holder for future feature */
488 #define GFS2_ERRORS_PANIC 3
489
490 struct gfs2_args {
491 char ar_lockproto[GFS2_LOCKNAME_LEN]; /* Name of the Lock Protocol */
492 char ar_locktable[GFS2_LOCKNAME_LEN]; /* Name of the Lock Table */
493 char ar_hostdata[GFS2_LOCKNAME_LEN]; /* Host specific data */
494 unsigned int ar_spectator:1; /* Don't get a journal */
495 unsigned int ar_localflocks:1; /* Let the VFS do flock|fcntl */
496 unsigned int ar_debug:1; /* Oops on errors */
497 unsigned int ar_posix_acl:1; /* Enable posix acls */
498 unsigned int ar_quota:2; /* off/account/on */
499 unsigned int ar_suiddir:1; /* suiddir support */
500 unsigned int ar_data:2; /* ordered/writeback */
501 unsigned int ar_meta:1; /* mount metafs */
502 unsigned int ar_discard:1; /* discard requests */
503 unsigned int ar_errors:2; /* errors=withdraw | panic */
504 unsigned int ar_nobarrier:1; /* do not send barriers */
505 unsigned int ar_rgrplvb:1; /* use lvbs for rgrp info */
506 int ar_commit; /* Commit interval */
507 int ar_statfs_quantum; /* The fast statfs interval */
508 int ar_quota_quantum; /* The quota interval */
509 int ar_statfs_percent; /* The % change to force sync */
510 };
511
512 struct gfs2_tune {
513 spinlock_t gt_spin;
514
515 unsigned int gt_logd_secs;
516
517 unsigned int gt_quota_simul_sync; /* Max quotavals to sync at once */
518 unsigned int gt_quota_warn_period; /* Secs between quota warn msgs */
519 unsigned int gt_quota_scale_num; /* Numerator */
520 unsigned int gt_quota_scale_den; /* Denominator */
521 unsigned int gt_quota_quantum; /* Secs between syncs to quota file */
522 unsigned int gt_new_files_jdata;
523 unsigned int gt_max_readahead; /* Max bytes to read-ahead from disk */
524 unsigned int gt_complain_secs;
525 unsigned int gt_statfs_quantum;
526 unsigned int gt_statfs_slow;
527 };
528
529 enum {
530 SDF_JOURNAL_CHECKED = 0,
531 SDF_JOURNAL_LIVE = 1,
532 SDF_SHUTDOWN = 2,
533 SDF_NOBARRIERS = 3,
534 SDF_NORECOVERY = 4,
535 SDF_DEMOTE = 5,
536 SDF_NOJOURNALID = 6,
537 SDF_RORECOVERY = 7, /* read only recovery */
538 };
539
540 #define GFS2_FSNAME_LEN 256
541
542 struct gfs2_inum_host {
543 u64 no_formal_ino;
544 u64 no_addr;
545 };
546
547 struct gfs2_sb_host {
548 u32 sb_magic;
549 u32 sb_type;
550 u32 sb_format;
551
552 u32 sb_fs_format;
553 u32 sb_multihost_format;
554 u32 sb_bsize;
555 u32 sb_bsize_shift;
556
557 struct gfs2_inum_host sb_master_dir;
558 struct gfs2_inum_host sb_root_dir;
559
560 char sb_lockproto[GFS2_LOCKNAME_LEN];
561 char sb_locktable[GFS2_LOCKNAME_LEN];
562 };
563
564 /*
565 * lm_mount() return values
566 *
567 * ls_jid - the journal ID this node should use
568 * ls_first - this node is the first to mount the file system
569 * ls_lockspace - lock module's context for this file system
570 * ls_ops - lock module's functions
571 */
572
573 struct lm_lockstruct {
574 int ls_jid;
575 unsigned int ls_first;
576 const struct lm_lockops *ls_ops;
577 dlm_lockspace_t *ls_dlm;
578
579 int ls_recover_jid_done; /* These two are deprecated, */
580 int ls_recover_jid_status; /* used previously by gfs_controld */
581
582 struct dlm_lksb ls_mounted_lksb; /* mounted_lock */
583 struct dlm_lksb ls_control_lksb; /* control_lock */
584 char ls_control_lvb[GDLM_LVB_SIZE]; /* control_lock lvb */
585 struct completion ls_sync_wait; /* {control,mounted}_{lock,unlock} */
586
587 spinlock_t ls_recover_spin; /* protects following fields */
588 unsigned long ls_recover_flags; /* DFL_ */
589 uint32_t ls_recover_mount; /* gen in first recover_done cb */
590 uint32_t ls_recover_start; /* gen in last recover_done cb */
591 uint32_t ls_recover_block; /* copy recover_start in last recover_prep */
592 uint32_t ls_recover_size; /* size of recover_submit, recover_result */
593 uint32_t *ls_recover_submit; /* gen in last recover_slot cb per jid */
594 uint32_t *ls_recover_result; /* result of last jid recovery */
595 };
596
597 struct gfs2_pcpu_lkstats {
598 /* One struct for each glock type */
599 struct gfs2_lkstats lkstats[10];
600 };
601
602 struct gfs2_sbd {
603 struct super_block *sd_vfs;
604 struct gfs2_pcpu_lkstats __percpu *sd_lkstats;
605 struct kobject sd_kobj;
606 unsigned long sd_flags; /* SDF_... */
607 struct gfs2_sb_host sd_sb;
608
609 /* Constants computed on mount */
610
611 u32 sd_fsb2bb;
612 u32 sd_fsb2bb_shift;
613 u32 sd_diptrs; /* Number of pointers in a dinode */
614 u32 sd_inptrs; /* Number of pointers in a indirect block */
615 u32 sd_jbsize; /* Size of a journaled data block */
616 u32 sd_hash_bsize; /* sizeof(exhash block) */
617 u32 sd_hash_bsize_shift;
618 u32 sd_hash_ptrs; /* Number of pointers in a hash block */
619 u32 sd_qc_per_block;
620 u32 sd_max_dirres; /* Max blocks needed to add a directory entry */
621 u32 sd_max_height; /* Max height of a file's metadata tree */
622 u64 sd_heightsize[GFS2_MAX_META_HEIGHT + 1];
623 u32 sd_max_jheight; /* Max height of journaled file's meta tree */
624 u64 sd_jheightsize[GFS2_MAX_META_HEIGHT + 1];
625
626 struct gfs2_args sd_args; /* Mount arguments */
627 struct gfs2_tune sd_tune; /* Filesystem tuning structure */
628
629 /* Lock Stuff */
630
631 struct lm_lockstruct sd_lockstruct;
632 struct gfs2_holder sd_live_gh;
633 struct gfs2_glock *sd_rename_gl;
634 struct gfs2_glock *sd_trans_gl;
635 wait_queue_head_t sd_glock_wait;
636 atomic_t sd_glock_disposal;
637 struct completion sd_locking_init;
638 struct delayed_work sd_control_work;
639
640 /* Inode Stuff */
641
642 struct dentry *sd_master_dir;
643 struct dentry *sd_root_dir;
644
645 struct inode *sd_jindex;
646 struct inode *sd_statfs_inode;
647 struct inode *sd_sc_inode;
648 struct inode *sd_qc_inode;
649 struct inode *sd_rindex;
650 struct inode *sd_quota_inode;
651
652 /* StatFS stuff */
653
654 spinlock_t sd_statfs_spin;
655 struct gfs2_statfs_change_host sd_statfs_master;
656 struct gfs2_statfs_change_host sd_statfs_local;
657 int sd_statfs_force_sync;
658
659 /* Resource group stuff */
660
661 int sd_rindex_uptodate;
662 spinlock_t sd_rindex_spin;
663 struct rb_root sd_rindex_tree;
664 unsigned int sd_rgrps;
665 unsigned int sd_max_rg_data;
666
667 /* Journal index stuff */
668
669 struct list_head sd_jindex_list;
670 spinlock_t sd_jindex_spin;
671 struct mutex sd_jindex_mutex;
672 unsigned int sd_journals;
673
674 struct gfs2_jdesc *sd_jdesc;
675 struct gfs2_holder sd_journal_gh;
676 struct gfs2_holder sd_jinode_gh;
677
678 struct gfs2_holder sd_sc_gh;
679 struct gfs2_holder sd_qc_gh;
680
681 /* Daemon stuff */
682
683 struct task_struct *sd_logd_process;
684 struct task_struct *sd_quotad_process;
685
686 /* Quota stuff */
687
688 struct list_head sd_quota_list;
689 atomic_t sd_quota_count;
690 struct mutex sd_quota_mutex;
691 wait_queue_head_t sd_quota_wait;
692 struct list_head sd_trunc_list;
693 spinlock_t sd_trunc_lock;
694
695 unsigned int sd_quota_slots;
696 unsigned int sd_quota_chunks;
697 unsigned char **sd_quota_bitmap;
698
699 u64 sd_quota_sync_gen;
700
701 /* Log stuff */
702
703 spinlock_t sd_log_lock;
704
705 unsigned int sd_log_blks_reserved;
706 unsigned int sd_log_commited_buf;
707 unsigned int sd_log_commited_databuf;
708 int sd_log_commited_revoke;
709
710 atomic_t sd_log_pinned;
711 unsigned int sd_log_num_buf;
712 unsigned int sd_log_num_revoke;
713 unsigned int sd_log_num_rg;
714 unsigned int sd_log_num_databuf;
715
716 struct list_head sd_log_le_buf;
717 struct list_head sd_log_le_revoke;
718 struct list_head sd_log_le_databuf;
719 struct list_head sd_log_le_ordered;
720
721 atomic_t sd_log_thresh1;
722 atomic_t sd_log_thresh2;
723 atomic_t sd_log_blks_free;
724 wait_queue_head_t sd_log_waitq;
725 wait_queue_head_t sd_logd_waitq;
726
727 u64 sd_log_sequence;
728 unsigned int sd_log_head;
729 unsigned int sd_log_tail;
730 int sd_log_idle;
731
732 struct rw_semaphore sd_log_flush_lock;
733 atomic_t sd_log_in_flight;
734 struct bio *sd_log_bio;
735 wait_queue_head_t sd_log_flush_wait;
736 int sd_log_error;
737
738 unsigned int sd_log_flush_head;
739 u64 sd_log_flush_wrapped;
740
741 spinlock_t sd_ail_lock;
742 struct list_head sd_ail1_list;
743 struct list_head sd_ail2_list;
744
745 /* Replay stuff */
746
747 struct list_head sd_revoke_list;
748 unsigned int sd_replay_tail;
749
750 unsigned int sd_found_blocks;
751 unsigned int sd_found_revokes;
752 unsigned int sd_replayed_blocks;
753
754 /* For quiescing the filesystem */
755
756 struct gfs2_holder sd_freeze_gh;
757 struct mutex sd_freeze_lock;
758 unsigned int sd_freeze_count;
759
760 char sd_fsname[GFS2_FSNAME_LEN];
761 char sd_table_name[GFS2_FSNAME_LEN];
762 char sd_proto_name[GFS2_FSNAME_LEN];
763
764 /* Debugging crud */
765
766 unsigned long sd_last_warning;
767 struct dentry *debugfs_dir; /* debugfs directory */
768 struct dentry *debugfs_dentry_glocks;
769 struct dentry *debugfs_dentry_glstats;
770 struct dentry *debugfs_dentry_sbstats;
771 };
772
773 static inline void gfs2_glstats_inc(struct gfs2_glock *gl, int which)
774 {
775 gl->gl_stats.stats[which]++;
776 }
777
778 static inline void gfs2_sbstats_inc(const struct gfs2_glock *gl, int which)
779 {
780 const struct gfs2_sbd *sdp = gl->gl_sbd;
781 preempt_disable();
782 this_cpu_ptr(sdp->sd_lkstats)->lkstats[gl->gl_name.ln_type].stats[which]++;
783 preempt_enable();
784 }
785
786 #endif /* __INCORE_DOT_H__ */
787
This page took 0.0506 seconds and 5 git commands to generate.