Blame view

fs/gfs2/incore.h 23.3 KB
7336d0e65   Thomas Gleixner   treewide: Replace...
1
  /* SPDX-License-Identifier: GPL-2.0-only */
b3b94faa5   David Teigland   [GFS2] The core o...
2
3
  /*
   * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
29d38cd16   Bob Peterson   [GFS2] Get rid of...
4
   * Copyright (C) 2004-2008 Red Hat, Inc.  All rights reserved.
b3b94faa5   David Teigland   [GFS2] The core o...
5
6
7
8
   */
  
  #ifndef __INCORE_DOT_H__
  #define __INCORE_DOT_H__
f2f7ba523   Steven Whitehouse   [GFS2] Make heade...
9
  #include <linux/fs.h>
57cc7215b   Alexey Dobriyan   headers: kobject....
10
  #include <linux/kobject.h>
c4f68a130   Benjamin Marzinski   [GFS2] delay gloc...
11
  #include <linux/workqueue.h>
f057f6cdf   Steven Whitehouse   GFS2: Merge lock_...
12
13
  #include <linux/dlm.h>
  #include <linux/buffer_head.h>
bc015cb84   Steven Whitehouse   GFS2: Use RCU for...
14
15
  #include <linux/rcupdate.h>
  #include <linux/rculist_bl.h>
3942ae531   Steven Whitehouse   GFS2: Fix race du...
16
  #include <linux/completion.h>
7c9ca6211   Bob Peterson   GFS2: Use rbtree ...
17
  #include <linux/rbtree.h>
a245769f2   Steven Whitehouse   GFS2: glock stati...
18
19
  #include <linux/ktime.h>
  #include <linux/percpu.h>
e66cf1610   Steven Whitehouse   GFS2: Use lockref...
20
  #include <linux/lockref.h>
88ffbf3e0   Bob Peterson   GFS2: Use resizab...
21
  #include <linux/rhashtable.h>
f2f7ba523   Steven Whitehouse   [GFS2] Make heade...
22

b3b94faa5   David Teigland   [GFS2] The core o...
23
24
  #define DIO_WAIT	0x00000010
  #define DIO_METADATA	0x00000020
b3b94faa5   David Teigland   [GFS2] The core o...
25
26
  
  struct gfs2_log_operations;
c0752aa7e   Bob Peterson   GFS2: eliminate l...
27
  struct gfs2_bufdata;
b3b94faa5   David Teigland   [GFS2] The core o...
28
29
  struct gfs2_holder;
  struct gfs2_glock;
b3b94faa5   David Teigland   [GFS2] The core o...
30
  struct gfs2_quota_data;
b3b94faa5   David Teigland   [GFS2] The core o...
31
  struct gfs2_trans;
b3b94faa5   David Teigland   [GFS2] The core o...
32
  struct gfs2_jdesc;
b3b94faa5   David Teigland   [GFS2] The core o...
33
  struct gfs2_sbd;
f057f6cdf   Steven Whitehouse   GFS2: Merge lock_...
34
  struct lm_lockops;
b3b94faa5   David Teigland   [GFS2] The core o...
35
36
  
  typedef void (*gfs2_glop_bh_t) (struct gfs2_glock *gl, unsigned int ret);
bb8d8a6f5   Steven Whitehouse   [GFS2] Fix sign p...
37
38
39
40
41
  struct gfs2_log_header_host {
  	u64 lh_sequence;	/* Sequence number of this transaction */
  	u32 lh_flags;		/* GFS2_LOG_HEAD_... */
  	u32 lh_tail;		/* Block number of log tail */
  	u32 lh_blkno;
bb8d8a6f5   Steven Whitehouse   [GFS2] Fix sign p...
42
  };
b3b94faa5   David Teigland   [GFS2] The core o...
43
44
45
46
47
48
  /*
   * Structure of operations that are associated with each
   * type of element in the log.
   */
  
  struct gfs2_log_operations {
d69a3c656   Steven Whitehouse   GFS2: Move log bu...
49
  	void (*lo_before_commit) (struct gfs2_sbd *sdp, struct gfs2_trans *tr);
16ca9412d   Benjamin Marzinski   GFS2: replace gfs...
50
  	void (*lo_after_commit) (struct gfs2_sbd *sdp, struct gfs2_trans *tr);
b3b94faa5   David Teigland   [GFS2] The core o...
51
  	void (*lo_before_scan) (struct gfs2_jdesc *jd,
551676226   Al Viro   [GFS2] split and ...
52
  				struct gfs2_log_header_host *head, int pass);
b3b94faa5   David Teigland   [GFS2] The core o...
53
54
55
56
  	int (*lo_scan_elements) (struct gfs2_jdesc *jd, unsigned int start,
  				 struct gfs2_log_descriptor *ld, __be64 *ptr,
  				 int pass);
  	void (*lo_after_scan) (struct gfs2_jdesc *jd, int error, int pass);
b09e593d7   Steven Whitehouse   [GFS2] Fix a ref ...
57
  	const char *lo_name;
b3b94faa5   David Teigland   [GFS2] The core o...
58
  };
60a0b8f93   Steven Whitehouse   GFS2: Add a rgrp ...
59
  #define GBF_FULL 1
dffe12a82   Bob Peterson   gfs2: Fix gfs2_te...
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
  /**
   * Clone bitmaps (bi_clone):
   *
   * - When a block is freed, we remember the previous state of the block in the
   *   clone bitmap, and only mark the block as free in the real bitmap.
   *
   * - When looking for a block to allocate, we check for a free block in the
   *   clone bitmap, and if no clone bitmap exists, in the real bitmap.
   *
   * - For allocating a block, we mark it as allocated in the real bitmap, and if
   *   a clone bitmap exists, also in the clone bitmap.
   *
   * - At the end of a log_flush, we copy the real bitmap into the clone bitmap
   *   to make the clone bitmap reflect the current allocation state.
   *   (Alternatively, we could remove the clone bitmap.)
   *
   * The clone bitmaps are in-core only, and is never written to disk.
   *
   * These steps ensure that blocks which have been freed in a transaction cannot
   * be reallocated in that same transaction.
   */
b3b94faa5   David Teigland   [GFS2] The core o...
81
82
83
  struct gfs2_bitmap {
  	struct buffer_head *bi_bh;
  	char *bi_clone;
60a0b8f93   Steven Whitehouse   GFS2: Add a rgrp ...
84
  	unsigned long bi_flags;
cd915493f   Steven Whitehouse   [GFS2] Change all...
85
86
  	u32 bi_offset;
  	u32 bi_start;
281b4952d   Andreas Gruenbacher   gfs2: Rename bitm...
87
  	u32 bi_bytes;
7e230f577   Bob Peterson   GFS2: introduce b...
88
  	u32 bi_blocks;
b3b94faa5   David Teigland   [GFS2] The core o...
89
90
91
  };
  
  struct gfs2_rgrpd {
7c9ca6211   Bob Peterson   GFS2: Use rbtree ...
92
  	struct rb_node rd_node;		/* Link with superblock */
b3b94faa5   David Teigland   [GFS2] The core o...
93
  	struct gfs2_glock *rd_gl;	/* Glock for this rgrp */
bb8d8a6f5   Steven Whitehouse   [GFS2] Fix sign p...
94
95
96
97
98
  	u64 rd_addr;			/* grp block disk address */
  	u64 rd_data0;			/* first data location */
  	u32 rd_length;			/* length of rgrp header in fs blocks */
  	u32 rd_data;			/* num of data blocks in rgrp */
  	u32 rd_bitbytes;		/* number of bytes in data bitmaps */
cfc8b5492   Steven Whitehouse   GFS2: Move rg_fre...
99
  	u32 rd_free;
8e2e00473   Bob Peterson   GFS2: Reduce file...
100
  	u32 rd_reserved;                /* number of blocks reserved */
73f749483   Steven Whitehouse   GFS2: Banish stru...
101
102
  	u32 rd_free_clone;
  	u32 rd_dinodes;
d8b71f738   Steven Whitehouse   GFS2: Move rg_ige...
103
  	u64 rd_igeneration;
b3b94faa5   David Teigland   [GFS2] The core o...
104
  	struct gfs2_bitmap *rd_bits;
b3b94faa5   David Teigland   [GFS2] The core o...
105
  	struct gfs2_sbd *rd_sbd;
90306c41d   Benjamin Marzinski   GFS2: Use lvbs fo...
106
  	struct gfs2_rgrp_lvb *rd_rgl;
73f749483   Steven Whitehouse   GFS2: Banish stru...
107
  	u32 rd_last_alloc;
1ce97e564   Steven Whitehouse   GFS2: Be more agg...
108
  	u32 rd_flags;
5ea5050ce   Bob Peterson   GFS2: Implement a...
109
  	u32 rd_extfail_pt;		/* extent failure point */
090109783   Steven Whitehouse   GFS2: Improve res...
110
111
112
  #define GFS2_RDF_CHECK		0x10000000 /* check for unlinked inodes */
  #define GFS2_RDF_UPTODATE	0x20000000 /* rg is up to date */
  #define GFS2_RDF_ERROR		0x40000000 /* error in rg */
0e27c18c3   Bob Peterson   GFS2: Set of dist...
113
  #define GFS2_RDF_PREFERRED	0x80000000 /* This rgrp is preferred */
090109783   Steven Whitehouse   GFS2: Improve res...
114
  #define GFS2_RDF_MASK		0xf0000000 /* mask for internal flags */
8e2e00473   Bob Peterson   GFS2: Reduce file...
115
116
  	spinlock_t rd_rsspin;           /* protects reservation related vars */
  	struct rb_root rd_rstree;       /* multi-block reservation tree */
b3b94faa5   David Teigland   [GFS2] The core o...
117
  };
