aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/incore.h
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2009-01-12 05:43:39 -0500
committerSteven Whitehouse <steve@dolmen.chygwyn.com>2009-03-24 07:21:14 -0400
commitf057f6cdf64175db1151b1f5d110e29904f119a1 (patch)
tree582dbf358e351f64977620c29ebf772d693b1948 /fs/gfs2/incore.h
parent22077f57dec8fcbeb1112b35313961c0902ff038 (diff)
GFS2: Merge lock_dlm module into GFS2
This is the big patch that I've been working on for some time now. There are many reasons for wanting to make this change such as: o Reducing overhead by eliminating duplicated fields between structures o Simplifcation of the code (reduces the code size by a fair bit) o The locking interface is now the DLM interface itself as proposed some time ago. o Fewer lookups of glocks when processing replies from the DLM o Fewer memory allocations/deallocations for each glock o Scope to do further optimisations in the future (but this patch is more than big enough for now!) Please note that (a) this patch relates to the lock_dlm module and not the DLM itself, that is still a separate module; and (b) that we retain the ability to build GFS2 as a standalone single node filesystem with out requiring the DLM. This patch needs a lot of testing, hence my keeping it I restarted my -git tree after the last merge window. That way, this has the maximum exposure before its merged. This is (modulo a few minor bug fixes) the same patch that I've been posting on and off the the last three months and its passed a number of different tests so far. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/incore.h')
-rw-r--r--fs/gfs2/incore.h59
1 files changed, 54 insertions, 5 deletions
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index a0117d6eb145..0af7c24de6a1 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -12,6 +12,8 @@
12 12
13#include <linux/fs.h> 13#include <linux/fs.h>
14#include <linux/workqueue.h> 14#include <linux/workqueue.h>
15#include <linux/dlm.h>
16#include <linux/buffer_head.h>
15 17
16#define DIO_WAIT 0x00000010 18#define DIO_WAIT 0x00000010
17#define DIO_METADATA 0x00000020 19#define DIO_METADATA 0x00000020
@@ -26,6 +28,7 @@ struct gfs2_trans;
26struct gfs2_ail; 28struct gfs2_ail;
27struct gfs2_jdesc; 29struct gfs2_jdesc;
28struct gfs2_sbd; 30struct gfs2_sbd;
31struct lm_lockops;
29 32
30typedef void (*gfs2_glop_bh_t) (struct gfs2_glock *gl, unsigned int ret); 33typedef void (*gfs2_glop_bh_t) (struct gfs2_glock *gl, unsigned int ret);
31 34
@@ -121,6 +124,28 @@ struct gfs2_bufdata {
121 struct list_head bd_ail_gl_list; 124 struct list_head bd_ail_gl_list;
122}; 125};
123 126
127/*
128 * Internally, we prefix things with gdlm_ and GDLM_ (for gfs-dlm) since a
129 * prefix of lock_dlm_ gets awkward.
130 */
131
132#define GDLM_STRNAME_BYTES 25
133#define GDLM_LVB_SIZE 32
134
135enum {
136 DFL_BLOCK_LOCKS = 0,
137};
138
139struct lm_lockname {
140 u64 ln_number;
141 unsigned int ln_type;
142};
143
144#define lm_name_equal(name1, name2) \
145 (((name1)->ln_number == (name2)->ln_number) && \
146 ((name1)->ln_type == (name2)->ln_type))
147
148
124struct gfs2_glock_operations { 149struct gfs2_glock_operations {
125 void (*go_xmote_th) (struct gfs2_glock *gl); 150 void (*go_xmote_th) (struct gfs2_glock *gl);
126 int (*go_xmote_bh) (struct gfs2_glock *gl, struct gfs2_holder *gh); 151 int (*go_xmote_bh) (struct gfs2_glock *gl, struct gfs2_holder *gh);
@@ -162,6 +187,8 @@ enum {
162 GLF_LFLUSH = 7, 187 GLF_LFLUSH = 7,
163 GLF_INVALIDATE_IN_PROGRESS = 8, 188 GLF_INVALIDATE_IN_PROGRESS = 8,
164 GLF_REPLY_PENDING = 9, 189 GLF_REPLY_PENDING = 9,
190 GLF_INITIAL = 10,
191 GLF_FROZEN = 11,
165}; 192};
166 193
167struct gfs2_glock { 194struct gfs2_glock {
@@ -181,10 +208,9 @@ struct gfs2_glock {
181 struct list_head gl_holders; 208 struct list_head gl_holders;
182 209
183 const struct gfs2_glock_operations *gl_ops; 210 const struct gfs2_glock_operations *gl_ops;
184 void *gl_lock; 211 char gl_strname[GDLM_STRNAME_BYTES];
185 char *gl_lvb; 212 struct dlm_lksb gl_lksb;
186 atomic_t gl_lvb_count; 213 char gl_lvb[32];
187
188 unsigned long gl_stamp; 214 unsigned long gl_stamp;
189 unsigned long gl_tchange; 215 unsigned long gl_tchange;
190 void *gl_object; 216 void *gl_object;
@@ -447,6 +473,30 @@ struct gfs2_sb_host {
447 char sb_locktable[GFS2_LOCKNAME_LEN]; 473 char sb_locktable[GFS2_LOCKNAME_LEN];
448}; 474};
449 475
476/*
477 * lm_mount() return values
478 *
479 * ls_jid - the journal ID this node should use
480 * ls_first - this node is the first to mount the file system
481 * ls_lockspace - lock module's context for this file system
482 * ls_ops - lock module's functions
483 */
484
485struct lm_lockstruct {
486 u32 ls_id;
487 unsigned int ls_jid;
488 unsigned int ls_first;
489 unsigned int ls_first_done;
490 unsigned int ls_nodir;
491 const struct lm_lockops *ls_ops;
492 unsigned long ls_flags;
493 dlm_lockspace_t *ls_dlm;
494
495 int ls_recover_jid;
496 int ls_recover_jid_done;
497 int ls_recover_jid_status;
498};
499
450struct gfs2_sbd { 500struct gfs2_sbd {
451 struct super_block *sd_vfs; 501 struct super_block *sd_vfs;
452 struct kobject sd_kobj; 502 struct kobject sd_kobj;
@@ -520,7 +570,6 @@ struct gfs2_sbd {
520 spinlock_t sd_jindex_spin; 570 spinlock_t sd_jindex_spin;
521 struct mutex sd_jindex_mutex; 571 struct mutex sd_jindex_mutex;
522 unsigned int sd_journals; 572 unsigned int sd_journals;
523 unsigned long sd_jindex_refresh_time;
524 573
525 struct gfs2_jdesc *sd_jdesc; 574 struct gfs2_jdesc *sd_jdesc;
526 struct gfs2_holder sd_journal_gh; 575 struct gfs2_holder sd_journal_gh;