aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-08-30 09:30:00 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-08-30 09:30:00 -0400
commit8fb4b536e7b9dbaf7a6b8204e887b92a14e4352c (patch)
treef74f905188ca9df0fc6f5fda3c6ee25ede02ee2f /fs
parent83b7a664a0c7c39ccfa4c72535dc1c001d4e7a18 (diff)
[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>
Diffstat (limited to 'fs')
-rw-r--r--fs/gfs2/glock.c30
-rw-r--r--fs/gfs2/glock.h6
-rw-r--r--fs/gfs2/glops.c18
-rw-r--r--fs/gfs2/glops.h18
-rw-r--r--fs/gfs2/incore.h4
5 files changed, 38 insertions, 38 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index ef713dbff601..709e6e0914fd 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -253,7 +253,7 @@ static struct gfs2_glock *gfs2_glock_find(struct gfs2_sbd *sdp,
253 */ 253 */
254 254
255int gfs2_glock_get(struct gfs2_sbd *sdp, uint64_t number, 255int gfs2_glock_get(struct gfs2_sbd *sdp, uint64_t number,
256 struct gfs2_glock_operations *glops, int create, 256 const struct gfs2_glock_operations *glops, int create,
257 struct gfs2_glock **glp) 257 struct gfs2_glock **glp)
258{ 258{
259 struct lm_lockname name; 259 struct lm_lockname name;
@@ -480,7 +480,7 @@ static int rq_promote(struct gfs2_holder *gh)
480{ 480{
481 struct gfs2_glock *gl = gh->gh_gl; 481 struct gfs2_glock *gl = gh->gh_gl;
482 struct gfs2_sbd *sdp = gl->gl_sbd; 482 struct gfs2_sbd *sdp = gl->gl_sbd;
483 struct gfs2_glock_operations *glops = gl->gl_ops; 483 const struct gfs2_glock_operations *glops = gl->gl_ops;
484 484
485 if (!relaxed_state_ok(gl->gl_state, gh->gh_state, gh->gh_flags)) { 485 if (!relaxed_state_ok(gl->gl_state, gh->gh_state, gh->gh_flags)) {
486 if (list_empty(&gl->gl_holders)) { 486 if (list_empty(&gl->gl_holders)) {
@@ -535,7 +535,7 @@ static int rq_promote(struct gfs2_holder *gh)
535static int rq_demote(struct gfs2_holder *gh) 535static int rq_demote(struct gfs2_holder *gh)
536{ 536{
537 struct gfs2_glock *gl = gh->gh_gl; 537 struct gfs2_glock *gl = gh->gh_gl;
538 struct gfs2_glock_operations *glops = gl->gl_ops; 538 const struct gfs2_glock_operations *glops = gl->gl_ops;
539 539
540 if (!list_empty(&gl->gl_holders)) 540 if (!list_empty(&gl->gl_holders))
541 return 1; 541 return 1;
@@ -805,7 +805,7 @@ static void state_change(struct gfs2_glock *gl, unsigned int new_state)
805static void xmote_bh(struct gfs2_glock *gl, unsigned int ret) 805static void xmote_bh(struct gfs2_glock *gl, unsigned int ret)
806{ 806{
807 struct gfs2_sbd *sdp = gl->gl_sbd; 807 struct gfs2_sbd *sdp = gl->gl_sbd;
808 struct gfs2_glock_operations *glops = gl->gl_ops; 808 const struct gfs2_glock_operations *glops = gl->gl_ops;
809 struct gfs2_holder *gh = gl->gl_req_gh; 809 struct gfs2_holder *gh = gl->gl_req_gh;
810 int prev_state = gl->gl_state; 810 int prev_state = gl->gl_state;
811 int op_done = 1; 811 int op_done = 1;
@@ -915,7 +915,7 @@ static void xmote_bh(struct gfs2_glock *gl, unsigned int ret)
915void gfs2_glock_xmote_th(struct gfs2_glock *gl, unsigned int state, int flags) 915void gfs2_glock_xmote_th(struct gfs2_glock *gl, unsigned int state, int flags)
916{ 916{
917 struct gfs2_sbd *sdp = gl->gl_sbd; 917 struct gfs2_sbd *sdp = gl->gl_sbd;
918 struct gfs2_glock_operations *glops = gl->gl_ops; 918 const struct gfs2_glock_operations *glops = gl->gl_ops;
919 int lck_flags = flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB | 919 int lck_flags = flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB |
920 LM_FLAG_NOEXP | LM_FLAG_ANY | 920 LM_FLAG_NOEXP | LM_FLAG_ANY |
921 LM_FLAG_PRIORITY); 921 LM_FLAG_PRIORITY);
@@ -960,7 +960,7 @@ void gfs2_glock_xmote_th(struct gfs2_glock *gl, unsigned int state, int flags)
960static void drop_bh(struct gfs2_glock *gl, unsigned int ret) 960static void drop_bh(struct gfs2_glock *gl, unsigned int ret)
961{ 961{
962 struct gfs2_sbd *sdp = gl->gl_sbd; 962 struct gfs2_sbd *sdp = gl->gl_sbd;
963 struct gfs2_glock_operations *glops = gl->gl_ops; 963 const struct gfs2_glock_operations *glops = gl->gl_ops;
964 struct gfs2_holder *gh = gl->gl_req_gh; 964 struct gfs2_holder *gh = gl->gl_req_gh;
965 965
966 clear_bit(GLF_PREFETCH, &gl->gl_flags); 966 clear_bit(GLF_PREFETCH, &gl->gl_flags);
@@ -1010,7 +1010,7 @@ static void drop_bh(struct gfs2_glock *gl, unsigned int ret)
1010void gfs2_glock_drop_th(struct gfs2_glock *gl) 1010void gfs2_glock_drop_th(struct gfs2_glock *gl)
1011{ 1011{
1012 struct gfs2_sbd *sdp = gl->gl_sbd; 1012 struct gfs2_sbd *sdp = gl->gl_sbd;
1013 struct gfs2_glock_operations *glops = gl->gl_ops; 1013 const struct gfs2_glock_operations *glops = gl->gl_ops;
1014 unsigned int ret; 1014 unsigned int ret;
1015 1015
1016 gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags)); 1016 gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags));
@@ -1081,7 +1081,7 @@ static int glock_wait_internal(struct gfs2_holder *gh)
1081{ 1081{
1082 struct gfs2_glock *gl = gh->gh_gl; 1082 struct gfs2_glock *gl = gh->gh_gl;
1083 struct gfs2_sbd *sdp = gl->gl_sbd; 1083 struct gfs2_sbd *sdp = gl->gl_sbd;
1084 struct gfs2_glock_operations *glops = gl->gl_ops; 1084 const struct gfs2_glock_operations *glops = gl->gl_ops;
1085 1085
1086 if (test_bit(HIF_ABORTED, &gh->gh_iflags)) 1086 if (test_bit(HIF_ABORTED, &gh->gh_iflags))
1087 return -EIO; 1087 return -EIO;
@@ -1294,7 +1294,7 @@ int gfs2_glock_wait(struct gfs2_holder *gh)
1294void gfs2_glock_dq(struct gfs2_holder *gh) 1294void gfs2_glock_dq(struct gfs2_holder *gh)
1295{ 1295{
1296 struct gfs2_glock *gl = gh->gh_gl; 1296 struct gfs2_glock *gl = gh->gh_gl;
1297 struct gfs2_glock_operations *glops = gl->gl_ops; 1297 const struct gfs2_glock_operations *glops = gl->gl_ops;
1298 1298
1299 if (gh->gh_flags & GL_SYNC) 1299 if (gh->gh_flags & GL_SYNC)
1300 set_bit(GLF_SYNC, &gl->gl_flags); 1300 set_bit(GLF_SYNC, &gl->gl_flags);
@@ -1339,7 +1339,7 @@ void gfs2_glock_dq(struct gfs2_holder *gh)
1339static void gfs2_glock_prefetch(struct gfs2_glock *gl, unsigned int state, 1339static void gfs2_glock_prefetch(struct gfs2_glock *gl, unsigned int state,
1340 int flags) 1340 int flags)
1341{ 1341{
1342 struct gfs2_glock_operations *glops = gl->gl_ops; 1342 const struct gfs2_glock_operations *glops = gl->gl_ops;
1343 1343
1344 spin_lock(&gl->gl_spin); 1344 spin_lock(&gl->gl_spin);
1345 1345
@@ -1365,7 +1365,7 @@ static void greedy_work(void *data)
1365 struct greedy *gr = data; 1365 struct greedy *gr = data;
1366 struct gfs2_holder *gh = &gr->gr_gh; 1366 struct gfs2_holder *gh = &gr->gr_gh;
1367 struct gfs2_glock *gl = gh->gh_gl; 1367 struct gfs2_glock *gl = gh->gh_gl;
1368 struct gfs2_glock_operations *glops = gl->gl_ops; 1368 const struct gfs2_glock_operations *glops = gl->gl_ops;
1369 1369
1370 clear_bit(GLF_SKIP_WAITERS2, &gl->gl_flags); 1370 clear_bit(GLF_SKIP_WAITERS2, &gl->gl_flags);
1371 1371
@@ -1447,8 +1447,8 @@ void gfs2_glock_dq_uninit(struct gfs2_holder *gh)
1447 */ 1447 */
1448 1448
1449int gfs2_glock_nq_num(struct gfs2_sbd *sdp, uint64_t number, 1449int gfs2_glock_nq_num(struct gfs2_sbd *sdp, uint64_t number,
1450 struct gfs2_glock_operations *glops, unsigned int state, 1450 const struct gfs2_glock_operations *glops,
1451 int flags, struct gfs2_holder *gh) 1451 unsigned int state, int flags, struct gfs2_holder *gh)
1452{ 1452{
1453 struct gfs2_glock *gl; 1453 struct gfs2_glock *gl;
1454 int error; 1454 int error;
@@ -1645,7 +1645,7 @@ void gfs2_glock_dq_uninit_m(unsigned int num_gh, struct gfs2_holder *ghs)
1645 */ 1645 */
1646 1646
1647void gfs2_glock_prefetch_num(struct gfs2_sbd *sdp, uint64_t number, 1647void gfs2_glock_prefetch_num(struct gfs2_sbd *sdp, uint64_t number,
1648 struct gfs2_glock_operations *glops, 1648 const struct gfs2_glock_operations *glops,
1649 unsigned int state, int flags) 1649 unsigned int state, int flags)
1650{ 1650{
1651 struct gfs2_glock *gl; 1651 struct gfs2_glock *gl;
@@ -1827,7 +1827,7 @@ void gfs2_iopen_go_callback(struct gfs2_glock *io_gl, unsigned int state)
1827static int demote_ok(struct gfs2_glock *gl) 1827static int demote_ok(struct gfs2_glock *gl)
1828{ 1828{
1829 struct gfs2_sbd *sdp = gl->gl_sbd; 1829 struct gfs2_sbd *sdp = gl->gl_sbd;
1830 struct gfs2_glock_operations *glops = gl->gl_ops; 1830 const struct gfs2_glock_operations *glops = gl->gl_ops;
1831 int demote = 1; 1831 int demote = 1;
1832 1832
1833 if (test_bit(GLF_STICKY, &gl->gl_flags)) 1833 if (test_bit(GLF_STICKY, &gl->gl_flags))
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h
index fdf58db44ae3..12bdbfee4ddc 100644
--- a/fs/gfs2/glock.h
+++ b/fs/gfs2/glock.h
@@ -75,7 +75,7 @@ static inline int gfs2_glock_is_blocking(struct gfs2_glock *gl)
75} 75}
76 76
77int gfs2_glock_get(struct gfs2_sbd *sdp, 77int gfs2_glock_get(struct gfs2_sbd *sdp,
78 uint64_t number, struct gfs2_glock_operations *glops, 78 uint64_t number, const struct gfs2_glock_operations *glops,
79 int create, struct gfs2_glock **glp); 79 int create, struct gfs2_glock **glp);
80void gfs2_glock_hold(struct gfs2_glock *gl); 80void gfs2_glock_hold(struct gfs2_glock *gl);
81int gfs2_glock_put(struct gfs2_glock *gl); 81int gfs2_glock_put(struct gfs2_glock *gl);
@@ -97,7 +97,7 @@ int gfs2_glock_be_greedy(struct gfs2_glock *gl, unsigned int time);
97 97
98void gfs2_glock_dq_uninit(struct gfs2_holder *gh); 98void gfs2_glock_dq_uninit(struct gfs2_holder *gh);
99int gfs2_glock_nq_num(struct gfs2_sbd *sdp, 99int gfs2_glock_nq_num(struct gfs2_sbd *sdp,
100 uint64_t number, struct gfs2_glock_operations *glops, 100 uint64_t number, const struct gfs2_glock_operations *glops,
101 unsigned int state, int flags, struct gfs2_holder *gh); 101 unsigned int state, int flags, struct gfs2_holder *gh);
102 102
103int gfs2_glock_nq_m(unsigned int num_gh, struct gfs2_holder *ghs); 103int gfs2_glock_nq_m(unsigned int num_gh, struct gfs2_holder *ghs);
@@ -105,7 +105,7 @@ void gfs2_glock_dq_m(unsigned int num_gh, struct gfs2_holder *ghs);
105void gfs2_glock_dq_uninit_m(unsigned int num_gh, struct gfs2_holder *ghs); 105void gfs2_glock_dq_uninit_m(unsigned int num_gh, struct gfs2_holder *ghs);
106 106
107void gfs2_glock_prefetch_num(struct gfs2_sbd *sdp, uint64_t number, 107void gfs2_glock_prefetch_num(struct gfs2_sbd *sdp, uint64_t number,
108 struct gfs2_glock_operations *glops, 108 const struct gfs2_glock_operations *glops,
109 unsigned int state, int flags); 109 unsigned int state, int flags);
110void gfs2_glock_inode_squish(struct inode *inode); 110void gfs2_glock_inode_squish(struct inode *inode);
111 111
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index 75d4c50cff45..0c92c52fc92a 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -493,13 +493,13 @@ static int quota_go_demote_ok(struct gfs2_glock *gl)
493 return !atomic_read(&gl->gl_lvb_count); 493 return !atomic_read(&gl->gl_lvb_count);
494} 494}
495 495
496struct gfs2_glock_operations gfs2_meta_glops = { 496const struct gfs2_glock_operations gfs2_meta_glops = {
497 .go_xmote_th = gfs2_glock_xmote_th, 497 .go_xmote_th = gfs2_glock_xmote_th,
498 .go_drop_th = gfs2_glock_drop_th, 498 .go_drop_th = gfs2_glock_drop_th,
499 .go_type = LM_TYPE_META 499 .go_type = LM_TYPE_META
500}; 500};
501 501
502struct gfs2_glock_operations gfs2_inode_glops = { 502const struct gfs2_glock_operations gfs2_inode_glops = {
503 .go_xmote_th = inode_go_xmote_th, 503 .go_xmote_th = inode_go_xmote_th,
504 .go_xmote_bh = inode_go_xmote_bh, 504 .go_xmote_bh = inode_go_xmote_bh,
505 .go_drop_th = inode_go_drop_th, 505 .go_drop_th = inode_go_drop_th,
@@ -512,7 +512,7 @@ struct gfs2_glock_operations gfs2_inode_glops = {
512 .go_type = LM_TYPE_INODE 512 .go_type = LM_TYPE_INODE
513}; 513};
514 514
515struct gfs2_glock_operations gfs2_rgrp_glops = { 515const struct gfs2_glock_operations gfs2_rgrp_glops = {
516 .go_xmote_th = gfs2_glock_xmote_th, 516 .go_xmote_th = gfs2_glock_xmote_th,
517 .go_drop_th = gfs2_glock_drop_th, 517 .go_drop_th = gfs2_glock_drop_th,
518 .go_sync = meta_go_sync, 518 .go_sync = meta_go_sync,
@@ -523,40 +523,40 @@ struct gfs2_glock_operations gfs2_rgrp_glops = {
523 .go_type = LM_TYPE_RGRP 523 .go_type = LM_TYPE_RGRP
524}; 524};
525 525
526struct gfs2_glock_operations gfs2_trans_glops = { 526const struct gfs2_glock_operations gfs2_trans_glops = {
527 .go_xmote_th = trans_go_xmote_th, 527 .go_xmote_th = trans_go_xmote_th,
528 .go_xmote_bh = trans_go_xmote_bh, 528 .go_xmote_bh = trans_go_xmote_bh,
529 .go_drop_th = trans_go_drop_th, 529 .go_drop_th = trans_go_drop_th,
530 .go_type = LM_TYPE_NONDISK 530 .go_type = LM_TYPE_NONDISK
531}; 531};
532 532
533struct gfs2_glock_operations gfs2_iopen_glops = { 533const struct gfs2_glock_operations gfs2_iopen_glops = {
534 .go_xmote_th = gfs2_glock_xmote_th, 534 .go_xmote_th = gfs2_glock_xmote_th,
535 .go_drop_th = gfs2_glock_drop_th, 535 .go_drop_th = gfs2_glock_drop_th,
536 .go_callback = gfs2_iopen_go_callback, 536 .go_callback = gfs2_iopen_go_callback,
537 .go_type = LM_TYPE_IOPEN 537 .go_type = LM_TYPE_IOPEN
538}; 538};
539 539
540struct gfs2_glock_operations gfs2_flock_glops = { 540const struct gfs2_glock_operations gfs2_flock_glops = {
541 .go_xmote_th = gfs2_glock_xmote_th, 541 .go_xmote_th = gfs2_glock_xmote_th,
542 .go_drop_th = gfs2_glock_drop_th, 542 .go_drop_th = gfs2_glock_drop_th,
543 .go_type = LM_TYPE_FLOCK 543 .go_type = LM_TYPE_FLOCK
544}; 544};
545 545
546struct gfs2_glock_operations gfs2_nondisk_glops = { 546const struct gfs2_glock_operations gfs2_nondisk_glops = {
547 .go_xmote_th = gfs2_glock_xmote_th, 547 .go_xmote_th = gfs2_glock_xmote_th,
548 .go_drop_th = gfs2_glock_drop_th, 548 .go_drop_th = gfs2_glock_drop_th,
549 .go_type = LM_TYPE_NONDISK 549 .go_type = LM_TYPE_NONDISK
550}; 550};
551 551
552struct gfs2_glock_operations gfs2_quota_glops = { 552const struct gfs2_glock_operations gfs2_quota_glops = {
553 .go_xmote_th = gfs2_glock_xmote_th, 553 .go_xmote_th = gfs2_glock_xmote_th,
554 .go_drop_th = gfs2_glock_drop_th, 554 .go_drop_th = gfs2_glock_drop_th,
555 .go_demote_ok = quota_go_demote_ok, 555 .go_demote_ok = quota_go_demote_ok,
556 .go_type = LM_TYPE_QUOTA 556 .go_type = LM_TYPE_QUOTA
557}; 557};
558 558
559struct gfs2_glock_operations gfs2_journal_glops = { 559const struct gfs2_glock_operations gfs2_journal_glops = {
560 .go_xmote_th = gfs2_glock_xmote_th, 560 .go_xmote_th = gfs2_glock_xmote_th,
561 .go_drop_th = gfs2_glock_drop_th, 561 .go_drop_th = gfs2_glock_drop_th,
562 .go_type = LM_TYPE_JOURNAL 562 .go_type = LM_TYPE_JOURNAL
diff --git a/fs/gfs2/glops.h b/fs/gfs2/glops.h
index 5c1e9491024f..9409f0a7b47f 100644
--- a/fs/gfs2/glops.h
+++ b/fs/gfs2/glops.h
@@ -10,14 +10,14 @@
10#ifndef __GLOPS_DOT_H__ 10#ifndef __GLOPS_DOT_H__
11#define __GLOPS_DOT_H__ 11#define __GLOPS_DOT_H__
12 12
13extern struct gfs2_glock_operations gfs2_meta_glops; 13extern const struct gfs2_glock_operations gfs2_meta_glops;
14extern struct gfs2_glock_operations gfs2_inode_glops; 14extern const struct gfs2_glock_operations gfs2_inode_glops;
15extern struct gfs2_glock_operations gfs2_rgrp_glops; 15extern const struct gfs2_glock_operations gfs2_rgrp_glops;
16extern struct gfs2_glock_operations gfs2_trans_glops; 16extern const struct gfs2_glock_operations gfs2_trans_glops;
17extern struct gfs2_glock_operations gfs2_iopen_glops; 17extern const struct gfs2_glock_operations gfs2_iopen_glops;
18extern struct gfs2_glock_operations gfs2_flock_glops; 18extern const struct gfs2_glock_operations gfs2_flock_glops;
19extern struct gfs2_glock_operations gfs2_nondisk_glops; 19extern const struct gfs2_glock_operations gfs2_nondisk_glops;
20extern struct gfs2_glock_operations gfs2_quota_glops; 20extern const struct gfs2_glock_operations gfs2_quota_glops;
21extern struct gfs2_glock_operations gfs2_journal_glops; 21extern const struct gfs2_glock_operations gfs2_journal_glops;
22 22
23#endif /* __GLOPS_DOT_H__ */ 23#endif /* __GLOPS_DOT_H__ */
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 77f0903d2f3e..38098ac292af 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -130,7 +130,7 @@ struct gfs2_glock_operations {
130 void (*go_unlock) (struct gfs2_holder * gh); 130 void (*go_unlock) (struct gfs2_holder * gh);
131 void (*go_callback) (struct gfs2_glock * gl, unsigned int state); 131 void (*go_callback) (struct gfs2_glock * gl, unsigned int state);
132 void (*go_greedy) (struct gfs2_glock * gl); 132 void (*go_greedy) (struct gfs2_glock * gl);
133 int go_type; 133 const int go_type;
134}; 134};
135 135
136enum { 136enum {
@@ -189,7 +189,7 @@ struct gfs2_glock {
189 struct list_head gl_waiters2; /* HIF_DEMOTE, HIF_GREEDY */ 189 struct list_head gl_waiters2; /* HIF_DEMOTE, HIF_GREEDY */
190 struct list_head gl_waiters3; /* HIF_PROMOTE */ 190 struct list_head gl_waiters3; /* HIF_PROMOTE */
191 191
192 struct gfs2_glock_operations *gl_ops; 192 const struct gfs2_glock_operations *gl_ops;
193 193
194 struct gfs2_holder *gl_req_gh; 194 struct gfs2_holder *gl_req_gh;
195 gfs2_glop_bh_t gl_req_bh; 195 gfs2_glop_bh_t gl_req_bh;