4a993fb15   Steven Whitehouse   GFS2: Add structu...
118
119
  struct gfs2_rbm {
  	struct gfs2_rgrpd *rgd;
4a993fb15   Steven Whitehouse   GFS2: Add structu...
120
  	u32 offset;		/* The offset is bitmap relative */
e579ed4f4   Bob Peterson   GFS2: Introduce r...
121
  	int bii;		/* Bitmap index */
4a993fb15   Steven Whitehouse   GFS2: Add structu...
122
  };
e579ed4f4   Bob Peterson   GFS2: Introduce r...
123
124
125
126
  static inline struct gfs2_bitmap *rbm_bi(const struct gfs2_rbm *rbm)
  {
  	return rbm->rgd->rd_bits + rbm->bii;
  }
4a993fb15   Steven Whitehouse   GFS2: Add structu...
127
128
  static inline u64 gfs2_rbm_to_block(const struct gfs2_rbm *rbm)
  {
dc8fbb03d   Bob Peterson   GFS2: gfs2_free_e...
129
  	BUG_ON(rbm->offset >= rbm->rgd->rd_data);
e579ed4f4   Bob Peterson   GFS2: Introduce r...
130
131
  	return rbm->rgd->rd_data0 + (rbm_bi(rbm)->bi_start * GFS2_NBBY) +
  		rbm->offset;
4a993fb15   Steven Whitehouse   GFS2: Add structu...
132
  }
5b924ae2d   Steven Whitehouse   GFS2: Replace rgb...
133
134
135
  static inline bool gfs2_rbm_eq(const struct gfs2_rbm *rbm1,
  			       const struct gfs2_rbm *rbm2)
  {
e579ed4f4   Bob Peterson   GFS2: Introduce r...
136
  	return (rbm1->rgd == rbm2->rgd) && (rbm1->bii == rbm2->bii) &&
5b924ae2d   Steven Whitehouse   GFS2: Replace rgb...
137
138
  	       (rbm1->offset == rbm2->offset);
  }
b3b94faa5   David Teigland   [GFS2] The core o...
139
140
  enum gfs2_state_bits {
  	BH_Pinned = BH_PrivateStart,
f42faf4fa   Steven Whitehouse   [GFS2] Add gfs2_i...
141
  	BH_Escaped = BH_PrivateStart + 1,
b3b94faa5   David Teigland   [GFS2] The core o...
142
143
144
145
  };
  
  BUFFER_FNS(Pinned, pinned)
  TAS_BUFFER_FNS(Pinned, pinned)
f42faf4fa   Steven Whitehouse   [GFS2] Add gfs2_i...
146
147
  BUFFER_FNS(Escaped, escaped)
  TAS_BUFFER_FNS(Escaped, escaped)
b3b94faa5   David Teigland   [GFS2] The core o...
148
149
150
151
  
  struct gfs2_bufdata {
  	struct buffer_head *bd_bh;
  	struct gfs2_glock *bd_gl;
c50b91c4b   Steven Whitehouse   GFS2: Remove bd_l...
152
  	u64 bd_blkno;
82e86087b   Steven Whitehouse   [GFS2] Replace re...
153

c0752aa7e   Bob Peterson   GFS2: eliminate l...
154
  	struct list_head bd_list;
b3b94faa5   David Teigland   [GFS2] The core o...
155

16ca9412d   Benjamin Marzinski   GFS2: replace gfs...
156
  	struct gfs2_trans *bd_tr;
b3b94faa5   David Teigland   [GFS2] The core o...
157
158
159
  	struct list_head bd_ail_st_list;
  	struct list_head bd_ail_gl_list;
  };
f057f6cdf   Steven Whitehouse   GFS2: Merge lock_...
160
161
162
163
164
165
166
  /*
   * Internally, we prefix things with gdlm_ and GDLM_ (for gfs-dlm) since a
   * prefix of lock_dlm_ gets awkward.
   */
  
  #define GDLM_STRNAME_BYTES	25
  #define GDLM_LVB_SIZE		32
e0c2a9aa1   David Teigland   GFS2: dlm based r...
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
  /*
   * ls_recover_flags:
   *
   * DFL_BLOCK_LOCKS: dlm is in recovery and will grant locks that had been
   * held by failed nodes whose journals need recovery.  Those locks should
   * only be used for journal recovery until the journal recovery is done.
   * This is set by the dlm recover_prep callback and cleared by the
   * gfs2_control thread when journal recovery is complete.  To avoid
   * races between recover_prep setting and gfs2_control clearing, recover_spin
   * is held while changing this bit and reading/writing recover_block
   * and recover_start.
   *
   * DFL_NO_DLM_OPS: dlm lockspace ops/callbacks are not being used.
   *
   * DFL_FIRST_MOUNT: this node is the first to mount this fs and is doing
   * recovery of all journals before allowing other nodes to mount the fs.
   * This is cleared when FIRST_MOUNT_DONE is set.
   *
   * DFL_FIRST_MOUNT_DONE: this node was the first mounter, and has finished
   * recovery of all journals, and now allows other nodes to mount the fs.
   *
   * DFL_MOUNT_DONE: gdlm_mount has completed successfully and cleared
   * BLOCK_LOCKS for the first time.  The gfs2_control thread should now
   * control clearing BLOCK_LOCKS for further recoveries.
   *
   * DFL_UNMOUNT: gdlm_unmount sets to keep sdp off gfs2_control_wq.
   *
   * DFL_DLM_RECOVERY: set while dlm is in recovery, between recover_prep()
   * and recover_done(), i.e. set while recover_block == recover_start.
   */
f057f6cdf   Steven Whitehouse   GFS2: Merge lock_...
197
198
  enum {
  	DFL_BLOCK_LOCKS		= 0,
e0c2a9aa1   David Teigland   GFS2: dlm based r...
199
200
201
202
203
204
  	DFL_NO_DLM_OPS		= 1,
  	DFL_FIRST_MOUNT		= 2,
  	DFL_FIRST_MOUNT_DONE	= 3,
  	DFL_MOUNT_DONE		= 4,
  	DFL_UNMOUNT		= 5,
  	DFL_DLM_RECOVERY	= 6,
f057f6cdf   Steven Whitehouse   GFS2: Merge lock_...
205
  };
972b044ee   Andreas Gruenbacher   gfs2: Don't pack ...
206
207
208
209
  /*
   * We are using struct lm_lockname as an rhashtable key.  Avoid holes within
   * the struct; padding at the end is fine.
   */
f057f6cdf   Steven Whitehouse   GFS2: Merge lock_...
210
211
  struct lm_lockname {
  	u64 ln_number;
972b044ee   Andreas Gruenbacher   gfs2: Don't pack ...
212
  	struct gfs2_sbd *ln_sbd;
f057f6cdf   Steven Whitehouse   GFS2: Merge lock_...
213
  	unsigned int ln_type;
972b044ee   Andreas Gruenbacher   gfs2: Don't pack ...
214
  };
