[GFS2] Make glock operations const

For all the usual reasons of enforcing correctness and potentially
reducing code size, this patch makes the glock operations const.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index ef713db..709e6e0 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -253,7 +253,7 @@
  */
 
 int gfs2_glock_get(struct gfs2_sbd *sdp, uint64_t number,
-		   struct gfs2_glock_operations *glops, int create,
+		   const struct gfs2_glock_operations *glops, int create,
 		   struct gfs2_glock **glp)
 {
 	struct lm_lockname name;
@@ -480,7 +480,7 @@
 {
 	struct gfs2_glock *gl = gh->gh_gl;
 	struct gfs2_sbd *sdp = gl->gl_sbd;
-	struct gfs2_glock_operations *glops = gl->gl_ops;
+	const struct gfs2_glock_operations *glops = gl->gl_ops;
 
 	if (!relaxed_state_ok(gl->gl_state, gh->gh_state, gh->gh_flags)) {
 		if (list_empty(&gl->gl_holders)) {
@@ -535,7 +535,7 @@
 static int rq_demote(struct gfs2_holder *gh)
 {
 	struct gfs2_glock *gl = gh->gh_gl;
-	struct gfs2_glock_operations *glops = gl->gl_ops;
+	const struct gfs2_glock_operations *glops = gl->gl_ops;
 
 	if (!list_empty(&gl->gl_holders))
 		return 1;
@@ -805,7 +805,7 @@
 static void xmote_bh(struct gfs2_glock *gl, unsigned int ret)
 {
 	struct gfs2_sbd *sdp = gl->gl_sbd;
-	struct gfs2_glock_operations *glops = gl->gl_ops;
+	const struct gfs2_glock_operations *glops = gl->gl_ops;
 	struct gfs2_holder *gh = gl->gl_req_gh;
 	int prev_state = gl->gl_state;
 	int op_done = 1;
@@ -915,7 +915,7 @@
 void gfs2_glock_xmote_th(struct gfs2_glock *gl, unsigned int state, int flags)
 {
 	struct gfs2_sbd *sdp = gl->gl_sbd;
-	struct gfs2_glock_operations *glops = gl->gl_ops;
+	const struct gfs2_glock_operations *glops = gl->gl_ops;
 	int lck_flags = flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB |
 				 LM_FLAG_NOEXP | LM_FLAG_ANY |
 				 LM_FLAG_PRIORITY);
@@ -960,7 +960,7 @@
 static void drop_bh(struct gfs2_glock *gl, unsigned int ret)
 {
 	struct gfs2_sbd *sdp = gl->gl_sbd;
-	struct gfs2_glock_operations *glops = gl->gl_ops;
+	const struct gfs2_glock_operations *glops = gl->gl_ops;
 	struct gfs2_holder *gh = gl->gl_req_gh;
 
 	clear_bit(GLF_PREFETCH, &gl->gl_flags);
@@ -1010,7 +1010,7 @@
 void gfs2_glock_drop_th(struct gfs2_glock *gl)
 {
 	struct gfs2_sbd *sdp = gl->gl_sbd;
-	struct gfs2_glock_operations *glops = gl->gl_ops;
+	const struct gfs2_glock_operations *glops = gl->gl_ops;
 	unsigned int ret;
 
 	gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags));
@@ -1081,7 +1081,7 @@
 {
 	struct gfs2_glock *gl = gh->gh_gl;
 	struct gfs2_sbd *sdp = gl->gl_sbd;
-	struct gfs2_glock_operations *glops = gl->gl_ops;
+	const struct gfs2_glock_operations *glops = gl->gl_ops;
 
 	if (test_bit(HIF_ABORTED, &gh->gh_iflags))
 		return -EIO;
@@ -1294,7 +1294,7 @@
 void gfs2_glock_dq(struct gfs2_holder *gh)
 {
 	struct gfs2_glock *gl = gh->gh_gl;
-	struct gfs2_glock_operations *glops = gl->gl_ops;
+	const struct gfs2_glock_operations *glops = gl->gl_ops;
 
 	if (gh->gh_flags & GL_SYNC)
 		set_bit(GLF_SYNC, &gl->gl_flags);
@@ -1339,7 +1339,7 @@
 static void gfs2_glock_prefetch(struct gfs2_glock *gl, unsigned int state,
 				int flags)
 {
-	struct gfs2_glock_operations *glops = gl->gl_ops;
+	const struct gfs2_glock_operations *glops = gl->gl_ops;
 
 	spin_lock(&gl->gl_spin);
 
@@ -1365,7 +1365,7 @@
 	struct greedy *gr = data;
 	struct gfs2_holder *gh = &gr->gr_gh;
 	struct gfs2_glock *gl = gh->gh_gl;
-	struct gfs2_glock_operations *glops = gl->gl_ops;
+	const struct gfs2_glock_operations *glops = gl->gl_ops;
 
 	clear_bit(GLF_SKIP_WAITERS2, &gl->gl_flags);
 
@@ -1447,8 +1447,8 @@
  */
 
 int gfs2_glock_nq_num(struct gfs2_sbd *sdp, uint64_t number,
-		      struct gfs2_glock_operations *glops, unsigned int state,
-		      int flags, struct gfs2_holder *gh)
+		      const struct gfs2_glock_operations *glops,
+		      unsigned int state, int flags, struct gfs2_holder *gh)
 {
 	struct gfs2_glock *gl;
 	int error;
@@ -1645,7 +1645,7 @@
  */
 
 void gfs2_glock_prefetch_num(struct gfs2_sbd *sdp, uint64_t number,
-			     struct gfs2_glock_operations *glops,
+			     const struct gfs2_glock_operations *glops,
 			     unsigned int state, int flags)
 {
 	struct gfs2_glock *gl;
@@ -1827,7 +1827,7 @@
 static int demote_ok(struct gfs2_glock *gl)
 {
 	struct gfs2_sbd *sdp = gl->gl_sbd;
-	struct gfs2_glock_operations *glops = gl->gl_ops;
+	const struct gfs2_glock_operations *glops = gl->gl_ops;
 	int demote = 1;
 
 	if (test_bit(GLF_STICKY, &gl->gl_flags))
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h
index fdf58db..12bdbfe 100644
--- a/fs/gfs2/glock.h
+++ b/fs/gfs2/glock.h
@@ -75,7 +75,7 @@
 }
 
 int gfs2_glock_get(struct gfs2_sbd *sdp,
-		   uint64_t number, struct gfs2_glock_operations *glops,
+		   uint64_t number, const struct gfs2_glock_operations *glops,
 		   int create, struct gfs2_glock **glp);
 void gfs2_glock_hold(struct gfs2_glock *gl);
 int gfs2_glock_put(struct gfs2_glock *gl);
@@ -97,7 +97,7 @@
 
 void gfs2_glock_dq_uninit(struct gfs2_holder *gh);
 int gfs2_glock_nq_num(struct gfs2_sbd *sdp,
-		      uint64_t number, struct gfs2_glock_operations *glops,
+		      uint64_t number, const struct gfs2_glock_operations *glops,
 		      unsigned int state, int flags, struct gfs2_holder *gh);
 
 int gfs2_glock_nq_m(unsigned int num_gh, struct gfs2_holder *ghs);
@@ -105,7 +105,7 @@
 void gfs2_glock_dq_uninit_m(unsigned int num_gh, struct gfs2_holder *ghs);
 
 void gfs2_glock_prefetch_num(struct gfs2_sbd *sdp, uint64_t number,
-			     struct gfs2_glock_operations *glops,
+			     const struct gfs2_glock_operations *glops,
 			     unsigned int state, int flags);
 void gfs2_glock_inode_squish(struct inode *inode);
 
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index 75d4c50..0c92c52 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -493,13 +493,13 @@
 	return !atomic_read(&gl->gl_lvb_count);
 }
 
-struct gfs2_glock_operations gfs2_meta_glops = {
+const struct gfs2_glock_operations gfs2_meta_glops = {
 	.go_xmote_th = gfs2_glock_xmote_th,
 	.go_drop_th = gfs2_glock_drop_th,
 	.go_type = LM_TYPE_META
 };
 
-struct gfs2_glock_operations gfs2_inode_glops = {
+const struct gfs2_glock_operations gfs2_inode_glops = {
 	.go_xmote_th = inode_go_xmote_th,
 	.go_xmote_bh = inode_go_xmote_bh,
 	.go_drop_th = inode_go_drop_th,
@@ -512,7 +512,7 @@
 	.go_type = LM_TYPE_INODE
 };
 
-struct gfs2_glock_operations gfs2_rgrp_glops = {
+const struct gfs2_glock_operations gfs2_rgrp_glops = {
 	.go_xmote_th = gfs2_glock_xmote_th,
 	.go_drop_th = gfs2_glock_drop_th,
 	.go_sync = meta_go_sync,
@@ -523,40 +523,40 @@
 	.go_type = LM_TYPE_RGRP
 };
 
-struct gfs2_glock_operations gfs2_trans_glops = {
+const struct gfs2_glock_operations gfs2_trans_glops = {
 	.go_xmote_th = trans_go_xmote_th,
 	.go_xmote_bh = trans_go_xmote_bh,
 	.go_drop_th = trans_go_drop_th,
 	.go_type = LM_TYPE_NONDISK
 };
 
-struct gfs2_glock_operations gfs2_iopen_glops = {
+const struct gfs2_glock_operations gfs2_iopen_glops = {
 	.go_xmote_th = gfs2_glock_xmote_th,
 	.go_drop_th = gfs2_glock_drop_th,
 	.go_callback = gfs2_iopen_go_callback,
 	.go_type = LM_TYPE_IOPEN
 };
 
-struct gfs2_glock_operations gfs2_flock_glops = {
+const struct gfs2_glock_operations gfs2_flock_glops = {
 	.go_xmote_th = gfs2_glock_xmote_th,
 	.go_drop_th = gfs2_glock_drop_th,
 	.go_type = LM_TYPE_FLOCK
 };
 
-struct gfs2_glock_operations gfs2_nondisk_glops = {
+const struct gfs2_glock_operations gfs2_nondisk_glops = {
 	.go_xmote_th = gfs2_glock_xmote_th,
 	.go_drop_th = gfs2_glock_drop_th,
 	.go_type = LM_TYPE_NONDISK
 };
 
-struct gfs2_glock_operations gfs2_quota_glops = {
+const struct gfs2_glock_operations gfs2_quota_glops = {
 	.go_xmote_th = gfs2_glock_xmote_th,
 	.go_drop_th = gfs2_glock_drop_th,
 	.go_demote_ok = quota_go_demote_ok,
 	.go_type = LM_TYPE_QUOTA
 };
 
-struct gfs2_glock_operations gfs2_journal_glops = {
+const struct gfs2_glock_operations gfs2_journal_glops = {
 	.go_xmote_th = gfs2_glock_xmote_th,
 	.go_drop_th = gfs2_glock_drop_th,
 	.go_type = LM_TYPE_JOURNAL
diff --git a/fs/gfs2/glops.h b/fs/gfs2/glops.h
index 5c1e949..9409f0a 100644
--- a/fs/gfs2/glops.h
+++ b/fs/gfs2/glops.h
@@ -10,14 +10,14 @@
 #ifndef __GLOPS_DOT_H__
 #define __GLOPS_DOT_H__
 
-extern struct gfs2_glock_operations gfs2_meta_glops;
-extern struct gfs2_glock_operations gfs2_inode_glops;
-extern struct gfs2_glock_operations gfs2_rgrp_glops;
-extern struct gfs2_glock_operations gfs2_trans_glops;
-extern struct gfs2_glock_operations gfs2_iopen_glops;
-extern struct gfs2_glock_operations gfs2_flock_glops;
-extern struct gfs2_glock_operations gfs2_nondisk_glops;
-extern struct gfs2_glock_operations gfs2_quota_glops;
-extern struct gfs2_glock_operations gfs2_journal_glops;
+extern const struct gfs2_glock_operations gfs2_meta_glops;
+extern const struct gfs2_glock_operations gfs2_inode_glops;
+extern const struct gfs2_glock_operations gfs2_rgrp_glops;
+extern const struct gfs2_glock_operations gfs2_trans_glops;
+extern const struct gfs2_glock_operations gfs2_iopen_glops;
+extern const struct gfs2_glock_operations gfs2_flock_glops;
+extern const struct gfs2_glock_operations gfs2_nondisk_glops;
+extern const struct gfs2_glock_operations gfs2_quota_glops;
+extern const struct gfs2_glock_operations gfs2_journal_glops;
 
 #endif /* __GLOPS_DOT_H__ */
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 77f0903d..38098ac 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -130,7 +130,7 @@
 	void (*go_unlock) (struct gfs2_holder * gh);
 	void (*go_callback) (struct gfs2_glock * gl, unsigned int state);
 	void (*go_greedy) (struct gfs2_glock * gl);
-	int go_type;
+	const int go_type;
 };
 
 enum {
@@ -189,7 +189,7 @@
 	struct list_head gl_waiters2;	/* HIF_DEMOTE, HIF_GREEDY */
 	struct list_head gl_waiters3;	/* HIF_PROMOTE */
 
-	struct gfs2_glock_operations *gl_ops;
+	const struct gfs2_glock_operations *gl_ops;
 
 	struct gfs2_holder *gl_req_gh;
 	gfs2_glop_bh_t gl_req_bh;