aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/meta_io.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-02-27 17:23:27 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2006-02-27 17:23:27 -0500
commit5c676f6d359b0404d53f542f02e1359583cb2895 (patch)
tree8741011990ec0a3d0d41fee9f0d7abf6a16834cc /fs/gfs2/meta_io.c
parentf3b270a47882b958e9e3c5bd86894e3a7072899a (diff)
[GFS2] Macros removal in gfs2.h
As suggested by Pekka Enberg <penberg@cs.helsinki.fi>. The DIV_RU macro is renamed DIV_ROUND_UP and and moved to kernel.h The other macros are gone from gfs2.h as (although not requested by Pekka Enberg) are a number of included header file which are now included individually. The inode number comparison function is now an inline function. The DT2IF and IF2DT may be addressed in a future patch. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/meta_io.c')
-rw-r--r--fs/gfs2/meta_io.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 53f33fa899f9..b85fa2464666 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -17,9 +17,12 @@
17#include <linux/writeback.h> 17#include <linux/writeback.h>
18#include <linux/swap.h> 18#include <linux/swap.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/gfs2_ondisk.h>
20#include <asm/semaphore.h> 21#include <asm/semaphore.h>
21 22
22#include "gfs2.h" 23#include "gfs2.h"
24#include "lm_interface.h"
25#include "incore.h"
23#include "glock.h" 26#include "glock.h"
24#include "glops.h" 27#include "glops.h"
25#include "inode.h" 28#include "inode.h"
@@ -28,6 +31,7 @@
28#include "meta_io.h" 31#include "meta_io.h"
29#include "rgrp.h" 32#include "rgrp.h"
30#include "trans.h" 33#include "trans.h"
34#include "util.h"
31 35
32#define buffer_busy(bh) \ 36#define buffer_busy(bh) \
33((bh)->b_state & ((1ul << BH_Dirty) | (1ul << BH_Lock) | (1ul << BH_Pinned))) 37((bh)->b_state & ((1ul << BH_Dirty) | (1ul << BH_Lock) | (1ul << BH_Pinned)))
@@ -37,7 +41,7 @@
37static int aspace_get_block(struct inode *inode, sector_t lblock, 41static int aspace_get_block(struct inode *inode, sector_t lblock,
38 struct buffer_head *bh_result, int create) 42 struct buffer_head *bh_result, int create)
39{ 43{
40 gfs2_assert_warn(get_v2sdp(inode->i_sb), 0); 44 gfs2_assert_warn(inode->i_sb->s_fs_info, 0);
41 return -EOPNOTSUPP; 45 return -EOPNOTSUPP;
42} 46}
43 47
@@ -55,15 +59,15 @@ static int gfs2_aspace_writepage(struct page *page,
55 59
56static void stuck_releasepage(struct buffer_head *bh) 60static void stuck_releasepage(struct buffer_head *bh)
57{ 61{
58 struct gfs2_sbd *sdp = get_v2sdp(bh->b_page->mapping->host->i_sb); 62 struct gfs2_sbd *sdp = bh->b_page->mapping->host->i_sb->s_fs_info;
59 struct gfs2_bufdata *bd = get_v2bd(bh); 63 struct gfs2_bufdata *bd = bh->b_private;
60 struct gfs2_glock *gl; 64 struct gfs2_glock *gl;
61 65
62 fs_warn(sdp, "stuck in gfs2_releasepage()\n"); 66 fs_warn(sdp, "stuck in gfs2_releasepage()\n");
63 fs_warn(sdp, "blkno = %llu, bh->b_count = %d\n", 67 fs_warn(sdp, "blkno = %llu, bh->b_count = %d\n",
64 (uint64_t)bh->b_blocknr, atomic_read(&bh->b_count)); 68 (uint64_t)bh->b_blocknr, atomic_read(&bh->b_count));
65 fs_warn(sdp, "pinned = %u\n", buffer_pinned(bh)); 69 fs_warn(sdp, "pinned = %u\n", buffer_pinned(bh));
66 fs_warn(sdp, "get_v2bd(bh) = %s\n", (bd) ? "!NULL" : "NULL"); 70 fs_warn(sdp, "bh->b_private = %s\n", (bd) ? "!NULL" : "NULL");
67 71
68 if (!bd) 72 if (!bd)
69 return; 73 return;
@@ -78,7 +82,7 @@ static void stuck_releasepage(struct buffer_head *bh)
78 (list_empty(&bd->bd_le.le_list)) ? "no" : "yes"); 82 (list_empty(&bd->bd_le.le_list)) ? "no" : "yes");
79 83
80 if (gl->gl_ops == &gfs2_inode_glops) { 84 if (gl->gl_ops == &gfs2_inode_glops) {
81 struct gfs2_inode *ip = get_gl2ip(gl); 85 struct gfs2_inode *ip = gl->gl_object;
82 unsigned int x; 86 unsigned int x;
83 87
84 if (!ip) 88 if (!ip)
@@ -110,7 +114,7 @@ static void stuck_releasepage(struct buffer_head *bh)
110static int gfs2_aspace_releasepage(struct page *page, gfp_t gfp_mask) 114static int gfs2_aspace_releasepage(struct page *page, gfp_t gfp_mask)
111{ 115{
112 struct inode *aspace = page->mapping->host; 116 struct inode *aspace = page->mapping->host;
113 struct gfs2_sbd *sdp = get_v2sdp(aspace->i_sb); 117 struct gfs2_sbd *sdp = aspace->i_sb->s_fs_info;
114 struct buffer_head *bh, *head; 118 struct buffer_head *bh, *head;
115 struct gfs2_bufdata *bd; 119 struct gfs2_bufdata *bd;
116 unsigned long t; 120 unsigned long t;
@@ -139,14 +143,14 @@ static int gfs2_aspace_releasepage(struct page *page, gfp_t gfp_mask)
139 143
140 gfs2_assert_warn(sdp, !buffer_pinned(bh)); 144 gfs2_assert_warn(sdp, !buffer_pinned(bh));
141 145
142 bd = get_v2bd(bh); 146 bd = bh->b_private;
143 if (bd) { 147 if (bd) {
144 gfs2_assert_warn(sdp, bd->bd_bh == bh); 148 gfs2_assert_warn(sdp, bd->bd_bh == bh);
145 gfs2_assert_warn(sdp, list_empty(&bd->bd_list_tr)); 149 gfs2_assert_warn(sdp, list_empty(&bd->bd_list_tr));
146 gfs2_assert_warn(sdp, list_empty(&bd->bd_le.le_list)); 150 gfs2_assert_warn(sdp, list_empty(&bd->bd_le.le_list));
147 gfs2_assert_warn(sdp, !bd->bd_ail); 151 gfs2_assert_warn(sdp, !bd->bd_ail);
148 kmem_cache_free(gfs2_bufdata_cachep, bd); 152 kmem_cache_free(gfs2_bufdata_cachep, bd);
149 set_v2bd(bh, NULL); 153 bh->b_private = NULL;
150 } 154 }
151 155
152 bh = bh->b_this_page; 156 bh = bh->b_this_page;
@@ -184,7 +188,7 @@ struct inode *gfs2_aspace_get(struct gfs2_sbd *sdp)
184 mapping_set_gfp_mask(aspace->i_mapping, GFP_KERNEL); 188 mapping_set_gfp_mask(aspace->i_mapping, GFP_KERNEL);
185 aspace->i_mapping->a_ops = &aspace_aops; 189 aspace->i_mapping->a_ops = &aspace_aops;
186 aspace->i_size = ~0ULL; 190 aspace->i_size = ~0ULL;
187 set_v2ip(aspace, NULL); 191 aspace->u.generic_ip = NULL;
188 insert_inode_hash(aspace); 192 insert_inode_hash(aspace);
189 } 193 }
190 194
@@ -523,7 +527,7 @@ int gfs2_meta_reread(struct gfs2_sbd *sdp, struct buffer_head *bh, int flags)
523 wait_on_buffer(bh); 527 wait_on_buffer(bh);
524 528
525 if (!buffer_uptodate(bh)) { 529 if (!buffer_uptodate(bh)) {
526 struct gfs2_trans *tr = get_transaction; 530 struct gfs2_trans *tr = current->journal_info;
527 if (tr && tr->tr_touched) 531 if (tr && tr->tr_touched)
528 gfs2_io_error_bh(sdp, bh); 532 gfs2_io_error_bh(sdp, bh);
529 return -EIO; 533 return -EIO;
@@ -550,7 +554,7 @@ void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh,
550 if (meta) 554 if (meta)
551 lock_page(bh->b_page); 555 lock_page(bh->b_page);
552 556
553 if (get_v2bd(bh)) { 557 if (bh->b_private) {
554 if (meta) 558 if (meta)
555 unlock_page(bh->b_page); 559 unlock_page(bh->b_page);
556 return; 560 return;
@@ -569,7 +573,7 @@ void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh,
569 lops_init_le(&bd->bd_le, &gfs2_databuf_lops); 573 lops_init_le(&bd->bd_le, &gfs2_databuf_lops);
570 get_bh(bh); 574 get_bh(bh);
571 } 575 }
572 set_v2bd(bh, bd); 576 bh->b_private = bd;
573 577
574 if (meta) 578 if (meta)
575 unlock_page(bh->b_page); 579 unlock_page(bh->b_page);
@@ -584,7 +588,7 @@ void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh,
584 588
585void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh) 589void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh)
586{ 590{
587 struct gfs2_bufdata *bd = get_v2bd(bh); 591 struct gfs2_bufdata *bd = bh->b_private;
588 592
589 gfs2_assert_withdraw(sdp, test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)); 593 gfs2_assert_withdraw(sdp, test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags));
590 594
@@ -621,7 +625,7 @@ void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh)
621void gfs2_unpin(struct gfs2_sbd *sdp, struct buffer_head *bh, 625void gfs2_unpin(struct gfs2_sbd *sdp, struct buffer_head *bh,
622 struct gfs2_ail *ai) 626 struct gfs2_ail *ai)
623{ 627{
624 struct gfs2_bufdata *bd = get_v2bd(bh); 628 struct gfs2_bufdata *bd = bh->b_private;
625 629
626 gfs2_assert_withdraw(sdp, buffer_uptodate(bh)); 630 gfs2_assert_withdraw(sdp, buffer_uptodate(bh));
627 631
@@ -662,15 +666,16 @@ void gfs2_meta_wipe(struct gfs2_inode *ip, uint64_t bstart, uint32_t blen)
662 while (blen) { 666 while (blen) {
663 bh = getbuf(sdp, aspace, bstart, NO_CREATE); 667 bh = getbuf(sdp, aspace, bstart, NO_CREATE);
664 if (bh) { 668 if (bh) {
665 struct gfs2_bufdata *bd = get_v2bd(bh); 669 struct gfs2_bufdata *bd = bh->b_private;
666 670
667 if (test_clear_buffer_pinned(bh)) { 671 if (test_clear_buffer_pinned(bh)) {
672 struct gfs2_trans *tr = current->journal_info;
668 gfs2_log_lock(sdp); 673 gfs2_log_lock(sdp);
669 list_del_init(&bd->bd_le.le_list); 674 list_del_init(&bd->bd_le.le_list);
670 gfs2_assert_warn(sdp, sdp->sd_log_num_buf); 675 gfs2_assert_warn(sdp, sdp->sd_log_num_buf);
671 sdp->sd_log_num_buf--; 676 sdp->sd_log_num_buf--;
672 gfs2_log_unlock(sdp); 677 gfs2_log_unlock(sdp);
673 get_transaction->tr_num_buf_rm++; 678 tr->tr_num_buf_rm++;
674 brelse(bh); 679 brelse(bh);
675 } 680 }
676 if (bd) { 681 if (bd) {