f057f6cdf   Steven Whitehouse   GFS2: Merge lock_...
215
216
  
  #define lm_name_equal(name1, name2) \
15562c439   Bob Peterson   GFS2: Move glock ...
217
218
219
          (((name1)->ln_number == (name2)->ln_number) &&	\
  	 ((name1)->ln_type == (name2)->ln_type) &&	\
  	 ((name1)->ln_sbd == (name2)->ln_sbd))
f057f6cdf   Steven Whitehouse   GFS2: Merge lock_...
220

b3b94faa5   David Teigland   [GFS2] The core o...
221
  struct gfs2_glock_operations {
06dfc3064   Bob Peterson   GFS2: Rename glop...
222
  	void (*go_sync) (struct gfs2_glock *gl);
6802e3400   Steven Whitehouse   [GFS2] Clean up t...
223
  	int (*go_xmote_bh) (struct gfs2_glock *gl, struct gfs2_holder *gh);
1a14d3a68   Steven Whitehouse   [GFS2] Simplify g...
224
  	void (*go_inval) (struct gfs2_glock *gl, int flags);
97cc1025b   Steven Whitehouse   GFS2: Kill two da...
225
  	int (*go_demote_ok) (const struct gfs2_glock *gl);
1a14d3a68   Steven Whitehouse   [GFS2] Simplify g...
226
227
  	int (*go_lock) (struct gfs2_holder *gh);
  	void (*go_unlock) (struct gfs2_holder *gh);
3792ce973   Bob Peterson   gfs2: dump fsid w...
228
229
  	void (*go_dump)(struct seq_file *seq, struct gfs2_glock *gl,
  			const char *fs_id_buf);
81ffbf654   Steven Whitehouse   GFS2: Add origin ...
230
  	void (*go_callback)(struct gfs2_glock *gl, bool remote);
8fb4b536e   Steven Whitehouse   [GFS2] Make glock...
231
  	const int go_type;
009d85183   Steven Whitehouse   GFS2: Metadata ad...
232
233
  	const unsigned long go_flags;
  #define GLOF_ASPACE 1
dba2d70c5   David Teigland   GFS2: only use lv...
234
  #define GLOF_LVB    2
e7ccaf5fe   Bob Peterson   GFS2: Don't add a...
235
  #define GLOF_LRU    4
b3b94faa5   David Teigland   [GFS2] The core o...
236
237
238
  };
  
  enum {
a245769f2   Steven Whitehouse   GFS2: glock stati...
239
240
241
242
243
244
245
246
247
248
249
250
  	GFS2_LKS_SRTT = 0,	/* Non blocking smoothed round trip time */
  	GFS2_LKS_SRTTVAR = 1,	/* Non blocking smoothed variance */
  	GFS2_LKS_SRTTB = 2,	/* Blocking smoothed round trip time */
  	GFS2_LKS_SRTTVARB = 3,	/* Blocking smoothed variance */
  	GFS2_LKS_SIRT = 4,	/* Smoothed Inter-request time */
  	GFS2_LKS_SIRTVAR = 5,	/* Smoothed Inter-request variance */
  	GFS2_LKS_DCOUNT = 6,	/* Count of dlm requests */
  	GFS2_LKS_QCOUNT = 7,	/* Count of gfs2_holder queues */
  	GFS2_NR_LKSTATS
  };
  
  struct gfs2_lkstats {
4d207133e   Ben Hutchings   gfs2: Make statis...
251
  	u64 stats[GFS2_NR_LKSTATS];
a245769f2   Steven Whitehouse   GFS2: glock stati...
252
253
254
  };
  
  enum {
b3b94faa5   David Teigland   [GFS2] The core o...
255
  	/* States */
6802e3400   Steven Whitehouse   [GFS2] Clean up t...
256
  	HIF_HOLDER		= 6,  /* Set for gh that "holds" the glock */
b3b94faa5   David Teigland   [GFS2] The core o...
257
  	HIF_FIRST		= 7,
fee852e37   Steven Whitehouse   [GFS2] Shrink gfs...
258
  	HIF_WAIT		= 10,
b3b94faa5   David Teigland   [GFS2] The core o...
259
260
261
262
263
264
  };
  
  struct gfs2_holder {
  	struct list_head gh_list;
  
  	struct gfs2_glock *gh_gl;
b1e058da5   Pavel Emelyanov   gfs2: make gfs2_h...
265
  	struct pid *gh_owner_pid;
b58bf407c   Bob Peterson   GFS2: Reduce size...
266
267
  	u16 gh_flags;
  	u16 gh_state;
b3b94faa5   David Teigland   [GFS2] The core o...
268
269
  
  	int gh_error;
6802e3400   Steven Whitehouse   [GFS2] Clean up t...
270
  	unsigned long gh_iflags; /* HIF_... */
d0dc80dba   Steven Whitehouse   [GFS2] Update deb...
271
  	unsigned long gh_ip;
b3b94faa5   David Teigland   [GFS2] The core o...
272
  };
a937cca27   Jan Kara   GFS2: Don't use M...
273
274
  /* Number of quota types we support */
  #define GFS2_MAXQUOTAS 2
b54e9a0b9   Bob Peterson   GFS2: Extract quo...
275
276
277
278
279
280
  struct gfs2_qadata { /* quota allocation data */
  	/* Quota stuff */
  	struct gfs2_quota_data *qa_qd[2 * GFS2_MAXQUOTAS];
  	struct gfs2_holder qa_qd_ghs[2 * GFS2_MAXQUOTAS];
  	unsigned int qa_qd_num;
  };
8e2e00473   Bob Peterson   GFS2: Reduce file...
281
282
283
284
285
286
287
288
289
290
  /* Resource group multi-block reservation, in order of appearance:
  
     Step 1. Function prepares to write, allocates a mb, sets the size hint.
     Step 2. User calls inplace_reserve to target an rgrp, sets the rgrp info
     Step 3. Function get_local_rgrp locks the rgrp, determines which bits to use
     Step 4. Bits are assigned from the rgrp based on either the reservation
             or wherever it can.
  */
  
  struct gfs2_blkreserv {
8e2e00473   Bob Peterson   GFS2: Reduce file...
291
  	struct rb_node rs_node;       /* link to other block reservations */
9e733d392   Steven Whitehouse   GFS2: Improve blo...
292
  	struct gfs2_rbm rs_rbm;       /* Start of reservation */
8e2e00473   Bob Peterson   GFS2: Reduce file...
293
  	u32 rs_free;                  /* how many blocks are still free */
8e2e00473   Bob Peterson   GFS2: Reduce file...
294
  };
7b9cff467   Steven Whitehouse   GFS2: Add allocat...
295
296
297
298
299
300
301
302
303
304
  /*
   * Allocation parameters
   * @target: The number of blocks we'd ideally like to allocate
   * @aflags: The flags (e.g. Orlov flag)
   *
   * The intent is to gradually expand this structure over time in
   * order to give more information, e.g. alignment, min extent size
   * to the allocation code.
   */
  struct gfs2_alloc_parms {
b8fbf471e   Abhi Das   gfs2: perform quo...
305
  	u64 target;
25435e5ed   Abhi Das   gfs2: allow quota...
306
  	u32 min_target;
7b9cff467   Steven Whitehouse   GFS2: Add allocat...
307
  	u32 aflags;
25435e5ed   Abhi Das   gfs2: allow quota...
308
  	u64 allowed;
7b9cff467   Steven Whitehouse   GFS2: Add allocat...
309
  };
