aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-04-07 11:17:32 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-04-07 11:17:32 -0400
commitb09e593d799560f1a0782c20ac5900058390a26f (patch)
tree20f04bd2c8ba9c09ac80a7bb1400d341c4fd7e21 /fs
parent55eccc6d00cea224bf634d44e9871cfe83200ff2 (diff)
[GFS2] Fix a ref count bug and other clean ups
This fixes a ref count bug that sometimes showed up a umount time (causing it to hang) but it otherwise mostly harmless. At the same time there are some clean ups including making the log operations structures const, moving a memory allocation so that its not done in the fast path of checking to see if there is an outstanding transaction related to a particular glock. Removes the sd_log_wrap varaible which was updated, but never actually used anywhere. Updates the gfs2 ioctl() to run without the kernel lock (which it never needed anyway). Removes the "invalidate inodes" loop from GFS2's put_super routine. This is done in kill super anyway so we don't need to do it here. The loop was also bogus in that if there are any inodes "stuck" at this point its a bug and we need to know about it rather than hide it by hanging forever. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/gfs2/daemon.c2
-rw-r--r--fs/gfs2/dir.c2
-rw-r--r--fs/gfs2/glops.c6
-rw-r--r--fs/gfs2/incore.h6
-rw-r--r--fs/gfs2/log.c33
-rw-r--r--fs/gfs2/log.h6
-rw-r--r--fs/gfs2/lops.c14
-rw-r--r--fs/gfs2/lops.h14
-rw-r--r--fs/gfs2/meta_io.c10
-rw-r--r--fs/gfs2/ops_file.c23
-rw-r--r--fs/gfs2/ops_fstype.c4
-rw-r--r--fs/gfs2/ops_super.c12
-rw-r--r--fs/gfs2/quota.c2
-rw-r--r--fs/gfs2/trans.c2
14 files changed, 67 insertions, 69 deletions
diff --git a/fs/gfs2/daemon.c b/fs/gfs2/daemon.c
index 94317dc7e42c..b3830b92d78c 100644
--- a/fs/gfs2/daemon.c
+++ b/fs/gfs2/daemon.c
@@ -129,7 +129,7 @@ int gfs2_logd(void *data)
129 gfs2_ail1_empty(sdp, DIO_ALL); 129 gfs2_ail1_empty(sdp, DIO_ALL);
130 130
131 if (time_after_eq(jiffies, t)) { 131 if (time_after_eq(jiffies, t)) {
132 gfs2_log_flush(sdp); 132 gfs2_log_flush(sdp, NULL);
133 sdp->sd_log_flush_time = jiffies; 133 sdp->sd_log_flush_time = jiffies;
134 } 134 }
135 135
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 66917f2c64aa..316eed688f8e 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -789,6 +789,8 @@ static struct gfs2_dirent *gfs2_dirent_search(struct inode *inode,
789 if (error) 789 if (error)
790 return ERR_PTR(error); 790 return ERR_PTR(error);
791 dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size, scan, name, NULL); 791 dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size, scan, name, NULL);
792 brelse(bh);
793
792got_dent: 794got_dent:
793 *pbh = bh; 795 *pbh = bh;
794 return dent; 796 return dent;
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index d9334eb72df8..d180c89dd567 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -45,7 +45,7 @@ static void meta_go_sync(struct gfs2_glock *gl, int flags)
45 return; 45 return;
46 46
47 if (test_and_clear_bit(GLF_DIRTY, &gl->gl_flags)) { 47 if (test_and_clear_bit(GLF_DIRTY, &gl->gl_flags)) {
48 gfs2_log_flush_glock(gl); 48 gfs2_log_flush(gl->gl_sbd, gl);
49 gfs2_meta_sync(gl, flags | DIO_START | DIO_WAIT); 49 gfs2_meta_sync(gl, flags | DIO_START | DIO_WAIT);
50 if (flags & DIO_RELEASE) 50 if (flags & DIO_RELEASE)
51 gfs2_ail_empty_gl(gl); 51 gfs2_ail_empty_gl(gl);
@@ -149,12 +149,12 @@ static void inode_go_sync(struct gfs2_glock *gl, int flags)
149 if (test_bit(GLF_DIRTY, &gl->gl_flags)) { 149 if (test_bit(GLF_DIRTY, &gl->gl_flags)) {
150 if (meta && data) { 150 if (meta && data) {
151 gfs2_page_sync(gl, flags | DIO_START); 151 gfs2_page_sync(gl, flags | DIO_START);
152 gfs2_log_flush_glock(gl); 152 gfs2_log_flush(gl->gl_sbd, gl);
153 gfs2_meta_sync(gl, flags | DIO_START | DIO_WAIT); 153 gfs2_meta_sync(gl, flags | DIO_START | DIO_WAIT);
154 gfs2_page_sync(gl, flags | DIO_WAIT); 154 gfs2_page_sync(gl, flags | DIO_WAIT);
155 clear_bit(GLF_DIRTY, &gl->gl_flags); 155 clear_bit(GLF_DIRTY, &gl->gl_flags);
156 } else if (meta) { 156 } else if (meta) {
157 gfs2_log_flush_glock(gl); 157 gfs2_log_flush(gl->gl_sbd, gl);
158 gfs2_meta_sync(gl, flags | DIO_START | DIO_WAIT); 158 gfs2_meta_sync(gl, flags | DIO_START | DIO_WAIT);
159 } else if (data) 159 } else if (data)
160 gfs2_page_sync(gl, flags | DIO_START | DIO_WAIT); 160 gfs2_page_sync(gl, flags | DIO_START | DIO_WAIT);
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 423cfa72b4c7..dfed83b37ab7 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -62,12 +62,12 @@ struct gfs2_log_operations {
62 struct gfs2_log_descriptor *ld, __be64 *ptr, 62 struct gfs2_log_descriptor *ld, __be64 *ptr,
63 int pass); 63 int pass);
64 void (*lo_after_scan) (struct gfs2_jdesc *jd, int error, int pass); 64 void (*lo_after_scan) (struct gfs2_jdesc *jd, int error, int pass);
65 char *lo_name; 65 const char *lo_name;
66}; 66};
67 67
68struct gfs2_log_element { 68struct gfs2_log_element {
69 struct list_head le_list; 69 struct list_head le_list;
70 struct gfs2_log_operations *le_ops; 70 const struct gfs2_log_operations *le_ops;
71}; 71};
72 72
73struct gfs2_bitmap { 73struct gfs2_bitmap {
@@ -618,6 +618,7 @@ struct gfs2_sbd {
618 unsigned int sd_log_num_rg; 618 unsigned int sd_log_num_rg;
619 unsigned int sd_log_num_databuf; 619 unsigned int sd_log_num_databuf;
620 unsigned int sd_log_num_jdata; 620 unsigned int sd_log_num_jdata;
621 unsigned int sd_log_num_hdrs;
621 622
622 struct list_head sd_log_le_gl; 623 struct list_head sd_log_le_gl;
623 struct list_head sd_log_le_buf; 624 struct list_head sd_log_le_buf;
@@ -631,7 +632,6 @@ struct gfs2_sbd {
631 uint64_t sd_log_sequence; 632 uint64_t sd_log_sequence;
632 unsigned int sd_log_head; 633 unsigned int sd_log_head;
633 unsigned int sd_log_tail; 634 unsigned int sd_log_tail;
634 uint64_t sd_log_wraps;
635 int sd_log_idle; 635 int sd_log_idle;
636 636
637 unsigned long sd_log_flush_time; 637 unsigned long sd_log_flush_time;
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index ea69376c00d8..cadfef193e55 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -171,13 +171,14 @@ int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks)
171 while(sdp->sd_log_blks_free <= blks) { 171 while(sdp->sd_log_blks_free <= blks) {
172 gfs2_log_unlock(sdp); 172 gfs2_log_unlock(sdp);
173 gfs2_ail1_empty(sdp, 0); 173 gfs2_ail1_empty(sdp, 0);
174 gfs2_log_flush(sdp); 174 gfs2_log_flush(sdp, NULL);
175 175
176 if (try++) 176 if (try++)
177 gfs2_ail1_start(sdp, 0); 177 gfs2_ail1_start(sdp, 0);
178 gfs2_log_lock(sdp); 178 gfs2_log_lock(sdp);
179 } 179 }
180 sdp->sd_log_blks_free -= blks; 180 sdp->sd_log_blks_free -= blks;
181 /* printk(KERN_INFO "reserved %u blocks (%u left)\n", blks, sdp->sd_log_blks_free); */
181 gfs2_log_unlock(sdp); 182 gfs2_log_unlock(sdp);
182 mutex_unlock(&sdp->sd_log_reserve_mutex); 183 mutex_unlock(&sdp->sd_log_reserve_mutex);
183 184
@@ -199,6 +200,7 @@ void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks)
199 200
200 gfs2_log_lock(sdp); 201 gfs2_log_lock(sdp);
201 sdp->sd_log_blks_free += blks; 202 sdp->sd_log_blks_free += blks;
203 /* printk(KERN_INFO "released %u blocks (%u left)\n", blks, sdp->sd_log_blks_free); */
202 gfs2_assert_withdraw(sdp, 204 gfs2_assert_withdraw(sdp,
203 sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks); 205 sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks);
204 gfs2_log_unlock(sdp); 206 gfs2_log_unlock(sdp);
@@ -342,6 +344,7 @@ static void log_pull_tail(struct gfs2_sbd *sdp, unsigned int new_tail, int pull)
342 344
343 gfs2_log_lock(sdp); 345 gfs2_log_lock(sdp);
344 sdp->sd_log_blks_free += dist - ((pull) ? 1 : 0); 346 sdp->sd_log_blks_free += dist - ((pull) ? 1 : 0);
347 /* printk(KERN_INFO "pull tail refunding %u blocks (%u left) pull=%d\n", dist - ((pull) ? 1 : 0), sdp->sd_log_blks_free, pull); */
345 gfs2_assert_withdraw(sdp, 348 gfs2_assert_withdraw(sdp,
346 sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks); 349 sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks);
347 gfs2_log_unlock(sdp); 350 gfs2_log_unlock(sdp);
@@ -364,6 +367,8 @@ static void log_write_header(struct gfs2_sbd *sdp, uint32_t flags, int pull)
364 unsigned int tail; 367 unsigned int tail;
365 uint32_t hash; 368 uint32_t hash;
366 369
370 /* printk(KERN_INFO "log write header start (flags=%08x, pull=%d)\n", flags, pull); */
371
367 bh = sb_getblk(sdp->sd_vfs, blkno); 372 bh = sb_getblk(sdp->sd_vfs, blkno);
368 lock_buffer(bh); 373 lock_buffer(bh);
369 memset(bh->b_data, 0, bh->b_size); 374 memset(bh->b_data, 0, bh->b_size);
@@ -398,6 +403,8 @@ static void log_write_header(struct gfs2_sbd *sdp, uint32_t flags, int pull)
398 403
399 sdp->sd_log_idle = (tail == sdp->sd_log_flush_head); 404 sdp->sd_log_idle = (tail == sdp->sd_log_flush_head);
400 log_incr_head(sdp); 405 log_incr_head(sdp);
406
407 /* printk(KERN_INFO "log write header out\n"); */
401} 408}
402 409
403static void log_flush_commit(struct gfs2_sbd *sdp) 410static void log_flush_commit(struct gfs2_sbd *sdp)
@@ -432,20 +439,16 @@ static void log_flush_commit(struct gfs2_sbd *sdp)
432} 439}
433 440
434/** 441/**
435 * gfs2_log_flush_i - flush incore transaction(s) 442 * gfs2_log_flush - flush incore transaction(s)
436 * @sdp: the filesystem 443 * @sdp: the filesystem
437 * @gl: The glock structure to flush. If NULL, flush the whole incore log 444 * @gl: The glock structure to flush. If NULL, flush the whole incore log
438 * 445 *
439 */ 446 */
440 447
441void gfs2_log_flush_i(struct gfs2_sbd *sdp, struct gfs2_glock *gl) 448void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
442{ 449{
443 struct gfs2_ail *ai; 450 struct gfs2_ail *ai;
444 451
445 ai = kzalloc(sizeof(struct gfs2_ail), GFP_NOFS | __GFP_NOFAIL);
446 INIT_LIST_HEAD(&ai->ai_ail1_list);
447 INIT_LIST_HEAD(&ai->ai_ail2_list);
448
449 down_write(&sdp->sd_log_flush_lock); 452 down_write(&sdp->sd_log_flush_lock);
450 453
451 if (gl) { 454 if (gl) {
@@ -453,12 +456,14 @@ void gfs2_log_flush_i(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
453 if (list_empty(&gl->gl_le.le_list)) { 456 if (list_empty(&gl->gl_le.le_list)) {
454 gfs2_log_unlock(sdp); 457 gfs2_log_unlock(sdp);
455 up_write(&sdp->sd_log_flush_lock); 458 up_write(&sdp->sd_log_flush_lock);
456 kfree(ai);
457 return; 459 return;
458 } 460 }
459 gfs2_log_unlock(sdp); 461 gfs2_log_unlock(sdp);
460 } 462 }
461 463
464 ai = kzalloc(sizeof(struct gfs2_ail), GFP_NOFS | __GFP_NOFAIL);
465 INIT_LIST_HEAD(&ai->ai_ail1_list);
466 INIT_LIST_HEAD(&ai->ai_ail2_list);
462 467
463 gfs2_assert_withdraw(sdp, 468 gfs2_assert_withdraw(sdp,
464 sdp->sd_log_num_buf == sdp->sd_log_commited_buf); 469 sdp->sd_log_num_buf == sdp->sd_log_commited_buf);
@@ -476,11 +481,12 @@ void gfs2_log_flush_i(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
476 log_write_header(sdp, 0, PULL); 481 log_write_header(sdp, 0, PULL);
477 lops_after_commit(sdp, ai); 482 lops_after_commit(sdp, ai);
478 sdp->sd_log_head = sdp->sd_log_flush_head; 483 sdp->sd_log_head = sdp->sd_log_flush_head;
479 if (sdp->sd_log_flush_wrapped) 484
480 sdp->sd_log_wraps++; 485 /* printk(KERN_INFO "sd_log_num_hdrs %u\n", sdp->sd_log_num_hdrs); */
481 486
482 sdp->sd_log_blks_reserved = 487 sdp->sd_log_blks_reserved =
483 sdp->sd_log_commited_buf = 488 sdp->sd_log_commited_buf =
489 sdp->sd_log_num_hdrs =
484 sdp->sd_log_commited_revoke = 0; 490 sdp->sd_log_commited_revoke = 0;
485 491
486 gfs2_log_lock(sdp); 492 gfs2_log_lock(sdp);
@@ -519,8 +525,7 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
519 sdp->sd_log_blks_free += tr->tr_reserved - 525 sdp->sd_log_blks_free += tr->tr_reserved -
520 (reserved - sdp->sd_log_blks_reserved); 526 (reserved - sdp->sd_log_blks_reserved);
521 527
522 gfs2_assert_withdraw(sdp, 528 gfs2_assert_withdraw(sdp, sdp->sd_log_blks_free >= old);
523 sdp->sd_log_blks_free >= old);
524 gfs2_assert_withdraw(sdp, 529 gfs2_assert_withdraw(sdp,
525 sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks); 530 sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks);
526 531
@@ -548,7 +553,7 @@ void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
548 gfs2_log_lock(sdp); 553 gfs2_log_lock(sdp);
549 if (sdp->sd_log_num_buf > gfs2_tune_get(sdp, gt_incore_log_blocks)) { 554 if (sdp->sd_log_num_buf > gfs2_tune_get(sdp, gt_incore_log_blocks)) {
550 gfs2_log_unlock(sdp); 555 gfs2_log_unlock(sdp);
551 gfs2_log_flush(sdp); 556 gfs2_log_flush(sdp, NULL);
552 } else 557 } else
553 gfs2_log_unlock(sdp); 558 gfs2_log_unlock(sdp);
554} 559}
@@ -583,8 +588,6 @@ void gfs2_log_shutdown(struct gfs2_sbd *sdp)
583 gfs2_assert_withdraw(sdp, list_empty(&sdp->sd_ail2_list)); 588 gfs2_assert_withdraw(sdp, list_empty(&sdp->sd_ail2_list));
584 589
585 sdp->sd_log_head = sdp->sd_log_flush_head; 590 sdp->sd_log_head = sdp->sd_log_flush_head;
586 if (sdp->sd_log_flush_wrapped)
587 sdp->sd_log_wraps++;
588 sdp->sd_log_tail = sdp->sd_log_head; 591 sdp->sd_log_tail = sdp->sd_log_head;
589 592
590 up_write(&sdp->sd_log_flush_lock); 593 up_write(&sdp->sd_log_flush_lock);
diff --git a/fs/gfs2/log.h b/fs/gfs2/log.h
index e7a6a65c530f..84a3e902e848 100644
--- a/fs/gfs2/log.h
+++ b/fs/gfs2/log.h
@@ -37,7 +37,6 @@ static inline void gfs2_log_pointers_init(struct gfs2_sbd *sdp,
37{ 37{
38 if (++value == sdp->sd_jdesc->jd_blocks) { 38 if (++value == sdp->sd_jdesc->jd_blocks) {
39 value = 0; 39 value = 0;
40 sdp->sd_log_wraps++;
41 } 40 }
42 sdp->sd_log_head = sdp->sd_log_tail = value; 41 sdp->sd_log_head = sdp->sd_log_tail = value;
43} 42}
@@ -54,10 +53,7 @@ void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks);
54struct buffer_head *gfs2_log_get_buf(struct gfs2_sbd *sdp); 53struct buffer_head *gfs2_log_get_buf(struct gfs2_sbd *sdp);
55struct buffer_head *gfs2_log_fake_buf(struct gfs2_sbd *sdp, 54struct buffer_head *gfs2_log_fake_buf(struct gfs2_sbd *sdp,
56 struct buffer_head *real); 55 struct buffer_head *real);
57 56void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl);
58#define gfs2_log_flush(sdp) gfs2_log_flush_i((sdp), NULL)
59#define gfs2_log_flush_glock(gl) gfs2_log_flush_i((gl)->gl_sbd, (gl))
60void gfs2_log_flush_i(struct gfs2_sbd *sdp, struct gfs2_glock *gl);
61void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *trans); 57void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *trans);
62 58
63void gfs2_log_shutdown(struct gfs2_sbd *sdp); 59void gfs2_log_shutdown(struct gfs2_sbd *sdp);
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
index 689c9101c0fb..4d90eb311497 100644
--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -130,6 +130,7 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp)
130 if (total > limit) 130 if (total > limit)
131 num = limit; 131 num = limit;
132 bh = gfs2_log_get_buf(sdp); 132 bh = gfs2_log_get_buf(sdp);
133 sdp->sd_log_num_hdrs++;
133 ld = (struct gfs2_log_descriptor *)bh->b_data; 134 ld = (struct gfs2_log_descriptor *)bh->b_data;
134 ptr = (__be64 *)(bh->b_data + offset); 135 ptr = (__be64 *)(bh->b_data + offset);
135 ld->ld_header.mh_magic = cpu_to_be32(GFS2_MAGIC); 136 ld->ld_header.mh_magic = cpu_to_be32(GFS2_MAGIC);
@@ -570,6 +571,7 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
570 gfs2_log_unlock(sdp); 571 gfs2_log_unlock(sdp);
571 if (!bh) { 572 if (!bh) {
572 bh = gfs2_log_get_buf(sdp); 573 bh = gfs2_log_get_buf(sdp);
574 sdp->sd_log_num_hdrs++;
573 ld = (struct gfs2_log_descriptor *) 575 ld = (struct gfs2_log_descriptor *)
574 bh->b_data; 576 bh->b_data;
575 ptr = (__be64 *)(bh->b_data + offset); 577 ptr = (__be64 *)(bh->b_data + offset);
@@ -750,13 +752,13 @@ static void databuf_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
750} 752}
751 753
752 754
753struct gfs2_log_operations gfs2_glock_lops = { 755const struct gfs2_log_operations gfs2_glock_lops = {
754 .lo_add = glock_lo_add, 756 .lo_add = glock_lo_add,
755 .lo_after_commit = glock_lo_after_commit, 757 .lo_after_commit = glock_lo_after_commit,
756 .lo_name = "glock" 758 .lo_name = "glock"
757}; 759};
758 760
759struct gfs2_log_operations gfs2_buf_lops = { 761const struct gfs2_log_operations gfs2_buf_lops = {
760 .lo_add = buf_lo_add, 762 .lo_add = buf_lo_add,
761 .lo_incore_commit = buf_lo_incore_commit, 763 .lo_incore_commit = buf_lo_incore_commit,
762 .lo_before_commit = buf_lo_before_commit, 764 .lo_before_commit = buf_lo_before_commit,
@@ -767,7 +769,7 @@ struct gfs2_log_operations gfs2_buf_lops = {
767 .lo_name = "buf" 769 .lo_name = "buf"
768}; 770};
769 771
770struct gfs2_log_operations gfs2_revoke_lops = { 772const struct gfs2_log_operations gfs2_revoke_lops = {
771 .lo_add = revoke_lo_add, 773 .lo_add = revoke_lo_add,
772 .lo_before_commit = revoke_lo_before_commit, 774 .lo_before_commit = revoke_lo_before_commit,
773 .lo_before_scan = revoke_lo_before_scan, 775 .lo_before_scan = revoke_lo_before_scan,
@@ -776,13 +778,13 @@ struct gfs2_log_operations gfs2_revoke_lops = {
776 .lo_name = "revoke" 778 .lo_name = "revoke"
777}; 779};
778 780
779struct gfs2_log_operations gfs2_rg_lops = { 781const struct gfs2_log_operations gfs2_rg_lops = {
780 .lo_add = rg_lo_add, 782 .lo_add = rg_lo_add,
781 .lo_after_commit = rg_lo_after_commit, 783 .lo_after_commit = rg_lo_after_commit,
782 .lo_name = "rg" 784 .lo_name = "rg"
783}; 785};
784 786
785struct gfs2_log_operations gfs2_databuf_lops = { 787const struct gfs2_log_operations gfs2_databuf_lops = {
786 .lo_add = databuf_lo_add, 788 .lo_add = databuf_lo_add,
787 .lo_incore_commit = buf_lo_incore_commit, 789 .lo_incore_commit = buf_lo_incore_commit,
788 .lo_before_commit = databuf_lo_before_commit, 790 .lo_before_commit = databuf_lo_before_commit,
@@ -792,7 +794,7 @@ struct gfs2_log_operations gfs2_databuf_lops = {
792 .lo_name = "databuf" 794 .lo_name = "databuf"
793}; 795};
794 796
795struct gfs2_log_operations *gfs2_log_ops[] = { 797const struct gfs2_log_operations *gfs2_log_ops[] = {
796 &gfs2_glock_lops, 798 &gfs2_glock_lops,
797 &gfs2_buf_lops, 799 &gfs2_buf_lops,
798 &gfs2_revoke_lops, 800 &gfs2_revoke_lops,
diff --git a/fs/gfs2/lops.h b/fs/gfs2/lops.h
index 417f5aade4b1..0c78d222d6f2 100644
--- a/fs/gfs2/lops.h
+++ b/fs/gfs2/lops.h
@@ -10,16 +10,16 @@
10#ifndef __LOPS_DOT_H__ 10#ifndef __LOPS_DOT_H__
11#define __LOPS_DOT_H__ 11#define __LOPS_DOT_H__
12 12
13extern struct gfs2_log_operations gfs2_glock_lops; 13extern const struct gfs2_log_operations gfs2_glock_lops;
14extern struct gfs2_log_operations gfs2_buf_lops; 14extern const struct gfs2_log_operations gfs2_buf_lops;
15extern struct gfs2_log_operations gfs2_revoke_lops; 15extern const struct gfs2_log_operations gfs2_revoke_lops;
16extern struct gfs2_log_operations gfs2_rg_lops; 16extern const struct gfs2_log_operations gfs2_rg_lops;
17extern struct gfs2_log_operations gfs2_databuf_lops; 17extern const struct gfs2_log_operations gfs2_databuf_lops;
18 18
19extern struct gfs2_log_operations *gfs2_log_ops[]; 19extern const struct gfs2_log_operations *gfs2_log_ops[];
20 20
21static inline void lops_init_le(struct gfs2_log_element *le, 21static inline void lops_init_le(struct gfs2_log_element *le,
22 struct gfs2_log_operations *lops) 22 const struct gfs2_log_operations *lops)
23{ 23{
24 INIT_LIST_HEAD(&le->le_list); 24 INIT_LIST_HEAD(&le->le_list);
25 le->le_ops = lops; 25 le->le_ops = lops;
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index b85fa2464666..4a6aacf294d5 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -59,11 +59,12 @@ static int gfs2_aspace_writepage(struct page *page,
59 59
60static void stuck_releasepage(struct buffer_head *bh) 60static void stuck_releasepage(struct buffer_head *bh)
61{ 61{
62 struct gfs2_sbd *sdp = bh->b_page->mapping->host->i_sb->s_fs_info; 62 struct inode *inode = bh->b_page->mapping->host;
63 struct gfs2_sbd *sdp = inode->i_sb->s_fs_info;
63 struct gfs2_bufdata *bd = bh->b_private; 64 struct gfs2_bufdata *bd = bh->b_private;
64 struct gfs2_glock *gl; 65 struct gfs2_glock *gl;
65 66
66 fs_warn(sdp, "stuck in gfs2_releasepage()\n"); 67 fs_warn(sdp, "stuck in gfs2_releasepage() %p\n", inode);
67 fs_warn(sdp, "blkno = %llu, bh->b_count = %d\n", 68 fs_warn(sdp, "blkno = %llu, bh->b_count = %d\n",
68 (uint64_t)bh->b_blocknr, atomic_read(&bh->b_count)); 69 (uint64_t)bh->b_blocknr, atomic_read(&bh->b_count));
69 fs_warn(sdp, "pinned = %u\n", buffer_pinned(bh)); 70 fs_warn(sdp, "pinned = %u\n", buffer_pinned(bh));
@@ -191,7 +192,6 @@ struct inode *gfs2_aspace_get(struct gfs2_sbd *sdp)
191 aspace->u.generic_ip = NULL; 192 aspace->u.generic_ip = NULL;
192 insert_inode_hash(aspace); 193 insert_inode_hash(aspace);
193 } 194 }
194
195 return aspace; 195 return aspace;
196} 196}
197 197
@@ -353,7 +353,7 @@ void gfs2_ail_empty_gl(struct gfs2_glock *gl)
353 gfs2_log_unlock(sdp); 353 gfs2_log_unlock(sdp);
354 354
355 gfs2_trans_end(sdp); 355 gfs2_trans_end(sdp);
356 gfs2_log_flush(sdp); 356 gfs2_log_flush(sdp, NULL);
357} 357}
358 358
359/** 359/**
@@ -876,7 +876,7 @@ void gfs2_meta_ra(struct gfs2_glock *gl, uint64_t dblock, uint32_t extlen)
876 876
877void gfs2_meta_syncfs(struct gfs2_sbd *sdp) 877void gfs2_meta_syncfs(struct gfs2_sbd *sdp)
878{ 878{
879 gfs2_log_flush(sdp); 879 gfs2_log_flush(sdp, NULL);
880 for (;;) { 880 for (;;) {
881 gfs2_ail1_start(sdp, DIO_ALL); 881 gfs2_ail1_start(sdp, DIO_ALL);
882 if (gfs2_ail1_empty(sdp, DIO_ALL)) 882 if (gfs2_ail1_empty(sdp, DIO_ALL))
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index 9bb296717086..3fb1a29f88a6 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -561,8 +561,9 @@ static const u32 gfs2_to_iflags[32] = {
561 [gfs2fl_InheritJdata] = IFLAG_INHERITJDATA, 561 [gfs2fl_InheritJdata] = IFLAG_INHERITJDATA,
562}; 562};
563 563
564static int gfs2_get_flags(struct inode *inode, u32 __user *ptr) 564static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
565{ 565{
566 struct inode *inode = filp->f_dentry->d_inode;
566 struct gfs2_inode *ip = inode->u.generic_ip; 567 struct gfs2_inode *ip = inode->u.generic_ip;
567 struct gfs2_holder gh; 568 struct gfs2_holder gh;
568 int error; 569 int error;
@@ -600,8 +601,9 @@ static int gfs2_get_flags(struct inode *inode, u32 __user *ptr)
600 * @mask: Indicates which flags are valid 601 * @mask: Indicates which flags are valid
601 * 602 *
602 */ 603 */
603static int do_gfs2_set_flags(struct inode *inode, u32 reqflags, u32 mask) 604static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask)
604{ 605{
606 struct inode *inode = filp->f_dentry->d_inode;
605 struct gfs2_inode *ip = inode->u.generic_ip; 607 struct gfs2_inode *ip = inode->u.generic_ip;
606 struct gfs2_sbd *sdp = ip->i_sbd; 608 struct gfs2_sbd *sdp = ip->i_sbd;
607 struct buffer_head *bh; 609 struct buffer_head *bh;
@@ -659,23 +661,22 @@ out:
659 return error; 661 return error;
660} 662}
661 663
662static int gfs2_set_flags(struct inode *inode, u32 __user *ptr) 664static int gfs2_set_flags(struct file *filp, u32 __user *ptr)
663{ 665{
664 u32 iflags, gfsflags; 666 u32 iflags, gfsflags;
665 if (get_user(iflags, ptr)) 667 if (get_user(iflags, ptr))
666 return -EFAULT; 668 return -EFAULT;
667 gfsflags = iflags_cvt(iflags_to_gfs2, iflags); 669 gfsflags = iflags_cvt(iflags_to_gfs2, iflags);
668 return do_gfs2_set_flags(inode, gfsflags, ~0); 670 return do_gfs2_set_flags(filp, gfsflags, ~0);
669} 671}
670 672
671int gfs2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, 673static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
672 unsigned long arg)
673{ 674{
674 switch(cmd) { 675 switch(cmd) {
675 case IFLAGS_GET_IOC: 676 case IFLAGS_GET_IOC:
676 return gfs2_get_flags(inode, (u32 __user *)arg); 677 return gfs2_get_flags(filp, (u32 __user *)arg);
677 case IFLAGS_SET_IOC: 678 case IFLAGS_SET_IOC:
678 return gfs2_set_flags(inode, (u32 __user *)arg); 679 return gfs2_set_flags(filp, (u32 __user *)arg);
679 } 680 }
680 return -ENOTTY; 681 return -ENOTTY;
681} 682}
@@ -808,7 +809,7 @@ static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync)
808{ 809{
809 struct gfs2_inode *ip = dentry->d_inode->u.generic_ip; 810 struct gfs2_inode *ip = dentry->d_inode->u.generic_ip;
810 811
811 gfs2_log_flush_glock(ip->i_gl); 812 gfs2_log_flush(ip->i_gl->gl_sbd, ip->i_gl);
812 813
813 return 0; 814 return 0;
814} 815}
@@ -974,7 +975,7 @@ struct file_operations gfs2_file_fops = {
974 .write = generic_file_write, 975 .write = generic_file_write,
975 .writev = generic_file_writev, 976 .writev = generic_file_writev,
976 .aio_write = generic_file_aio_write, 977 .aio_write = generic_file_aio_write,
977 .ioctl = gfs2_ioctl, 978 .unlocked_ioctl = gfs2_ioctl,
978 .mmap = gfs2_mmap, 979 .mmap = gfs2_mmap,
979 .open = gfs2_open, 980 .open = gfs2_open,
980 .release = gfs2_close, 981 .release = gfs2_close,
@@ -988,7 +989,7 @@ struct file_operations gfs2_file_fops = {
988 989
989struct file_operations gfs2_dir_fops = { 990struct file_operations gfs2_dir_fops = {
990 .readdir = gfs2_readdir, 991 .readdir = gfs2_readdir,
991 .ioctl = gfs2_ioctl, 992 .unlocked_ioctl = gfs2_ioctl,
992 .open = gfs2_open, 993 .open = gfs2_open,
993 .release = gfs2_close, 994 .release = gfs2_close,
994 .fsync = gfs2_fsync, 995 .fsync = gfs2_fsync,
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 5166455b9fdd..4538a1e621e8 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -276,8 +276,8 @@ static struct inode *gfs2_lookup_root(struct gfs2_sbd *sdp,
276 struct gfs2_inode *ip; 276 struct gfs2_inode *ip;
277 struct inode *inode; 277 struct inode *inode;
278 278
279 error = gfs2_glock_get(sdp, inum->no_addr, 279 error = gfs2_glock_get(sdp, inum->no_addr, &gfs2_inode_glops,
280 &gfs2_inode_glops, CREATE, &gl); 280 CREATE, &gl);
281 if (!error) { 281 if (!error) {
282 error = gfs2_inode_get(gl, inum, CREATE, &ip); 282 error = gfs2_inode_get(gl, inum, CREATE, &ip);
283 if (!error) { 283 if (!error) {
diff --git a/fs/gfs2/ops_super.c b/fs/gfs2/ops_super.c
index f7349c0989a9..80ce40c1dfb6 100644
--- a/fs/gfs2/ops_super.c
+++ b/fs/gfs2/ops_super.c
@@ -53,7 +53,7 @@ static int gfs2_write_inode(struct inode *inode, int sync)
53 if (current->flags & PF_MEMALLOC) 53 if (current->flags & PF_MEMALLOC)
54 return 0; 54 return 0;
55 if (ip && sync) 55 if (ip && sync)
56 gfs2_log_flush_glock(ip->i_gl); 56 gfs2_log_flush(ip->i_gl->gl_sbd, ip->i_gl);
57 57
58 return 0; 58 return 0;
59} 59}
@@ -121,10 +121,8 @@ static void gfs2_put_super(struct super_block *sb)
121 } 121 }
122 122
123 gfs2_glock_dq_uninit(&sdp->sd_live_gh); 123 gfs2_glock_dq_uninit(&sdp->sd_live_gh);
124
125 gfs2_clear_rgrpd(sdp); 124 gfs2_clear_rgrpd(sdp);
126 gfs2_jindex_free(sdp); 125 gfs2_jindex_free(sdp);
127
128 /* Take apart glock structures and buffer lists */ 126 /* Take apart glock structures and buffer lists */
129 gfs2_gl_hash_clear(sdp, WAIT); 127 gfs2_gl_hash_clear(sdp, WAIT);
130 128
@@ -135,10 +133,6 @@ static void gfs2_put_super(struct super_block *sb)
135 133
136 gfs2_sys_fs_del(sdp); 134 gfs2_sys_fs_del(sdp);
137 135
138 /* Get rid of any extra inodes */
139 while (invalidate_inodes(sb))
140 yield();
141
142 vfree(sdp); 136 vfree(sdp);
143 137
144 sb->s_fs_info = NULL; 138 sb->s_fs_info = NULL;
@@ -149,13 +143,13 @@ static void gfs2_put_super(struct super_block *sb)
149 * @sb: the filesystem 143 * @sb: the filesystem
150 * 144 *
151 * This function is called every time sync(2) is called. 145 * This function is called every time sync(2) is called.
152 * After this exits, all dirty buffers and synced. 146 * After this exits, all dirty buffers are synced.
153 */ 147 */
154 148
155static void gfs2_write_super(struct super_block *sb) 149static void gfs2_write_super(struct super_block *sb)
156{ 150{
157 struct gfs2_sbd *sdp = sb->s_fs_info; 151 struct gfs2_sbd *sdp = sb->s_fs_info;
158 gfs2_log_flush(sdp); 152 gfs2_log_flush(sdp, NULL);
159} 153}
160 154
161/** 155/**
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index c57b5cf1d583..90e32a3dc50d 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -749,7 +749,7 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
749 while (qx--) 749 while (qx--)
750 gfs2_glock_dq_uninit(&ghs[qx]); 750 gfs2_glock_dq_uninit(&ghs[qx]);
751 kfree(ghs); 751 kfree(ghs);
752 gfs2_log_flush_glock(ip->i_gl); 752 gfs2_log_flush(ip->i_gl->gl_sbd, ip->i_gl);
753 753
754 return error; 754 return error;
755} 755}
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index d72f79e67c94..061f4a9a1db4 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -120,7 +120,7 @@ void gfs2_trans_end(struct gfs2_sbd *sdp)
120 kfree(tr); 120 kfree(tr);
121 121
122 if (sdp->sd_vfs->s_flags & MS_SYNCHRONOUS) 122 if (sdp->sd_vfs->s_flags & MS_SYNCHRONOUS)
123 gfs2_log_flush(sdp); 123 gfs2_log_flush(sdp, NULL);
124} 124}
125 125
126void gfs2_trans_add_gl(struct gfs2_glock *gl) 126void gfs2_trans_add_gl(struct gfs2_glock *gl)