Blame view
fs/gfs2/incore.h
23.3 KB
7336d0e65
|
1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
b3b94faa5
|
2 3 |
/* * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. |
29d38cd16
|
4 |
* Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. |
b3b94faa5
|
5 6 7 8 |
*/ #ifndef __INCORE_DOT_H__ #define __INCORE_DOT_H__ |
f2f7ba523
|
9 |
#include <linux/fs.h> |
57cc7215b
|
10 |
#include <linux/kobject.h> |
c4f68a130
|
11 |
#include <linux/workqueue.h> |
f057f6cdf
|
12 13 |
#include <linux/dlm.h> #include <linux/buffer_head.h> |
bc015cb84
|
14 15 |
#include <linux/rcupdate.h> #include <linux/rculist_bl.h> |
3942ae531
|
16 |
#include <linux/completion.h> |
7c9ca6211
|
17 |
#include <linux/rbtree.h> |
a245769f2
|
18 19 |
#include <linux/ktime.h> #include <linux/percpu.h> |
e66cf1610
|
20 |
#include <linux/lockref.h> |
88ffbf3e0
|
21 |
#include <linux/rhashtable.h> |
f2f7ba523
|
22 |
|
b3b94faa5
|
23 24 |
#define DIO_WAIT 0x00000010 #define DIO_METADATA 0x00000020 |
b3b94faa5
|
25 26 |
struct gfs2_log_operations; |
c0752aa7e
|
27 |
struct gfs2_bufdata; |
b3b94faa5
|
28 29 |
struct gfs2_holder; struct gfs2_glock; |
b3b94faa5
|
30 |
struct gfs2_quota_data; |
b3b94faa5
|
31 |
struct gfs2_trans; |
b3b94faa5
|
32 |
struct gfs2_jdesc; |
b3b94faa5
|
33 |
struct gfs2_sbd; |
f057f6cdf
|
34 |
struct lm_lockops; |
b3b94faa5
|
35 36 |
typedef void (*gfs2_glop_bh_t) (struct gfs2_glock *gl, unsigned int ret); |
bb8d8a6f5
|
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
|
42 |
}; |
b3b94faa5
|
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
|
49 |
void (*lo_before_commit) (struct gfs2_sbd *sdp, struct gfs2_trans *tr); |
16ca9412d
|
50 |
void (*lo_after_commit) (struct gfs2_sbd *sdp, struct gfs2_trans *tr); |
b3b94faa5
|
51 |
void (*lo_before_scan) (struct gfs2_jdesc *jd, |
551676226
|
52 |
struct gfs2_log_header_host *head, int pass); |
b3b94faa5
|
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
|
57 |
const char *lo_name; |
b3b94faa5
|
58 |
}; |
60a0b8f93
|
59 |
#define GBF_FULL 1 |
dffe12a82
|
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
|
81 82 83 |
struct gfs2_bitmap { struct buffer_head *bi_bh; char *bi_clone; |
60a0b8f93
|
84 |
unsigned long bi_flags; |
cd915493f
|
85 86 |
u32 bi_offset; u32 bi_start; |
281b4952d
|
87 |
u32 bi_bytes; |
7e230f577
|
88 |
u32 bi_blocks; |
b3b94faa5
|
89 90 91 |
}; struct gfs2_rgrpd { |
7c9ca6211
|
92 |
struct rb_node rd_node; /* Link with superblock */ |
b3b94faa5
|
93 |
struct gfs2_glock *rd_gl; /* Glock for this rgrp */ |
bb8d8a6f5
|
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
|
99 |
u32 rd_free; |
8e2e00473
|
100 |
u32 rd_reserved; /* number of blocks reserved */ |
73f749483
|
101 102 |
u32 rd_free_clone; u32 rd_dinodes; |
d8b71f738
|
103 |
u64 rd_igeneration; |
b3b94faa5
|
104 |
struct gfs2_bitmap *rd_bits; |
b3b94faa5
|
105 |
struct gfs2_sbd *rd_sbd; |
90306c41d
|
106 |
struct gfs2_rgrp_lvb *rd_rgl; |
73f749483
|
107 |
u32 rd_last_alloc; |
1ce97e564
|
108 |
u32 rd_flags; |
5ea5050ce
|
109 |
u32 rd_extfail_pt; /* extent failure point */ |
090109783
|
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
|
113 |
#define GFS2_RDF_PREFERRED 0x80000000 /* This rgrp is preferred */ |
090109783
|
114 |
#define GFS2_RDF_MASK 0xf0000000 /* mask for internal flags */ |
8e2e00473
|
115 116 |
spinlock_t rd_rsspin; /* protects reservation related vars */ struct rb_root rd_rstree; /* multi-block reservation tree */ |
b3b94faa5
|
117 |
}; |
4a993fb15
|
118 119 |
struct gfs2_rbm { struct gfs2_rgrpd *rgd; |
4a993fb15
|
120 |
u32 offset; /* The offset is bitmap relative */ |
e579ed4f4
|
121 |
int bii; /* Bitmap index */ |
4a993fb15
|
122 |
}; |
e579ed4f4
|
123 124 125 126 |
static inline struct gfs2_bitmap *rbm_bi(const struct gfs2_rbm *rbm) { return rbm->rgd->rd_bits + rbm->bii; } |
4a993fb15
|
127 128 |
static inline u64 gfs2_rbm_to_block(const struct gfs2_rbm *rbm) { |
dc8fbb03d
|
129 |
BUG_ON(rbm->offset >= rbm->rgd->rd_data); |
e579ed4f4
|
130 131 |
return rbm->rgd->rd_data0 + (rbm_bi(rbm)->bi_start * GFS2_NBBY) + rbm->offset; |
4a993fb15
|
132 |
} |
5b924ae2d
|
133 134 135 |
static inline bool gfs2_rbm_eq(const struct gfs2_rbm *rbm1, const struct gfs2_rbm *rbm2) { |
e579ed4f4
|
136 |
return (rbm1->rgd == rbm2->rgd) && (rbm1->bii == rbm2->bii) && |
5b924ae2d
|
137 138 |
(rbm1->offset == rbm2->offset); } |
b3b94faa5
|
139 140 |
enum gfs2_state_bits { BH_Pinned = BH_PrivateStart, |
f42faf4fa
|
141 |
BH_Escaped = BH_PrivateStart + 1, |
b3b94faa5
|
142 143 144 145 |
}; BUFFER_FNS(Pinned, pinned) TAS_BUFFER_FNS(Pinned, pinned) |
f42faf4fa
|
146 147 |
BUFFER_FNS(Escaped, escaped) TAS_BUFFER_FNS(Escaped, escaped) |
b3b94faa5
|
148 149 150 151 |
struct gfs2_bufdata { struct buffer_head *bd_bh; struct gfs2_glock *bd_gl; |
c50b91c4b
|
152 |
u64 bd_blkno; |
82e86087b
|
153 |
|
c0752aa7e
|
154 |
struct list_head bd_list; |
b3b94faa5
|
155 |
|
16ca9412d
|
156 |
struct gfs2_trans *bd_tr; |
b3b94faa5
|
157 158 159 |
struct list_head bd_ail_st_list; struct list_head bd_ail_gl_list; }; |
f057f6cdf
|
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
|
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
|
197 198 |
enum { DFL_BLOCK_LOCKS = 0, |
e0c2a9aa1
|
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
|
205 |
}; |
972b044ee
|
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
|
210 211 |
struct lm_lockname { u64 ln_number; |
972b044ee
|
212 |
struct gfs2_sbd *ln_sbd; |
f057f6cdf
|
213 |
unsigned int ln_type; |
972b044ee
|
214 |
}; |
f057f6cdf
|
215 216 |
#define lm_name_equal(name1, name2) \ |
15562c439
|
217 218 219 |
(((name1)->ln_number == (name2)->ln_number) && \ ((name1)->ln_type == (name2)->ln_type) && \ ((name1)->ln_sbd == (name2)->ln_sbd)) |
f057f6cdf
|
220 |
|
b3b94faa5
|
221 |
struct gfs2_glock_operations { |
06dfc3064
|
222 |
void (*go_sync) (struct gfs2_glock *gl); |
6802e3400
|
223 |
int (*go_xmote_bh) (struct gfs2_glock *gl, struct gfs2_holder *gh); |
1a14d3a68
|
224 |
void (*go_inval) (struct gfs2_glock *gl, int flags); |
97cc1025b
|
225 |
int (*go_demote_ok) (const struct gfs2_glock *gl); |
1a14d3a68
|
226 227 |
int (*go_lock) (struct gfs2_holder *gh); void (*go_unlock) (struct gfs2_holder *gh); |
3792ce973
|
228 229 |
void (*go_dump)(struct seq_file *seq, struct gfs2_glock *gl, const char *fs_id_buf); |
81ffbf654
|
230 |
void (*go_callback)(struct gfs2_glock *gl, bool remote); |
8fb4b536e
|
231 |
const int go_type; |
009d85183
|
232 233 |
const unsigned long go_flags; #define GLOF_ASPACE 1 |
dba2d70c5
|
234 |
#define GLOF_LVB 2 |
e7ccaf5fe
|
235 |
#define GLOF_LRU 4 |
b3b94faa5
|
236 237 238 |
}; enum { |
a245769f2
|
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
|
251 |
u64 stats[GFS2_NR_LKSTATS]; |
a245769f2
|
252 253 254 |
}; enum { |
b3b94faa5
|
255 |
/* States */ |
6802e3400
|
256 |
HIF_HOLDER = 6, /* Set for gh that "holds" the glock */ |
b3b94faa5
|
257 |
HIF_FIRST = 7, |
fee852e37
|
258 |
HIF_WAIT = 10, |
b3b94faa5
|
259 260 261 262 263 264 |
}; struct gfs2_holder { struct list_head gh_list; struct gfs2_glock *gh_gl; |
b1e058da5
|
265 |
struct pid *gh_owner_pid; |
b58bf407c
|
266 267 |
u16 gh_flags; u16 gh_state; |
b3b94faa5
|
268 269 |
int gh_error; |
6802e3400
|
270 |
unsigned long gh_iflags; /* HIF_... */ |
d0dc80dba
|
271 |
unsigned long gh_ip; |
b3b94faa5
|
272 |
}; |
a937cca27
|
273 274 |
/* Number of quota types we support */ #define GFS2_MAXQUOTAS 2 |
b54e9a0b9
|
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
|
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
|
291 |
struct rb_node rs_node; /* link to other block reservations */ |
9e733d392
|
292 |
struct gfs2_rbm rs_rbm; /* Start of reservation */ |
8e2e00473
|
293 |
u32 rs_free; /* how many blocks are still free */ |
8e2e00473
|
294 |
}; |
7b9cff467
|
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
|
305 |
u64 target; |
25435e5ed
|
306 |
u32 min_target; |
7b9cff467
|
307 |
u32 aflags; |
25435e5ed
|
308 |
u64 allowed; |
7b9cff467
|
309 |
}; |
b3b94faa5
|
310 |
enum { |
6802e3400
|
311 |
GLF_LOCK = 1, |
6802e3400
|
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
|
319 320 |
GLF_INITIAL = 10, GLF_FROZEN = 11, |
7b5e3d5fc
|
321 |
GLF_QUEUED = 12, |
627c10b7e
|
322 323 |
GLF_LRU = 13, GLF_OBJECT = 14, /* Used only for tracing */ |
a245769f2
|
324 |
GLF_BLOCKING = 15, |
a4923865e
|
325 |
GLF_INODE_CREATING = 16, /* Inode creation occurring */ |
b3b94faa5
|
326 327 328 |
}; struct gfs2_glock { |
b3b94faa5
|
329 330 |
unsigned long gl_flags; /* GLF_... */ struct lm_lockname gl_name; |
b3b94faa5
|
331 |
|
e66cf1610
|
332 |
struct lockref gl_lockref; |
b3b94faa5
|
333 |
|
f3dd16491
|
334 |
/* State fields protected by gl_lockref.lock */ |
47a25380e
|
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
|
340 |
unsigned long gl_demote_time; /* time of first demote request */ |
7cf8dcd3b
|
341 |
long gl_hold_time; |
b3b94faa5
|
342 |
struct list_head gl_holders; |
b3b94faa5
|
343 |
|
8fb4b536e
|
344 |
const struct gfs2_glock_operations *gl_ops; |
a245769f2
|
345 346 |
ktime_t gl_dstamp; struct gfs2_lkstats gl_stats; |
f057f6cdf
|
347 |
struct dlm_lksb gl_lksb; |
c4f68a130
|
348 |
unsigned long gl_tchange; |
b3b94faa5
|
349 |
void *gl_object; |
97cc1025b
|
350 |
struct list_head gl_lru; |
b3b94faa5
|
351 352 |
struct list_head gl_ail_list; atomic_t gl_ail_count; |
638803d45
|
353 |
atomic_t gl_revokes; |
c4f68a130
|
354 |
struct delayed_work gl_work; |
7005c3e4a
|
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
|
364 |
struct rcu_head gl_rcu; |
88ffbf3e0
|
365 |
struct rhash_head gl_node; |
b3b94faa5
|
366 |
}; |
da755fdb4
|
367 |
#define GFS2_MIN_LVB_SIZE 32 /* Min size of LVB that gfs2 supports */ |
b3b94faa5
|
368 |
enum { |
bfded27ba
|
369 |
GIF_INVALID = 0, |
b3b94faa5
|
370 |
GIF_QD_LOCKED = 1, |
40ac218f5
|
371 |
GIF_ALLOC_FAILED = 2, |
b3b94faa5
|
372 |
GIF_SW_PAGED = 3, |
451389909
|
373 |
GIF_ORDERED = 4, |
059788039
|
374 |
GIF_FREE_VFS_INODE = 5, |
4fd1a5795
|
375 |
GIF_GLOP_PENDING = 6, |
b3b94faa5
|
376 377 378 |
}; struct gfs2_inode { |
320dd101e
|
379 |
struct inode i_inode; |
dbb7cae2a
|
380 381 |
u64 i_no_addr; u64 i_no_formal_ino; |
bcf0b5b34
|
382 |
u64 i_generation; |
3767ac21f
|
383 |
u64 i_eattr; |
b3b94faa5
|
384 |
unsigned long i_flags; /* GIF_... */ |
feaa7bba0
|
385 |
struct gfs2_glock *i_gl; /* Move into i_gh? */ |
b3b94faa5
|
386 |
struct gfs2_holder i_iopen_gh; |
f42faf4fa
|
387 |
struct gfs2_holder i_gh; /* for prepare/commit_write only */ |
b54e9a0b9
|
388 |
struct gfs2_qadata *i_qadata; /* quota allocation data */ |
21f09c439
|
389 |
struct gfs2_holder i_rgd_gh; |
a097dc7e2
|
390 |
struct gfs2_blkreserv i_res; /* rgrp multi-block reservation */ |
ce276b06e
|
391 |
u64 i_goal; /* goal block for allocations */ |
21f09c439
|
392 |
atomic_t i_sizehint; /* hint of the write size */ |
b3b94faa5
|
393 |
struct rw_semaphore i_rw_mutex; |
451389909
|
394 |
struct list_head i_ordered; |
813e0c46c
|
395 |
struct list_head i_trunc_list; |
17d539f04
|
396 |
__be64 *i_hash_cache; |
ad6203f2b
|
397 |
u32 i_entries; |
383f01fbf
|
398 |
u32 i_diskflags; |
ecc30c791
|
399 |
u8 i_height; |
9a0045088
|
400 |
u8 i_depth; |
c8d577038
|
401 |
u16 i_rahead; |
b3b94faa5
|
402 |
}; |
feaa7bba0
|
403 404 405 406 |
/* * Since i_inode is the first element of struct gfs2_inode, * this is effectively a cast. */ |
320dd101e
|
407 408 409 410 |
static inline struct gfs2_inode *GFS2_I(struct inode *inode) { return container_of(inode, struct gfs2_inode, i_inode); } |
bf36a7131
|
411 |
static inline struct gfs2_sbd *GFS2_SB(const struct inode *inode) |
feaa7bba0
|
412 413 414 |
{ return inode->i_sb->s_fs_info; } |
b3b94faa5
|
415 |
struct gfs2_file { |
f55ab26a8
|
416 |
struct mutex f_fl_mutex; |
b3b94faa5
|
417 |
struct gfs2_holder f_fl_gh; |
b3b94faa5
|
418 |
}; |
b3b94faa5
|
419 420 |
struct gfs2_revoke_replay { struct list_head rr_list; |
cd915493f
|
421 |
u64 rr_blkno; |
b3b94faa5
|
422 423 424 425 |
unsigned int rr_where; }; enum { |
b3b94faa5
|
426 427 |
QDF_CHANGE = 1, QDF_LOCKED = 2, |
662e3a551
|
428 |
QDF_REFRESH = 3, |
9cde2898d
|
429 |
QDF_QMSG_QUIET = 4, |
b3b94faa5
|
430 431 432 |
}; struct gfs2_quota_data { |
c754fbbb1
|
433 |
struct hlist_bl_node qd_hlist; |
b3b94faa5
|
434 |
struct list_head qd_list; |
2147dbfd0
|
435 |
struct kqid qd_id; |
c754fbbb1
|
436 |
struct gfs2_sbd *qd_sbd; |
9b9f039d5
|
437 |
struct lockref qd_lockref; |
2147dbfd0
|
438 |
struct list_head qd_lru; |
c754fbbb1
|
439 |
unsigned qd_hash; |
b3b94faa5
|
440 |
|
b3b94faa5
|
441 |
unsigned long qd_flags; /* QDF_... */ |
cd915493f
|
442 443 |
s64 qd_change; s64 qd_change_sync; |
b3b94faa5
|
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
|
454 |
u64 qd_sync_gen; |
b3b94faa5
|
455 |
unsigned long qd_last_warn; |
c754fbbb1
|
456 |
struct rcu_head qd_rcu; |
b3b94faa5
|
457 |
}; |
9862ca056
|
458 459 460 461 462 |
enum { TR_TOUCHED = 1, TR_ATTACHED = 2, TR_ALLOCED = 3, }; |
b3b94faa5
|
463 |
struct gfs2_trans { |
d0dc80dba
|
464 |
unsigned long tr_ip; |
b3b94faa5
|
465 466 467 468 |
unsigned int tr_blocks; unsigned int tr_revokes; unsigned int tr_reserved; |
9862ca056
|
469 |
unsigned long tr_flags; |
b3b94faa5
|
470 |
|
b3b94faa5
|
471 |
unsigned int tr_num_buf_new; |
2332c4435
|
472 |
unsigned int tr_num_databuf_new; |
b3b94faa5
|
473 |
unsigned int tr_num_buf_rm; |
2332c4435
|
474 |
unsigned int tr_num_databuf_rm; |
b3b94faa5
|
475 |
unsigned int tr_num_revoke; |
b3b94faa5
|
476 |
|
16ca9412d
|
477 |
struct list_head tr_list; |
d69a3c656
|
478 479 |
struct list_head tr_databuf; struct list_head tr_buf; |
b3b94faa5
|
480 |
|
16ca9412d
|
481 482 483 |
unsigned int tr_first; struct list_head tr_ail1_list; struct list_head tr_ail2_list; |
b3b94faa5
|
484 |
}; |
da6dd40d5
|
485 |
struct gfs2_journal_extent { |
b50f227bd
|
486 |
struct list_head list; |
da6dd40d5
|
487 488 489 490 491 |
unsigned int lblock; /* First logical block */ u64 dblock; /* First disk block */ u64 blocks; }; |
b3b94faa5
|
492 493 |
struct gfs2_jdesc { struct list_head jd_list; |
da6dd40d5
|
494 |
struct list_head extent_list; |
b50f227bd
|
495 |
unsigned int nr_extents; |
6ecd7c2dd
|
496 |
struct work_struct jd_work; |
7359a19cc
|
497 |
struct inode *jd_inode; |
fe64d517d
|
498 499 |
unsigned long jd_flags; #define JDF_RECOVERY 1 |
b3b94faa5
|
500 |
unsigned int jd_jid; |
7c70b8969
|
501 |
u32 jd_blocks; |
376d37788
|
502 |
int jd_recover_error; |
a17d758b6
|
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
|
511 |
}; |
bb8d8a6f5
|
512 513 514 515 516 |
struct gfs2_statfs_change_host { s64 sc_total; s64 sc_free; s64 sc_dinodes; }; |
b3b94faa5
|
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
|
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
|
530 |
struct gfs2_args { |
37ec89e83
|
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
|
535 |
unsigned int ar_localflocks:1; /* Let the VFS do flock|fcntl */ |
37ec89e83
|
536 |
unsigned int ar_debug:1; /* Oops on errors */ |
37ec89e83
|
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
|
542 |
unsigned int ar_discard:1; /* discard requests */ |
d34843d0c
|
543 |
unsigned int ar_errors:2; /* errors=withdraw | panic */ |
f25934c5f
|
544 |
unsigned int ar_nobarrier:1; /* do not send barriers */ |
90306c41d
|
545 |
unsigned int ar_rgrplvb:1; /* use lvbs for rgrp info */ |
471f3db27
|
546 547 |
unsigned int ar_loccookie:1; /* use location based readdir cookies */ |
1f52aa08d
|
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
|
552 553 554 555 |
}; struct gfs2_tune { spinlock_t gt_spin; |
b3b94faa5
|
556 |
unsigned int gt_logd_secs; |
b3b94faa5
|
557 |
|
b3b94faa5
|
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
|
561 |
unsigned int gt_quota_quantum; /* Secs between syncs to quota file */ |
b3b94faa5
|
562 |
unsigned int gt_new_files_jdata; |
b3b94faa5
|
563 |
unsigned int gt_max_readahead; /* Max bytes to read-ahead from disk */ |
b3b94faa5
|
564 |
unsigned int gt_complain_secs; |
b3b94faa5
|
565 566 567 |
unsigned int gt_statfs_quantum; unsigned int gt_statfs_slow; }; |
b3b94faa5
|
568 569 570 |
enum { SDF_JOURNAL_CHECKED = 0, SDF_JOURNAL_LIVE = 1, |
04aea0ca1
|
571 |
SDF_WITHDRAWN = 2, |
254db57f9
|
572 |
SDF_NOBARRIERS = 3, |
fe64d517d
|
573 |
SDF_NORECOVERY = 4, |
913a71d25
|
574 |
SDF_DEMOTE = 5, |
ba6e93645
|
575 |
SDF_NOJOURNALID = 6, |
e8ca5cc57
|
576 |
SDF_RORECOVERY = 7, /* read only recovery */ |
fb6791d10
|
577 |
SDF_SKIP_DLM_UNLOCK = 8, |
b066a4eeb
|
578 |
SDF_FORCE_AIL_FLUSH = 9, |
b524abcc0
|
579 |
SDF_AIL1_IO_ERROR = 10, |
8f9182199
|
580 |
SDF_FS_FROZEN = 11, |
b3b94faa5
|
581 |
}; |
2e60d7683
|
582 583 584 585 586 |
enum gfs2_freeze_state { SFS_UNFROZEN = 0, SFS_STARTING_FREEZE = 1, SFS_FROZEN = 2, }; |
b3b94faa5
|
587 |
#define GFS2_FSNAME_LEN 256 |
bb8d8a6f5
|
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
|
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
|
619 |
int ls_jid; |
f057f6cdf
|
620 |
unsigned int ls_first; |
f057f6cdf
|
621 |
const struct lm_lockops *ls_ops; |
f057f6cdf
|
622 |
dlm_lockspace_t *ls_dlm; |
e0c2a9aa1
|
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
|
630 |
char *ls_lvb_bits; |
e0c2a9aa1
|
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
|
640 |
}; |
a245769f2
|
641 642 643 644 |
struct gfs2_pcpu_lkstats { /* One struct for each glock type */ struct gfs2_lkstats lkstats[10]; }; |
b3b94faa5
|
645 646 |
struct gfs2_sbd { struct super_block *sd_vfs; |
a245769f2
|
647 |
struct gfs2_pcpu_lkstats __percpu *sd_lkstats; |
b3b94faa5
|
648 649 |
struct kobject sd_kobj; unsigned long sd_flags; /* SDF_... */ |
f50dfaf78
|
650 |
struct gfs2_sb_host sd_sb; |
b3b94faa5
|
651 652 |
/* Constants computed on mount */ |
cd915493f
|
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
|
662 |
u32 sd_blocks_per_bitmap; |
cd915493f
|
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
|
665 |
u64 sd_heightsize[GFS2_MAX_META_HEIGHT + 1]; |
471f3db27
|
666 |
u32 sd_max_dents_per_leaf; /* Max number of dirents in a leaf block */ |
b3b94faa5
|
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
|
674 675 |
struct gfs2_holder sd_live_gh; struct gfs2_glock *sd_rename_gl; |
24972557b
|
676 |
struct gfs2_glock *sd_freeze_gl; |
2e60d7683
|
677 |
struct work_struct sd_freeze_work; |
e402746a9
|
678 |
wait_queue_head_t sd_glock_wait; |
ad26967b9
|
679 |
wait_queue_head_t sd_async_glock_wait; |
e402746a9
|
680 |
atomic_t sd_glock_disposal; |
3942ae531
|
681 |
struct completion sd_locking_init; |
fd95e81cb
|
682 |
struct completion sd_wdack; |
e0c2a9aa1
|
683 |
struct delayed_work sd_control_work; |
b3b94faa5
|
684 685 |
/* Inode Stuff */ |
9b8df98fc
|
686 687 |
struct dentry *sd_master_dir; struct dentry *sd_root_dir; |
f42faf4fa
|
688 |
struct inode *sd_jindex; |
f42faf4fa
|
689 |
struct inode *sd_statfs_inode; |
f42faf4fa
|
690 |
struct inode *sd_sc_inode; |
f42faf4fa
|
691 692 693 |
struct inode *sd_qc_inode; struct inode *sd_rindex; struct inode *sd_quota_inode; |
b3b94faa5
|
694 |
|
b3b94faa5
|
695 696 697 |
/* StatFS stuff */ spinlock_t sd_statfs_spin; |
bd209cc01
|
698 699 |
struct gfs2_statfs_change_host sd_statfs_master; struct gfs2_statfs_change_host sd_statfs_local; |
3d3c10f2c
|
700 |
int sd_statfs_force_sync; |
b3b94faa5
|
701 702 |
/* Resource group stuff */ |
cf45b752c
|
703 |
int sd_rindex_uptodate; |
b3b94faa5
|
704 |
spinlock_t sd_rindex_spin; |
7c9ca6211
|
705 |
struct rb_root sd_rindex_tree; |
b3b94faa5
|
706 |
unsigned int sd_rgrps; |
3921120e7
|
707 |
unsigned int sd_max_rg_data; |
b3b94faa5
|
708 709 710 711 712 |
/* Journal index stuff */ struct list_head sd_jindex_list; spinlock_t sd_jindex_spin; |
f55ab26a8
|
713 |
struct mutex sd_jindex_mutex; |
b3b94faa5
|
714 |
unsigned int sd_journals; |
b3b94faa5
|
715 716 717 718 |
struct gfs2_jdesc *sd_jdesc; struct gfs2_holder sd_journal_gh; struct gfs2_holder sd_jinode_gh; |
b3b94faa5
|
719 |
struct gfs2_holder sd_sc_gh; |
b3b94faa5
|
720 |
struct gfs2_holder sd_qc_gh; |
0e48e055a
|
721 |
struct completion sd_journal_ready; |
b3b94faa5
|
722 |
/* Daemon stuff */ |
b3b94faa5
|
723 724 |
struct task_struct *sd_logd_process; struct task_struct *sd_quotad_process; |
b3b94faa5
|
725 |
|
b3b94faa5
|
726 727 728 729 |
/* Quota stuff */ struct list_head sd_quota_list; atomic_t sd_quota_count; |
f55ab26a8
|
730 |
struct mutex sd_quota_mutex; |
e46c772db
|
731 |
struct mutex sd_quota_sync_mutex; |
37b2c8377
|
732 |
wait_queue_head_t sd_quota_wait; |
813e0c46c
|
733 734 |
struct list_head sd_trunc_list; spinlock_t sd_trunc_lock; |
b3b94faa5
|
735 736 |
unsigned int sd_quota_slots; |
ee2411a8d
|
737 |
unsigned long *sd_quota_bitmap; |
2d9e72303
|
738 |
spinlock_t sd_bitmap_lock; |
b3b94faa5
|
739 |
|
cd915493f
|
740 |
u64 sd_quota_sync_gen; |
b3b94faa5
|
741 742 |
/* Log stuff */ |
70d4ee94b
|
743 |
struct address_space sd_aspace; |
b3b94faa5
|
744 |
spinlock_t sd_log_lock; |
b3b94faa5
|
745 |
|
16ca9412d
|
746 |
struct gfs2_trans *sd_log_tr; |
b3b94faa5
|
747 |
unsigned int sd_log_blks_reserved; |
2e95e3f66
|
748 |
int sd_log_commited_revoke; |
b3b94faa5
|
749 |
|
5e687eac1
|
750 |
atomic_t sd_log_pinned; |
b3b94faa5
|
751 |
unsigned int sd_log_num_revoke; |
f42faf4fa
|
752 |
|
a5b1d3fc5
|
753 754 |
struct list_head sd_log_revokes; struct list_head sd_log_ordered; |
451389909
|
755 |
spinlock_t sd_ordered_lock; |
b3b94faa5
|
756 |
|
5e687eac1
|
757 758 |
atomic_t sd_log_thresh1; atomic_t sd_log_thresh2; |
fd041f0b4
|
759 |
atomic_t sd_log_blks_free; |
f07b35202
|
760 |
atomic_t sd_log_blks_needed; |
5e687eac1
|
761 762 |
wait_queue_head_t sd_log_waitq; wait_queue_head_t sd_logd_waitq; |
b3b94faa5
|
763 |
|
cd915493f
|
764 |
u64 sd_log_sequence; |
b3b94faa5
|
765 766 |
unsigned int sd_log_head; unsigned int sd_log_tail; |
b3b94faa5
|
767 |
int sd_log_idle; |
484adff8a
|
768 |
struct rw_semaphore sd_log_flush_lock; |
16615be18
|
769 |
atomic_t sd_log_in_flight; |
e8c92ed76
|
770 |
struct bio *sd_log_bio; |
16615be18
|
771 |
wait_queue_head_t sd_log_flush_wait; |
942b0cddf
|
772 |
int sd_log_error; |
b3b94faa5
|
773 |
|
2e60d7683
|
774 775 |
atomic_t sd_reserving_log; wait_queue_head_t sd_reserving_log_wait; |
b3b94faa5
|
776 |
unsigned int sd_log_flush_head; |
b3b94faa5
|
777 |
|
d6a079e82
|
778 |
spinlock_t sd_ail_lock; |
b3b94faa5
|
779 780 |
struct list_head sd_ail1_list; struct list_head sd_ail2_list; |
b3b94faa5
|
781 |
|
b3b94faa5
|
782 |
/* For quiescing the filesystem */ |
b3b94faa5
|
783 |
struct gfs2_holder sd_freeze_gh; |
2e60d7683
|
784 785 |
atomic_t sd_freeze_state; struct mutex sd_freeze_mutex; |
b3b94faa5
|
786 |
|
561b79698
|
787 |
char sd_fsname[GFS2_FSNAME_LEN + 3 * sizeof(int) + 2]; |
b3b94faa5
|
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
|
794 |
struct dentry *debugfs_dir; /* debugfs directory */ |
b3b94faa5
|
795 |
}; |
a245769f2
|
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
|
803 |
const struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; |
a245769f2
|
804 805 806 807 |
preempt_disable(); this_cpu_ptr(sdp->sd_lkstats)->lkstats[gl->gl_name.ln_type].stats[which]++; preempt_enable(); } |
6f6597baa
|
808 |
extern struct gfs2_rgrpd *gfs2_glock2rgrp(struct gfs2_glock *gl); |
235628c5c
|
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
|
813 |
#endif /* __INCORE_DOT_H__ */ |