b3b94faa5   David Teigland   [GFS2] The core o...
310
  enum {
6802e3400   Steven Whitehouse   [GFS2] Clean up t...
311
  	GLF_LOCK			= 1,
6802e3400   Steven Whitehouse   [GFS2] Clean up t...
312
313
314
315
316
317
318
  	GLF_DEMOTE			= 3,
  	GLF_PENDING_DEMOTE		= 4,
  	GLF_DEMOTE_IN_PROGRESS		= 5,
  	GLF_DIRTY			= 6,
  	GLF_LFLUSH			= 7,
  	GLF_INVALIDATE_IN_PROGRESS	= 8,
  	GLF_REPLY_PENDING		= 9,
f057f6cdf   Steven Whitehouse   GFS2: Merge lock_...
319
320
  	GLF_INITIAL			= 10,
  	GLF_FROZEN			= 11,
7b5e3d5fc   Steven Whitehouse   GFS2: Don't enfor...
321
  	GLF_QUEUED			= 12,
627c10b7e   Steven Whitehouse   GFS2: Improve tra...
322
323
  	GLF_LRU				= 13,
  	GLF_OBJECT			= 14, /* Used only for tracing */
a245769f2   Steven Whitehouse   GFS2: glock stati...
324
  	GLF_BLOCKING			= 15,
a4923865e   Bob Peterson   GFS2: Prevent del...
325
  	GLF_INODE_CREATING		= 16, /* Inode creation occurring */
b3b94faa5   David Teigland   [GFS2] The core o...
326
327
328
  };
  
  struct gfs2_glock {
b3b94faa5   David Teigland   [GFS2] The core o...
329
330
  	unsigned long gl_flags;		/* GLF_... */
  	struct lm_lockname gl_name;
b3b94faa5   David Teigland   [GFS2] The core o...
331

e66cf1610   Steven Whitehouse   GFS2: Use lockref...
332
  	struct lockref gl_lockref;
b3b94faa5   David Teigland   [GFS2] The core o...
333

f3dd16491   Andreas Gruenbacher   gfs2: Remove gl_s...
334
  	/* State fields protected by gl_lockref.lock */
47a25380e   Steven Whitehouse   GFS2: Merge glock...
335
336
337
338
339
  	unsigned int gl_state:2,	/* Current state */
  		     gl_target:2,	/* Target state */
  		     gl_demote_state:2,	/* State requested by remote node */
  		     gl_req:2,		/* State in last dlm request */
  		     gl_reply:8;	/* Last reply from the dlm */
3b8249f61   Steven Whitehouse   [GFS2] Fix bz 224...
340
  	unsigned long gl_demote_time; /* time of first demote request */
7cf8dcd3b   Bob Peterson   GFS2: Automatical...
341
  	long gl_hold_time;
b3b94faa5   David Teigland   [GFS2] The core o...
342
  	struct list_head gl_holders;
b3b94faa5   David Teigland   [GFS2] The core o...
343

8fb4b536e   Steven Whitehouse   [GFS2] Make glock...
344
  	const struct gfs2_glock_operations *gl_ops;
a245769f2   Steven Whitehouse   GFS2: glock stati...
345
346
  	ktime_t gl_dstamp;
  	struct gfs2_lkstats gl_stats;
f057f6cdf   Steven Whitehouse   GFS2: Merge lock_...
347
  	struct dlm_lksb gl_lksb;
c4f68a130   Benjamin Marzinski   [GFS2] delay gloc...
348
  	unsigned long gl_tchange;
b3b94faa5   David Teigland   [GFS2] The core o...
349
  	void *gl_object;
97cc1025b   Steven Whitehouse   GFS2: Kill two da...
350
  	struct list_head gl_lru;
b3b94faa5   David Teigland   [GFS2] The core o...
351
352
  	struct list_head gl_ail_list;
  	atomic_t gl_ail_count;
638803d45   Bob Peterson   Revert "gfs2: Rep...
353
  	atomic_t gl_revokes;
c4f68a130   Benjamin Marzinski   [GFS2] delay gloc...
354
  	struct delayed_work gl_work;
7005c3e4a   Steven Whitehouse   GFS2: Use range b...
355
356
357
358
359
360
361
362
363
  	union {
  		/* For inode and iopen glocks only */
  		struct work_struct gl_delete;
  		/* For rgrp glocks only */
  		struct {
  			loff_t start;
  			loff_t end;
  		} gl_vm;
  	};
961ae1d83   Andreas Gruenbacher   gfs2: Fix glock r...
364
  	struct rcu_head gl_rcu;
88ffbf3e0   Bob Peterson   GFS2: Use resizab...
365
  	struct rhash_head gl_node;
b3b94faa5   David Teigland   [GFS2] The core o...
366
  };
da755fdb4   Steven Whitehouse   [GFS2] Remove lm....
367
  #define GFS2_MIN_LVB_SIZE 32	/* Min size of LVB that gfs2 supports */
b3b94faa5   David Teigland   [GFS2] The core o...
368
  enum {
bfded27ba   Steven Whitehouse   [GFS2] Shrink gfs...
369
  	GIF_INVALID		= 0,
b3b94faa5   David Teigland   [GFS2] The core o...
370
  	GIF_QD_LOCKED		= 1,
40ac218f5   Steven Whitehouse   GFS2: Fix inode a...
371
  	GIF_ALLOC_FAILED	= 2,
b3b94faa5   David Teigland   [GFS2] The core o...
372
  	GIF_SW_PAGED		= 3,
451389909   Steven Whitehouse   GFS2: Use ->write...
373
  	GIF_ORDERED		= 4,
059788039   Abhi Das   GFS2: Fix uniniti...
374
  	GIF_FREE_VFS_INODE      = 5,
4fd1a5795   Andreas Gruenbacher   gfs2: Get rid of ...
375
  	GIF_GLOP_PENDING	= 6,
b3b94faa5   David Teigland   [GFS2] The core o...
376
377
378
  };
  
  struct gfs2_inode {
320dd101e   Steven Whitehouse   [GFS2] glock debu...
379
  	struct inode i_inode;
dbb7cae2a   Steven Whitehouse   [GFS2] Clean up i...
380
381
  	u64 i_no_addr;
  	u64 i_no_formal_ino;
bcf0b5b34   Steven Whitehouse   GFS2: Move genera...
382
  	u64 i_generation;
3767ac21f   Steven Whitehouse   GFS2: Move di_eat...
383
  	u64 i_eattr;
b3b94faa5   David Teigland   [GFS2] The core o...
384
  	unsigned long i_flags;		/* GIF_... */
feaa7bba0   Steven Whitehouse   [GFS2] Fix unlink...
385
  	struct gfs2_glock *i_gl; /* Move into i_gh? */
b3b94faa5   David Teigland   [GFS2] The core o...
386
  	struct gfs2_holder i_iopen_gh;
f42faf4fa   Steven Whitehouse   [GFS2] Add gfs2_i...
387
  	struct gfs2_holder i_gh; /* for prepare/commit_write only */
b54e9a0b9   Bob Peterson   GFS2: Extract quo...
388
  	struct gfs2_qadata *i_qadata; /* quota allocation data */
21f09c439   Andreas Gruenbacher   gfs2: Move rs_{si...
389
  	struct gfs2_holder i_rgd_gh;
a097dc7e2   Bob Peterson   GFS2: Make rgrp r...
390
  	struct gfs2_blkreserv i_res; /* rgrp multi-block reservation */
ce276b06e   Steven Whitehouse   [GFS2] Reduce ino...
391
  	u64 i_goal;	/* goal block for allocations */
21f09c439   Andreas Gruenbacher   gfs2: Move rs_{si...
392
  	atomic_t i_sizehint;  /* hint of the write size */
b3b94faa5   David Teigland   [GFS2] The core o...
393
  	struct rw_semaphore i_rw_mutex;
451389909   Steven Whitehouse   GFS2: Use ->write...
394
  	struct list_head i_ordered;
813e0c46c   Steven Whitehouse   GFS2: Fix "trunca...
395
  	struct list_head i_trunc_list;
17d539f04   Steven Whitehouse   GFS2: Cache dir h...
396
  	__be64 *i_hash_cache;
ad6203f2b   Steven Whitehouse   GFS2: Move "entri...
397
  	u32 i_entries;
383f01fbf   Steven Whitehouse   GFS2: Banish stru...
398
  	u32 i_diskflags;
ecc30c791   Steven Whitehouse   [GFS2] Streamline...
399
  	u8 i_height;
9a0045088   Steven Whitehouse   [GFS2] Shrink & r...
400
  	u8 i_depth;
c8d577038   Andreas Gruenbacher   gfs2: Extended at...
401
  	u16 i_rahead;
b3b94faa5   David Teigland   [GFS2] The core o...
402
  };
feaa7bba0   Steven Whitehouse   [GFS2] Fix unlink...
403
404
405
406
  /*
   * Since i_inode is the first element of struct gfs2_inode,
   * this is effectively a cast.
   */
320dd101e   Steven Whitehouse   [GFS2] glock debu...
407
408
409
410
  static inline struct gfs2_inode *GFS2_I(struct inode *inode)
  {
  	return container_of(inode, struct gfs2_inode, i_inode);
  }
bf36a7131   Steven Whitehouse   [GFS2] Add gfs2_i...
411
  static inline struct gfs2_sbd *GFS2_SB(const struct inode *inode)
feaa7bba0   Steven Whitehouse   [GFS2] Fix unlink...
412
413
414
  {
  	return inode->i_sb->s_fs_info;
  }
b3b94faa5   David Teigland   [GFS2] The core o...
415
  struct gfs2_file {
f55ab26a8   Steven Whitehouse   [GFS2] Use mutice...
416
  	struct mutex f_fl_mutex;
b3b94faa5   David Teigland   [GFS2] The core o...
417
  	struct gfs2_holder f_fl_gh;
b3b94faa5   David Teigland   [GFS2] The core o...
418
  };
b3b94faa5   David Teigland   [GFS2] The core o...
419
420
  struct gfs2_revoke_replay {
  	struct list_head rr_list;
cd915493f   Steven Whitehouse   [GFS2] Change all...
421
  	u64 rr_blkno;
b3b94faa5   David Teigland   [GFS2] The core o...
422
423
424
425
  	unsigned int rr_where;
  };
  
  enum {
b3b94faa5   David Teigland   [GFS2] The core o...
426
427
  	QDF_CHANGE		= 1,
  	QDF_LOCKED		= 2,
662e3a551   Abhijith Das   GFS2: quota allow...
428
  	QDF_REFRESH		= 3,
9cde2898d   Abhi Das   gfs2: limit quota...
429
  	QDF_QMSG_QUIET          = 4,
b3b94faa5   David Teigland   [GFS2] The core o...
430
431
432
  };
  
  struct gfs2_quota_data {
c754fbbb1   Steven Whitehouse   GFS2: Use RCU/hli...
433
  	struct hlist_bl_node qd_hlist;
b3b94faa5   David Teigland   [GFS2] The core o...
434
  	struct list_head qd_list;
2147dbfd0   Steven Whitehouse   GFS2: Use generic...
435
  	struct kqid qd_id;
c754fbbb1   Steven Whitehouse   GFS2: Use RCU/hli...
436
  	struct gfs2_sbd *qd_sbd;
9b9f039d5   Steven Whitehouse   GFS2: Use reflink...
437
  	struct lockref qd_lockref;
2147dbfd0   Steven Whitehouse   GFS2: Use generic...
438
  	struct list_head qd_lru;
c754fbbb1   Steven Whitehouse   GFS2: Use RCU/hli...
439
  	unsigned qd_hash;
b3b94faa5   David Teigland   [GFS2] The core o...
440

b3b94faa5   David Teigland   [GFS2] The core o...
441
  	unsigned long qd_flags;		/* QDF_... */
cd915493f   Steven Whitehouse   [GFS2] Change all...
442
443
  	s64 qd_change;
  	s64 qd_change_sync;
b3b94faa5   David Teigland   [GFS2] The core o...
444
445
446
447
448
449
450
451
452
453
  
  	unsigned int qd_slot;
  	unsigned int qd_slot_count;
  
  	struct buffer_head *qd_bh;
  	struct gfs2_quota_change *qd_bh_qc;
  	unsigned int qd_bh_count;
  
  	struct gfs2_glock *qd_gl;
  	struct gfs2_quota_lvb qd_qb;
cd915493f   Steven Whitehouse   [GFS2] Change all...
454
  	u64 qd_sync_gen;
b3b94faa5   David Teigland   [GFS2] The core o...
455
  	unsigned long qd_last_warn;
c754fbbb1   Steven Whitehouse   GFS2: Use RCU/hli...
456
  	struct rcu_head qd_rcu;
b3b94faa5   David Teigland   [GFS2] The core o...
457
  };
9862ca056   Bob Peterson   GFS2: Switch tr_t...
458
459
460
461
462
  enum {
  	TR_TOUCHED = 1,
  	TR_ATTACHED = 2,
  	TR_ALLOCED = 3,
  };
b3b94faa5   David Teigland   [GFS2] The core o...
463
  struct gfs2_trans {
d0dc80dba   Steven Whitehouse   [GFS2] Update deb...
464
  	unsigned long tr_ip;
b3b94faa5   David Teigland   [GFS2] The core o...
465
466
467
468
  
  	unsigned int tr_blocks;
  	unsigned int tr_revokes;
  	unsigned int tr_reserved;
9862ca056   Bob Peterson   GFS2: Switch tr_t...
469
  	unsigned long tr_flags;
b3b94faa5   David Teigland   [GFS2] The core o...
470

b3b94faa5   David Teigland   [GFS2] The core o...
471
  	unsigned int tr_num_buf_new;
2332c4435   Robert Peterson   [GFS2] assertion ...
472
  	unsigned int tr_num_databuf_new;
b3b94faa5   David Teigland   [GFS2] The core o...
473
  	unsigned int tr_num_buf_rm;
2332c4435   Robert Peterson   [GFS2] assertion ...
474
  	unsigned int tr_num_databuf_rm;
b3b94faa5   David Teigland   [GFS2] The core o...
475
  	unsigned int tr_num_revoke;
b3b94faa5   David Teigland   [GFS2] The core o...
476

16ca9412d   Benjamin Marzinski   GFS2: replace gfs...
477
  	struct list_head tr_list;
d69a3c656   Steven Whitehouse   GFS2: Move log bu...
478
479
  	struct list_head tr_databuf;
  	struct list_head tr_buf;
b3b94faa5   David Teigland   [GFS2] The core o...
480

16ca9412d   Benjamin Marzinski   GFS2: replace gfs...
481
482
483
  	unsigned int tr_first;
  	struct list_head tr_ail1_list;
  	struct list_head tr_ail2_list;
b3b94faa5   David Teigland   [GFS2] The core o...
484
  };
da6dd40d5   Bob Peterson   [GFS2] Journal ex...
485
  struct gfs2_journal_extent {
b50f227bd   Steven Whitehouse   GFS2: Clean up jo...
486
  	struct list_head list;
da6dd40d5   Bob Peterson   [GFS2] Journal ex...
487
488
489
490
491
  
  	unsigned int lblock; /* First logical block */
  	u64 dblock; /* First disk block */
  	u64 blocks;
  };
b3b94faa5   David Teigland   [GFS2] The core o...
492
493
  struct gfs2_jdesc {
  	struct list_head jd_list;
da6dd40d5   Bob Peterson   [GFS2] Journal ex...
494
  	struct list_head extent_list;
b50f227bd   Steven Whitehouse   GFS2: Clean up jo...
495
  	unsigned int nr_extents;
6ecd7c2dd   Tejun Heo   gfs2: use workque...
496
  	struct work_struct jd_work;
7359a19cc   Steven Whitehouse   [GFS2] Fix for ro...
497
  	struct inode *jd_inode;
fe64d517d   Steven Whitehouse   GFS2: Umount reco...
498
499
  	unsigned long jd_flags;
  #define JDF_RECOVERY 1
b3b94faa5   David Teigland   [GFS2] The core o...
500
  	unsigned int jd_jid;
7c70b8969   Bob Peterson   gfs2: clean_journ...
501
  	u32 jd_blocks;
376d37788   David Teigland   GFS2: fail mount ...
502
  	int jd_recover_error;
a17d758b6   Bob Peterson   GFS2: Move recove...
503
504
505
506
507
508
509
510
  	/* Replay stuff */
  
  	unsigned int jd_found_blocks;
  	unsigned int jd_found_revokes;
  	unsigned int jd_replayed_blocks;
  
  	struct list_head jd_revoke_list;
  	unsigned int jd_replay_tail;
b3b94faa5   David Teigland   [GFS2] The core o...
511
  };
bb8d8a6f5   Steven Whitehouse   [GFS2] Fix sign p...
512
513
514
515
516
  struct gfs2_statfs_change_host {
  	s64 sc_total;
  	s64 sc_free;
  	s64 sc_dinodes;
  };
b3b94faa5   David Teigland   [GFS2] The core o...
517
518
519
520
521
522
523
524
  #define GFS2_QUOTA_DEFAULT	GFS2_QUOTA_OFF
  #define GFS2_QUOTA_OFF		0
  #define GFS2_QUOTA_ACCOUNT	1
  #define GFS2_QUOTA_ON		2
  
  #define GFS2_DATA_DEFAULT	GFS2_DATA_ORDERED
  #define GFS2_DATA_WRITEBACK	1
  #define GFS2_DATA_ORDERED	2
d34843d0c   Bob Peterson   GFS2: Add "-o err...
525
526
527
528
529
  #define GFS2_ERRORS_DEFAULT     GFS2_ERRORS_WITHDRAW
  #define GFS2_ERRORS_WITHDRAW    0
  #define GFS2_ERRORS_CONTINUE    1 /* place holder for future feature */
  #define GFS2_ERRORS_RO          2 /* place holder for future feature */
  #define GFS2_ERRORS_PANIC       3
b3b94faa5   David Teigland   [GFS2] The core o...
530
  struct gfs2_args {
37ec89e83   Steven Whitehouse   GFS2: The war on ...
531
532
533
534
  	char ar_lockproto[GFS2_LOCKNAME_LEN];	/* Name of the Lock Protocol */
  	char ar_locktable[GFS2_LOCKNAME_LEN];	/* Name of the Lock Table */
  	char ar_hostdata[GFS2_LOCKNAME_LEN];	/* Host specific data */
  	unsigned int ar_spectator:1;		/* Don't get a journal */
37ec89e83   Steven Whitehouse   GFS2: The war on ...
535
  	unsigned int ar_localflocks:1;		/* Let the VFS do flock|fcntl */
37ec89e83   Steven Whitehouse   GFS2: The war on ...
536
  	unsigned int ar_debug:1;		/* Oops on errors */
37ec89e83   Steven Whitehouse   GFS2: The war on ...
537
538
539
540
541
  	unsigned int ar_posix_acl:1;		/* Enable posix acls */
  	unsigned int ar_quota:2;		/* off/account/on */
  	unsigned int ar_suiddir:1;		/* suiddir support */
  	unsigned int ar_data:2;			/* ordered/writeback */
  	unsigned int ar_meta:1;			/* mount metafs */
f15ab5619   Steven Whitehouse   GFS2: Support gen...
542
  	unsigned int ar_discard:1;		/* discard requests */
d34843d0c   Bob Peterson   GFS2: Add "-o err...
543
  	unsigned int ar_errors:2;               /* errors=withdraw | panic */
f25934c5f   Christoph Hellwig   GFS2: add barrier...
544
  	unsigned int ar_nobarrier:1;            /* do not send barriers */
90306c41d   Benjamin Marzinski   GFS2: Use lvbs fo...
545
  	unsigned int ar_rgrplvb:1;		/* use lvbs for rgrp info */
471f3db27   Benjamin Marzinski   gfs2: change gfs2...
546
547
  	unsigned int ar_loccookie:1;		/* use location based readdir
  						   cookies */
1f52aa08d   Andrew Price   gfs2: Convert gfs...
548
549
550
551
  	s32 ar_commit;				/* Commit interval */
  	s32 ar_statfs_quantum;			/* The fast statfs interval */
  	s32 ar_quota_quantum;			/* The quota interval */
  	s32 ar_statfs_percent;			/* The % change to force sync */
b3b94faa5   David Teigland   [GFS2] The core o...
552
553
554
555
  };
  
  struct gfs2_tune {
  	spinlock_t gt_spin;
b3b94faa5   David Teigland   [GFS2] The core o...
556
  	unsigned int gt_logd_secs;
b3b94faa5   David Teigland   [GFS2] The core o...
557

b3b94faa5   David Teigland   [GFS2] The core o...
558
559
560
  	unsigned int gt_quota_warn_period; /* Secs between quota warn msgs */
  	unsigned int gt_quota_scale_num; /* Numerator */
  	unsigned int gt_quota_scale_den; /* Denominator */
b3b94faa5   David Teigland   [GFS2] The core o...
561
  	unsigned int gt_quota_quantum; /* Secs between syncs to quota file */
b3b94faa5   David Teigland   [GFS2] The core o...
562
  	unsigned int gt_new_files_jdata;
b3b94faa5   David Teigland   [GFS2] The core o...
563
  	unsigned int gt_max_readahead; /* Max bytes to read-ahead from disk */
b3b94faa5   David Teigland   [GFS2] The core o...
564
  	unsigned int gt_complain_secs;
b3b94faa5   David Teigland   [GFS2] The core o...
565
566
567
  	unsigned int gt_statfs_quantum;
  	unsigned int gt_statfs_slow;
  };
b3b94faa5   David Teigland   [GFS2] The core o...
568
569
570
  enum {
  	SDF_JOURNAL_CHECKED	= 0,
  	SDF_JOURNAL_LIVE	= 1,
04aea0ca1   Bob Peterson   gfs2: Rename SDF_...
571
  	SDF_WITHDRAWN		= 2,
254db57f9   Steven Whitehouse   GFS2: Support for...
572
  	SDF_NOBARRIERS		= 3,
fe64d517d   Steven Whitehouse   GFS2: Umount reco...
573
  	SDF_NORECOVERY		= 4,
913a71d25   Steven Whitehouse   GFS2: Add some us...
574
  	SDF_DEMOTE		= 5,
ba6e93645   Steven Whitehouse   GFS2: Wait for jo...
575
  	SDF_NOJOURNALID		= 6,
e8ca5cc57   David Teigland   GFS2: let spectat...
576
  	SDF_RORECOVERY		= 7, /* read only recovery */
fb6791d10   David Teigland   GFS2: skip dlm_un...
577
  	SDF_SKIP_DLM_UNLOCK	= 8,
b066a4eeb   Abhi Das   gfs2: forcibly fl...
578
  	SDF_FORCE_AIL_FLUSH     = 9,
b524abcc0   Bob Peterson   gfs2: slow the de...
579
  	SDF_AIL1_IO_ERROR	= 10,
8f9182199   Abhi Das   gfs2: fix race be...
580
  	SDF_FS_FROZEN           = 11,
b3b94faa5   David Teigland   [GFS2] The core o...
581
  };
2e60d7683   Benjamin Marzinski   GFS2: update free...
582
583
584
585
586
  enum gfs2_freeze_state {
  	SFS_UNFROZEN		= 0,
  	SFS_STARTING_FREEZE	= 1,
  	SFS_FROZEN		= 2,
  };
b3b94faa5   David Teigland   [GFS2] The core o...
587
  #define GFS2_FSNAME_LEN		256
bb8d8a6f5   Steven Whitehouse   [GFS2] Fix sign p...
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
  struct gfs2_inum_host {
  	u64 no_formal_ino;
  	u64 no_addr;
  };
  
  struct gfs2_sb_host {
  	u32 sb_magic;
  	u32 sb_type;
  	u32 sb_format;
  
  	u32 sb_fs_format;
  	u32 sb_multihost_format;
  	u32 sb_bsize;
  	u32 sb_bsize_shift;
  
  	struct gfs2_inum_host sb_master_dir;
  	struct gfs2_inum_host sb_root_dir;
  
  	char sb_lockproto[GFS2_LOCKNAME_LEN];
  	char sb_locktable[GFS2_LOCKNAME_LEN];
  };
f057f6cdf   Steven Whitehouse   GFS2: Merge lock_...
609
610
611
612
613
614
615
616
617
618
  /*
   * lm_mount() return values
   *
   * ls_jid - the journal ID this node should use
   * ls_first - this node is the first to mount the file system
   * ls_lockspace - lock module's context for this file system
   * ls_ops - lock module's functions
   */
  
  struct lm_lockstruct {
feb47ca93   Steven Whitehouse   GFS2: Improve jou...
619
  	int ls_jid;
f057f6cdf   Steven Whitehouse   GFS2: Merge lock_...
620
  	unsigned int ls_first;
f057f6cdf   Steven Whitehouse   GFS2: Merge lock_...
621
  	const struct lm_lockops *ls_ops;
f057f6cdf   Steven Whitehouse   GFS2: Merge lock_...
622
  	dlm_lockspace_t *ls_dlm;
e0c2a9aa1   David Teigland   GFS2: dlm based r...
623
624
625
626
627
628
629
  	int ls_recover_jid_done;   /* These two are deprecated, */
  	int ls_recover_jid_status; /* used previously by gfs_controld */
  
  	struct dlm_lksb ls_mounted_lksb; /* mounted_lock */
  	struct dlm_lksb ls_control_lksb; /* control_lock */
  	char ls_control_lvb[GDLM_LVB_SIZE]; /* control_lock lvb */
  	struct completion ls_sync_wait; /* {control,mounted}_{lock,unlock} */
57c7310b8   David Teigland   GFS2: use kmalloc...
630
  	char *ls_lvb_bits;
e0c2a9aa1   David Teigland   GFS2: dlm based r...
631
632
633
634
635
636
637
638
639
  
  	spinlock_t ls_recover_spin; /* protects following fields */
  	unsigned long ls_recover_flags; /* DFL_ */
  	uint32_t ls_recover_mount; /* gen in first recover_done cb */
  	uint32_t ls_recover_start; /* gen in last recover_done cb */
  	uint32_t ls_recover_block; /* copy recover_start in last recover_prep */
  	uint32_t ls_recover_size; /* size of recover_submit, recover_result */
  	uint32_t *ls_recover_submit; /* gen in last recover_slot cb per jid */
  	uint32_t *ls_recover_result; /* result of last jid recovery */
f057f6cdf   Steven Whitehouse   GFS2: Merge lock_...
640
  };
a245769f2   Steven Whitehouse   GFS2: glock stati...
641
642
643
644
  struct gfs2_pcpu_lkstats {
  	/* One struct for each glock type */
  	struct gfs2_lkstats lkstats[10];
  };
b3b94faa5   David Teigland   [GFS2] The core o...
645
646
  struct gfs2_sbd {
  	struct super_block *sd_vfs;
a245769f2   Steven Whitehouse   GFS2: glock stati...
647
  	struct gfs2_pcpu_lkstats __percpu *sd_lkstats;
b3b94faa5   David Teigland   [GFS2] The core o...
648
649
  	struct kobject sd_kobj;
  	unsigned long sd_flags;	/* SDF_... */
f50dfaf78   Al Viro   [GFS2] split gfs2_sb
650
  	struct gfs2_sb_host sd_sb;
b3b94faa5   David Teigland   [GFS2] The core o...
651
652
  
  	/* Constants computed on mount */
cd915493f   Steven Whitehouse   [GFS2] Change all...
653
654
655
656
657
658
659
660
661
  	u32 sd_fsb2bb;
  	u32 sd_fsb2bb_shift;
  	u32 sd_diptrs;	/* Number of pointers in a dinode */
  	u32 sd_inptrs;	/* Number of pointers in a indirect block */
  	u32 sd_jbsize;	/* Size of a journaled data block */
  	u32 sd_hash_bsize;	/* sizeof(exhash block) */
  	u32 sd_hash_bsize_shift;
  	u32 sd_hash_ptrs;	/* Number of pointers in a hash block */
  	u32 sd_qc_per_block;
a68a0a352   Bob Peterson   GFS2: Speed up gf...
662
  	u32 sd_blocks_per_bitmap;
cd915493f   Steven Whitehouse   [GFS2] Change all...
663
664
  	u32 sd_max_dirres;	/* Max blocks needed to add a directory entry */
  	u32 sd_max_height;	/* Max height of a file's metadata tree */
ecc30c791   Steven Whitehouse   [GFS2] Streamline...
665
  	u64 sd_heightsize[GFS2_MAX_META_HEIGHT + 1];
471f3db27   Benjamin Marzinski   gfs2: change gfs2...
666
  	u32 sd_max_dents_per_leaf; /* Max number of dirents in a leaf block */
b3b94faa5   David Teigland   [GFS2] The core o...
667
668
669
670
671
672
673
  
  	struct gfs2_args sd_args;	/* Mount arguments */
  	struct gfs2_tune sd_tune;	/* Filesystem tuning structure */
  
  	/* Lock Stuff */
  
  	struct lm_lockstruct sd_lockstruct;
b3b94faa5   David Teigland   [GFS2] The core o...
674
675
  	struct gfs2_holder sd_live_gh;
  	struct gfs2_glock *sd_rename_gl;
24972557b   Benjamin Marzinski   GFS2: remove tran...
676
  	struct gfs2_glock *sd_freeze_gl;
2e60d7683   Benjamin Marzinski   GFS2: update free...
677
  	struct work_struct sd_freeze_work;
e402746a9   Steven Whitehouse   GFS2: Wait for un...
678
  	wait_queue_head_t sd_glock_wait;
ad26967b9   Bob Peterson   gfs2: Use async g...
679
  	wait_queue_head_t sd_async_glock_wait;
e402746a9   Steven Whitehouse   GFS2: Wait for un...
680
  	atomic_t sd_glock_disposal;
3942ae531   Steven Whitehouse   GFS2: Fix race du...
681
  	struct completion sd_locking_init;
fd95e81cb   Steven Whitehouse   GFS2: Reinstate w...
682
  	struct completion sd_wdack;
e0c2a9aa1   David Teigland   GFS2: dlm based r...
683
  	struct delayed_work sd_control_work;
b3b94faa5   David Teigland   [GFS2] The core o...
684
685
  
  	/* Inode Stuff */
9b8df98fc   Steven Whitehouse   GFS2: Fix metafs ...
686
687
  	struct dentry *sd_master_dir;
  	struct dentry *sd_root_dir;
f42faf4fa   Steven Whitehouse   [GFS2] Add gfs2_i...
688
  	struct inode *sd_jindex;
f42faf4fa   Steven Whitehouse   [GFS2] Add gfs2_i...
689
  	struct inode *sd_statfs_inode;
f42faf4fa   Steven Whitehouse   [GFS2] Add gfs2_i...
690
  	struct inode *sd_sc_inode;
f42faf4fa   Steven Whitehouse   [GFS2] Add gfs2_i...
691
692
693
  	struct inode *sd_qc_inode;
  	struct inode *sd_rindex;
  	struct inode *sd_quota_inode;
b3b94faa5   David Teigland   [GFS2] The core o...
694

b3b94faa5   David Teigland   [GFS2] The core o...
695
696
697
  	/* StatFS stuff */
  
  	spinlock_t sd_statfs_spin;
bd209cc01   Al Viro   [GFS2] split and ...
698
699
  	struct gfs2_statfs_change_host sd_statfs_master;
  	struct gfs2_statfs_change_host sd_statfs_local;
3d3c10f2c   Benjamin Marzinski   GFS2: Improve sta...
700
  	int sd_statfs_force_sync;
b3b94faa5   David Teigland   [GFS2] The core o...
701
702
  
  	/* Resource group stuff */
cf45b752c   Bob Peterson   [GFS2] Remove rgr...
703
  	int sd_rindex_uptodate;
b3b94faa5   David Teigland   [GFS2] The core o...
704
  	spinlock_t sd_rindex_spin;
7c9ca6211   Bob Peterson   GFS2: Use rbtree ...
705
  	struct rb_root sd_rindex_tree;
b3b94faa5   David Teigland   [GFS2] The core o...
706
  	unsigned int sd_rgrps;
3921120e7   Benjamin Marzinski   GFS2: fallocate s...
707
  	unsigned int sd_max_rg_data;
b3b94faa5   David Teigland   [GFS2] The core o...
708
709
710
711
712
  
  	/* Journal index stuff */
  
  	struct list_head sd_jindex_list;
  	spinlock_t sd_jindex_spin;
f55ab26a8   Steven Whitehouse   [GFS2] Use mutice...
713
  	struct mutex sd_jindex_mutex;
b3b94faa5   David Teigland   [GFS2] The core o...
714
  	unsigned int sd_journals;
b3b94faa5   David Teigland   [GFS2] The core o...
715
716
717
718
  
  	struct gfs2_jdesc *sd_jdesc;
  	struct gfs2_holder sd_journal_gh;
  	struct gfs2_holder sd_jinode_gh;
b3b94faa5   David Teigland   [GFS2] The core o...
719
  	struct gfs2_holder sd_sc_gh;
b3b94faa5   David Teigland   [GFS2] The core o...
720
  	struct gfs2_holder sd_qc_gh;
0e48e055a   Bob Peterson   GFS2: Prevent rec...
721
  	struct completion sd_journal_ready;
b3b94faa5   David Teigland   [GFS2] The core o...
722
  	/* Daemon stuff */
b3b94faa5   David Teigland   [GFS2] The core o...
723
724
  	struct task_struct *sd_logd_process;
  	struct task_struct *sd_quotad_process;
b3b94faa5   David Teigland   [GFS2] The core o...
725

b3b94faa5   David Teigland   [GFS2] The core o...
726
727
728
729
  	/* Quota stuff */
  
  	struct list_head sd_quota_list;
  	atomic_t sd_quota_count;
f55ab26a8   Steven Whitehouse   [GFS2] Use mutice...
730
  	struct mutex sd_quota_mutex;
e46c772db   Steven Whitehouse   GFS2: Protect quo...
731
  	struct mutex sd_quota_sync_mutex;
37b2c8377   Steven Whitehouse   GFS2: Clean up & ...
732
  	wait_queue_head_t sd_quota_wait;
813e0c46c   Steven Whitehouse   GFS2: Fix "trunca...
733
734
  	struct list_head sd_trunc_list;
  	spinlock_t sd_trunc_lock;
b3b94faa5   David Teigland   [GFS2] The core o...
735
736
  
  	unsigned int sd_quota_slots;
ee2411a8d   Steven Whitehouse   GFS2: Clean up qu...
737
  	unsigned long *sd_quota_bitmap;
2d9e72303   Steven Whitehouse   GFS2: Move quota ...
738
  	spinlock_t sd_bitmap_lock;
b3b94faa5   David Teigland   [GFS2] The core o...
739

cd915493f   Steven Whitehouse   [GFS2] Change all...
740
  	u64 sd_quota_sync_gen;
b3b94faa5   David Teigland   [GFS2] The core o...
741
742
  
  	/* Log stuff */
70d4ee94b   Steven Whitehouse   GFS2: Use only a ...
743
  	struct address_space sd_aspace;
b3b94faa5   David Teigland   [GFS2] The core o...
744
  	spinlock_t sd_log_lock;
b3b94faa5   David Teigland   [GFS2] The core o...
745

16ca9412d   Benjamin Marzinski   GFS2: replace gfs...
746
  	struct gfs2_trans *sd_log_tr;
b3b94faa5   David Teigland   [GFS2] The core o...
747
  	unsigned int sd_log_blks_reserved;
2e95e3f66   Benjamin Marzinski   GFS2: Allow the n...
748
  	int sd_log_commited_revoke;
b3b94faa5   David Teigland   [GFS2] The core o...
749

5e687eac1   Benjamin Marzinski   GFS2: Various gfs...
750
  	atomic_t sd_log_pinned;
b3b94faa5   David Teigland   [GFS2] The core o...
751
  	unsigned int sd_log_num_revoke;
f42faf4fa   Steven Whitehouse   [GFS2] Add gfs2_i...
752

a5b1d3fc5   Andreas Gruenbacher   gfs2: Rename sd_l...
753
754
  	struct list_head sd_log_revokes;
  	struct list_head sd_log_ordered;
451389909   Steven Whitehouse   GFS2: Use ->write...
755
  	spinlock_t sd_ordered_lock;
b3b94faa5   David Teigland   [GFS2] The core o...
756

5e687eac1   Benjamin Marzinski   GFS2: Various gfs...
757
758
  	atomic_t sd_log_thresh1;
  	atomic_t sd_log_thresh2;
fd041f0b4   Steven Whitehouse   [GFS2] Use atomic...
759
  	atomic_t sd_log_blks_free;
f07b35202   Bob Peterson   GFS2: Made logd d...
760
  	atomic_t sd_log_blks_needed;
5e687eac1   Benjamin Marzinski   GFS2: Various gfs...
761
762
  	wait_queue_head_t sd_log_waitq;
  	wait_queue_head_t sd_logd_waitq;
b3b94faa5   David Teigland   [GFS2] The core o...
763

cd915493f   Steven Whitehouse   [GFS2] Change all...
764
  	u64 sd_log_sequence;
b3b94faa5   David Teigland   [GFS2] The core o...
765
766
  	unsigned int sd_log_head;
  	unsigned int sd_log_tail;
b3b94faa5   David Teigland   [GFS2] The core o...
767
  	int sd_log_idle;
484adff8a   Steven Whitehouse   [GFS2] Update loc...
768
  	struct rw_semaphore sd_log_flush_lock;
16615be18   Steven Whitehouse   [GFS2] Clean up j...
769
  	atomic_t sd_log_in_flight;
e8c92ed76   Steven Whitehouse   GFS2: Clean up lo...
770
  	struct bio *sd_log_bio;
16615be18   Steven Whitehouse   [GFS2] Clean up j...
771
  	wait_queue_head_t sd_log_flush_wait;
942b0cddf   Bob Peterson   GFS2: Withdraw fo...
772
  	int sd_log_error;
b3b94faa5   David Teigland   [GFS2] The core o...
773

2e60d7683   Benjamin Marzinski   GFS2: update free...
774
775
  	atomic_t sd_reserving_log;
  	wait_queue_head_t sd_reserving_log_wait;
b3b94faa5   David Teigland   [GFS2] The core o...
776
  	unsigned int sd_log_flush_head;
b3b94faa5   David Teigland   [GFS2] The core o...
777

d6a079e82   Dave Chinner   GFS2: introduce A...
778
  	spinlock_t sd_ail_lock;
b3b94faa5   David Teigland   [GFS2] The core o...
779
780
  	struct list_head sd_ail1_list;
  	struct list_head sd_ail2_list;
b3b94faa5   David Teigland   [GFS2] The core o...
781

b3b94faa5   David Teigland   [GFS2] The core o...
782
  	/* For quiescing the filesystem */
b3b94faa5   David Teigland   [GFS2] The core o...
783
  	struct gfs2_holder sd_freeze_gh;
2e60d7683   Benjamin Marzinski   GFS2: update free...
784
785
  	atomic_t sd_freeze_state;
  	struct mutex sd_freeze_mutex;
b3b94faa5   David Teigland   [GFS2] The core o...
786

561b79698   Andreas Gruenbacher   gfs2: Silence gcc...
787
  	char sd_fsname[GFS2_FSNAME_LEN + 3 * sizeof(int) + 2];
b3b94faa5   David Teigland   [GFS2] The core o...
788
789
790
791
792
793
  	char sd_table_name[GFS2_FSNAME_LEN];
  	char sd_proto_name[GFS2_FSNAME_LEN];
  
  	/* Debugging crud */
  
  	unsigned long sd_last_warning;
5f8820960   Robert Peterson   [GFS2] lockdump i...
794
  	struct dentry *debugfs_dir;    /* debugfs directory */
b3b94faa5   David Teigland   [GFS2] The core o...
795
  };
a245769f2   Steven Whitehouse   GFS2: glock stati...
796
797
798
799
800
801
802
  static inline void gfs2_glstats_inc(struct gfs2_glock *gl, int which)
  {
  	gl->gl_stats.stats[which]++;
  }
  
  static inline void gfs2_sbstats_inc(const struct gfs2_glock *gl, int which)
  {
15562c439   Bob Peterson   GFS2: Move glock ...
803
  	const struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
a245769f2   Steven Whitehouse   GFS2: glock stati...
804
805
806
807
  	preempt_disable();
  	this_cpu_ptr(sdp->sd_lkstats)->lkstats[gl->gl_name.ln_type].stats[which]++;
  	preempt_enable();
  }
6f6597baa   Andreas Gruenbacher   gfs2: Protect gl-...
808
  extern struct gfs2_rgrpd *gfs2_glock2rgrp(struct gfs2_glock *gl);
235628c5c   Andreas Gruenbacher   gfs2: Add gfs2_ma...
809
810
811
812
  static inline unsigned gfs2_max_stuffed_size(const struct gfs2_inode *ip)
  {
  	return GFS2_SB(&ip->i_inode)->sd_sb.sb_bsize - sizeof(struct gfs2_dinode);
  }
b3b94faa5   David Teigland   [GFS2] The core o...
813
  #endif /* __INCORE_DOT_H__ */