aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/gfs2/acl.c8
-rw-r--r--fs/gfs2/bits.c4
-rw-r--r--fs/gfs2/bmap.c10
-rw-r--r--fs/gfs2/daemon.c4
-rw-r--r--fs/gfs2/dir.c8
-rw-r--r--fs/gfs2/eaops.c4
-rw-r--r--fs/gfs2/eattr.c19
-rw-r--r--fs/gfs2/eattr.h2
-rw-r--r--fs/gfs2/gfs2.h29
-rw-r--r--fs/gfs2/glock.c20
-rw-r--r--fs/gfs2/glops.c21
-rw-r--r--fs/gfs2/incore.h8
-rw-r--r--fs/gfs2/inode.c38
-rw-r--r--fs/gfs2/lm.c5
-rw-r--r--fs/gfs2/log.c8
-rw-r--r--fs/gfs2/lops.c56
-rw-r--r--fs/gfs2/lvb.c4
-rw-r--r--fs/gfs2/lvb.h8
-rw-r--r--fs/gfs2/main.c4
-rw-r--r--fs/gfs2/meta_io.c37
-rw-r--r--fs/gfs2/mount.c4
-rw-r--r--fs/gfs2/ops_address.c34
-rw-r--r--fs/gfs2/ops_dentry.c8
-rw-r--r--fs/gfs2/ops_export.c17
-rw-r--r--fs/gfs2/ops_file.c40
-rw-r--r--fs/gfs2/ops_fstype.c35
-rw-r--r--fs/gfs2/ops_inode.c62
-rw-r--r--fs/gfs2/ops_super.c26
-rw-r--r--fs/gfs2/ops_vm.c8
-rw-r--r--fs/gfs2/page.c12
-rw-r--r--fs/gfs2/quota.c20
-rw-r--r--fs/gfs2/recovery.c29
-rw-r--r--fs/gfs2/rgrp.c10
-rw-r--r--fs/gfs2/super.c36
-rw-r--r--fs/gfs2/sys.c4
-rw-r--r--fs/gfs2/trans.c19
-rw-r--r--fs/gfs2/unlinked.c11
-rw-r--r--fs/gfs2/util.c4
38 files changed, 408 insertions, 268 deletions
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
index 9482a677ea47..e9d05fe94357 100644
--- a/fs/gfs2/acl.c
+++ b/fs/gfs2/acl.c
@@ -15,8 +15,11 @@
15#include <linux/posix_acl.h> 15#include <linux/posix_acl.h>
16#include <linux/posix_acl_xattr.h> 16#include <linux/posix_acl_xattr.h>
17#include <asm/semaphore.h> 17#include <asm/semaphore.h>
18#include <linux/gfs2_ondisk.h>
18 19
19#include "gfs2.h" 20#include "gfs2.h"
21#include "lm_interface.h"
22#include "incore.h"
20#include "acl.h" 23#include "acl.h"
21#include "eaops.h" 24#include "eaops.h"
22#include "eattr.h" 25#include "eattr.h"
@@ -24,6 +27,7 @@
24#include "inode.h" 27#include "inode.h"
25#include "meta_io.h" 28#include "meta_io.h"
26#include "trans.h" 29#include "trans.h"
30#include "util.h"
27 31
28#define ACL_ACCESS 1 32#define ACL_ACCESS 1
29#define ACL_DEFAULT 0 33#define ACL_DEFAULT 0
@@ -157,7 +161,7 @@ int gfs2_check_acl_locked(struct inode *inode, int mask)
157 struct posix_acl *acl = NULL; 161 struct posix_acl *acl = NULL;
158 int error; 162 int error;
159 163
160 error = acl_get(get_v2ip(inode), ACL_ACCESS, &acl, NULL, NULL, NULL); 164 error = acl_get(inode->u.generic_ip, ACL_ACCESS, &acl, NULL, NULL, NULL);
161 if (error) 165 if (error)
162 return error; 166 return error;
163 167
@@ -172,7 +176,7 @@ int gfs2_check_acl_locked(struct inode *inode, int mask)
172 176
173int gfs2_check_acl(struct inode *inode, int mask) 177int gfs2_check_acl(struct inode *inode, int mask)
174{ 178{
175 struct gfs2_inode *ip = get_v2ip(inode); 179 struct gfs2_inode *ip = inode->u.generic_ip;
176 struct gfs2_holder i_gh; 180 struct gfs2_holder i_gh;
177 int error; 181 int error;
178 182
diff --git a/fs/gfs2/bits.c b/fs/gfs2/bits.c
index 57d420a86adf..49585e3de095 100644
--- a/fs/gfs2/bits.c
+++ b/fs/gfs2/bits.c
@@ -21,10 +21,14 @@
21#include <linux/spinlock.h> 21#include <linux/spinlock.h>
22#include <linux/completion.h> 22#include <linux/completion.h>
23#include <linux/buffer_head.h> 23#include <linux/buffer_head.h>
24#include <linux/gfs2_ondisk.h>
24#include <asm/semaphore.h> 25#include <asm/semaphore.h>
25 26
26#include "gfs2.h" 27#include "gfs2.h"
28#include "lm_interface.h"
29#include "incore.h"
27#include "bits.h" 30#include "bits.h"
31#include "util.h"
28 32
29static const char valid_change[16] = { 33static const char valid_change[16] = {
30 /* current */ 34 /* current */
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index e132d8a41008..cd5e4d863ce2 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -12,9 +12,12 @@
12#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13#include <linux/completion.h> 13#include <linux/completion.h>
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/gfs2_ondisk.h>
15#include <asm/semaphore.h> 16#include <asm/semaphore.h>
16 17
17#include "gfs2.h" 18#include "gfs2.h"
19#include "lm_interface.h"
20#include "incore.h"
18#include "bmap.h" 21#include "bmap.h"
19#include "glock.h" 22#include "glock.h"
20#include "inode.h" 23#include "inode.h"
@@ -24,6 +27,7 @@
24#include "rgrp.h" 27#include "rgrp.h"
25#include "trans.h" 28#include "trans.h"
26#include "dir.h" 29#include "dir.h"
30#include "util.h"
27 31
28/* This doesn't need to be that large as max 64 bit pointers in a 4k 32/* This doesn't need to be that large as max 64 bit pointers in a 4k
29 * block is 512, so __u16 is fine for that. It saves stack space to 33 * block is 512, so __u16 is fine for that. It saves stack space to
@@ -660,7 +664,7 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh,
660 664
661 for (x = 0; x < rlist.rl_rgrps; x++) { 665 for (x = 0; x < rlist.rl_rgrps; x++) {
662 struct gfs2_rgrpd *rgd; 666 struct gfs2_rgrpd *rgd;
663 rgd = get_gl2rgd(rlist.rl_ghs[x].gh_gl); 667 rgd = rlist.rl_ghs[x].gh_gl->gl_object;
664 rg_blocks += rgd->rd_ri.ri_length; 668 rg_blocks += rgd->rd_ri.ri_length;
665 } 669 }
666 670
@@ -1021,7 +1025,7 @@ void gfs2_write_calc_reserv(struct gfs2_inode *ip, unsigned int len,
1021 unsigned int tmp; 1025 unsigned int tmp;
1022 1026
1023 if (gfs2_is_dir(ip)) { 1027 if (gfs2_is_dir(ip)) {
1024 *data_blocks = DIV_RU(len, sdp->sd_jbsize) + 2; 1028 *data_blocks = DIV_ROUND_UP(len, sdp->sd_jbsize) + 2;
1025 *ind_blocks = 3 * (sdp->sd_max_jheight - 1); 1029 *ind_blocks = 3 * (sdp->sd_max_jheight - 1);
1026 } else { 1030 } else {
1027 *data_blocks = (len >> sdp->sd_sb.sb_bsize_shift) + 3; 1031 *data_blocks = (len >> sdp->sd_sb.sb_bsize_shift) + 3;
@@ -1029,7 +1033,7 @@ void gfs2_write_calc_reserv(struct gfs2_inode *ip, unsigned int len,
1029 } 1033 }
1030 1034
1031 for (tmp = *data_blocks; tmp > sdp->sd_diptrs;) { 1035 for (tmp = *data_blocks; tmp > sdp->sd_diptrs;) {
1032 tmp = DIV_RU(tmp, sdp->sd_inptrs); 1036 tmp = DIV_ROUND_UP(tmp, sdp->sd_inptrs);
1033 *ind_blocks += tmp; 1037 *ind_blocks += tmp;
1034 } 1038 }
1035} 1039}
diff --git a/fs/gfs2/daemon.c b/fs/gfs2/daemon.c
index cff8d5368d21..94317dc7e42c 100644
--- a/fs/gfs2/daemon.c
+++ b/fs/gfs2/daemon.c
@@ -14,9 +14,12 @@
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/kthread.h> 15#include <linux/kthread.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/gfs2_ondisk.h>
17#include <asm/semaphore.h> 18#include <asm/semaphore.h>
18 19
19#include "gfs2.h" 20#include "gfs2.h"
21#include "lm_interface.h"
22#include "incore.h"
20#include "daemon.h" 23#include "daemon.h"
21#include "glock.h" 24#include "glock.h"
22#include "log.h" 25#include "log.h"
@@ -24,6 +27,7 @@
24#include "recovery.h" 27#include "recovery.h"
25#include "super.h" 28#include "super.h"
26#include "unlinked.h" 29#include "unlinked.h"
30#include "util.h"
27 31
28/* This uses schedule_timeout() instead of msleep() because it's good for 32/* This uses schedule_timeout() instead of msleep() because it's good for
29 the daemons to wake up more often than the timeout when unmounting so 33 the daemons to wake up more often than the timeout when unmounting so
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 56683788a6cf..37f70ca558cc 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -59,9 +59,12 @@
59#include <linux/completion.h> 59#include <linux/completion.h>
60#include <linux/buffer_head.h> 60#include <linux/buffer_head.h>
61#include <linux/sort.h> 61#include <linux/sort.h>
62#include <linux/gfs2_ondisk.h>
62#include <asm/semaphore.h> 63#include <asm/semaphore.h>
63 64
64#include "gfs2.h" 65#include "gfs2.h"
66#include "lm_interface.h"
67#include "incore.h"
65#include "dir.h" 68#include "dir.h"
66#include "glock.h" 69#include "glock.h"
67#include "inode.h" 70#include "inode.h"
@@ -70,6 +73,7 @@
70#include "rgrp.h" 73#include "rgrp.h"
71#include "trans.h" 74#include "trans.h"
72#include "bmap.h" 75#include "bmap.h"
76#include "util.h"
73 77
74#define IS_LEAF 1 /* Hashed (leaf) directory */ 78#define IS_LEAF 1 /* Hashed (leaf) directory */
75#define IS_DINODE 2 /* Linear (stuffed dinode block) directory */ 79#define IS_DINODE 2 /* Linear (stuffed dinode block) directory */
@@ -2196,7 +2200,7 @@ static int leaf_dealloc(struct gfs2_inode *dip, uint32_t index, uint32_t len,
2196 2200
2197 for (x = 0; x < rlist.rl_rgrps; x++) { 2201 for (x = 0; x < rlist.rl_rgrps; x++) {
2198 struct gfs2_rgrpd *rgd; 2202 struct gfs2_rgrpd *rgd;
2199 rgd = get_gl2rgd(rlist.rl_ghs[x].gh_gl); 2203 rgd = rlist.rl_ghs[x].gh_gl->gl_object;
2200 rg_blocks += rgd->rd_ri.ri_length; 2204 rg_blocks += rgd->rd_ri.ri_length;
2201 } 2205 }
2202 2206
@@ -2205,7 +2209,7 @@ static int leaf_dealloc(struct gfs2_inode *dip, uint32_t index, uint32_t len,
2205 goto out_rlist; 2209 goto out_rlist;
2206 2210
2207 error = gfs2_trans_begin(sdp, 2211 error = gfs2_trans_begin(sdp,
2208 rg_blocks + (DIV_RU(size, sdp->sd_jbsize) + 1) + 2212 rg_blocks + (DIV_ROUND_UP(size, sdp->sd_jbsize) + 1) +
2209 RES_DINODE + RES_STATFS + RES_QUOTA, l_blocks); 2213 RES_DINODE + RES_STATFS + RES_QUOTA, l_blocks);
2210 if (error) 2214 if (error)
2211 goto out_rg_gunlock; 2215 goto out_rg_gunlock;
diff --git a/fs/gfs2/eaops.c b/fs/gfs2/eaops.c
index 2914731250c5..4b9f6cff7a34 100644
--- a/fs/gfs2/eaops.c
+++ b/fs/gfs2/eaops.c
@@ -13,13 +13,17 @@
13#include <linux/completion.h> 13#include <linux/completion.h>
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/xattr.h> 15#include <linux/xattr.h>
16#include <linux/gfs2_ondisk.h>
16#include <asm/semaphore.h> 17#include <asm/semaphore.h>
17#include <asm/uaccess.h> 18#include <asm/uaccess.h>
18 19
19#include "gfs2.h" 20#include "gfs2.h"
21#include "lm_interface.h"
22#include "incore.h"
20#include "acl.h" 23#include "acl.h"
21#include "eaops.h" 24#include "eaops.h"
22#include "eattr.h" 25#include "eattr.h"
26#include "util.h"
23 27
24/** 28/**
25 * gfs2_ea_name2type - get the type of the ea, and truncate type from the name 29 * gfs2_ea_name2type - get the type of the ea, and truncate type from the name
diff --git a/fs/gfs2/eattr.c b/fs/gfs2/eattr.c
index 146995d9cd65..8219d471f06c 100644
--- a/fs/gfs2/eattr.c
+++ b/fs/gfs2/eattr.c
@@ -13,10 +13,13 @@
13#include <linux/completion.h> 13#include <linux/completion.h>
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/xattr.h> 15#include <linux/xattr.h>
16#include <linux/gfs2_ondisk.h>
16#include <asm/semaphore.h> 17#include <asm/semaphore.h>
17#include <asm/uaccess.h> 18#include <asm/uaccess.h>
18 19
19#include "gfs2.h" 20#include "gfs2.h"
21#include "lm_interface.h"
22#include "incore.h"
20#include "acl.h" 23#include "acl.h"
21#include "eaops.h" 24#include "eaops.h"
22#include "eattr.h" 25#include "eattr.h"
@@ -26,6 +29,7 @@
26#include "quota.h" 29#include "quota.h"
27#include "rgrp.h" 30#include "rgrp.h"
28#include "trans.h" 31#include "trans.h"
32#include "util.h"
29 33
30/** 34/**
31 * ea_calc_size - returns the acutal number of bytes the request will take up 35 * ea_calc_size - returns the acutal number of bytes the request will take up
@@ -478,7 +482,7 @@ static int ea_get_unstuffed(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
478 struct gfs2_sbd *sdp = ip->i_sbd; 482 struct gfs2_sbd *sdp = ip->i_sbd;
479 struct buffer_head **bh; 483 struct buffer_head **bh;
480 unsigned int amount = GFS2_EA_DATA_LEN(ea); 484 unsigned int amount = GFS2_EA_DATA_LEN(ea);
481 unsigned int nptrs = DIV_RU(amount, sdp->sd_jbsize); 485 unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize);
482 uint64_t *dataptrs = GFS2_EA2DATAPTRS(ea); 486 uint64_t *dataptrs = GFS2_EA2DATAPTRS(ea);
483 unsigned int x; 487 unsigned int x;
484 int error = 0; 488 int error = 0;
@@ -676,7 +680,7 @@ static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
676 unsigned int copy; 680 unsigned int copy;
677 unsigned int x; 681 unsigned int x;
678 682
679 ea->ea_num_ptrs = DIV_RU(er->er_data_len, sdp->sd_jbsize); 683 ea->ea_num_ptrs = DIV_ROUND_UP(er->er_data_len, sdp->sd_jbsize);
680 for (x = 0; x < ea->ea_num_ptrs; x++) { 684 for (x = 0; x < ea->ea_num_ptrs; x++) {
681 struct buffer_head *bh; 685 struct buffer_head *bh;
682 uint64_t block; 686 uint64_t block;
@@ -810,7 +814,7 @@ static int ea_init(struct gfs2_inode *ip, struct gfs2_ea_request *er)
810 unsigned int blks = 1; 814 unsigned int blks = 1;
811 815
812 if (GFS2_EAREQ_SIZE_STUFFED(er) > jbsize) 816 if (GFS2_EAREQ_SIZE_STUFFED(er) > jbsize)
813 blks += DIV_RU(er->er_data_len, jbsize); 817 blks += DIV_ROUND_UP(er->er_data_len, jbsize);
814 818
815 return ea_alloc_skeleton(ip, er, blks, ea_init_i, NULL); 819 return ea_alloc_skeleton(ip, er, blks, ea_init_i, NULL);
816} 820}
@@ -962,7 +966,8 @@ static int ea_set_simple(struct gfs2_inode *ip, struct buffer_head *bh,
962 966
963 es->es_bh = bh; 967 es->es_bh = bh;
964 es->es_ea = ea; 968 es->es_ea = ea;
965 blks = 2 + DIV_RU(es->es_er->er_data_len, ip->i_sbd->sd_jbsize); 969 blks = 2 + DIV_ROUND_UP(es->es_er->er_data_len,
970 ip->i_sbd->sd_jbsize);
966 971
967 error = ea_alloc_skeleton(ip, es->es_er, blks, 972 error = ea_alloc_skeleton(ip, es->es_er, blks,
968 ea_set_simple_alloc, es); 973 ea_set_simple_alloc, es);
@@ -1066,7 +1071,7 @@ static int ea_set_i(struct gfs2_inode *ip, struct gfs2_ea_request *er,
1066 if (!(ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT)) 1071 if (!(ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT))
1067 blks++; 1072 blks++;
1068 if (GFS2_EAREQ_SIZE_STUFFED(er) > ip->i_sbd->sd_jbsize) 1073 if (GFS2_EAREQ_SIZE_STUFFED(er) > ip->i_sbd->sd_jbsize)
1069 blks += DIV_RU(er->er_data_len, ip->i_sbd->sd_jbsize); 1074 blks += DIV_ROUND_UP(er->er_data_len, ip->i_sbd->sd_jbsize);
1070 1075
1071 return ea_alloc_skeleton(ip, er, blks, ea_set_block, el); 1076 return ea_alloc_skeleton(ip, er, blks, ea_set_block, el);
1072} 1077}
@@ -1250,7 +1255,7 @@ static int ea_acl_chmod_unstuffed(struct gfs2_inode *ip,
1250 struct gfs2_sbd *sdp = ip->i_sbd; 1255 struct gfs2_sbd *sdp = ip->i_sbd;
1251 struct buffer_head **bh; 1256 struct buffer_head **bh;
1252 unsigned int amount = GFS2_EA_DATA_LEN(ea); 1257 unsigned int amount = GFS2_EA_DATA_LEN(ea);
1253 unsigned int nptrs = DIV_RU(amount, sdp->sd_jbsize); 1258 unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize);
1254 uint64_t *dataptrs = GFS2_EA2DATAPTRS(ea); 1259 uint64_t *dataptrs = GFS2_EA2DATAPTRS(ea);
1255 unsigned int x; 1260 unsigned int x;
1256 int error; 1261 int error;
@@ -1402,7 +1407,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
1402 1407
1403 for (x = 0; x < rlist.rl_rgrps; x++) { 1408 for (x = 0; x < rlist.rl_rgrps; x++) {
1404 struct gfs2_rgrpd *rgd; 1409 struct gfs2_rgrpd *rgd;
1405 rgd = get_gl2rgd(rlist.rl_ghs[x].gh_gl); 1410 rgd = rlist.rl_ghs[x].gh_gl->gl_object;
1406 rg_blocks += rgd->rd_ri.ri_length; 1411 rg_blocks += rgd->rd_ri.ri_length;
1407 } 1412 }
1408 1413
diff --git a/fs/gfs2/eattr.h b/fs/gfs2/eattr.h
index e5a42abf68a3..2b4152b1fcbe 100644
--- a/fs/gfs2/eattr.h
+++ b/fs/gfs2/eattr.h
@@ -29,7 +29,7 @@ ALIGN(sizeof(struct gfs2_ea_header) + (er)->er_name_len + (er)->er_data_len, 8)
29 29
30#define GFS2_EAREQ_SIZE_UNSTUFFED(sdp, er) \ 30#define GFS2_EAREQ_SIZE_UNSTUFFED(sdp, er) \
31ALIGN(sizeof(struct gfs2_ea_header) + (er)->er_name_len + \ 31ALIGN(sizeof(struct gfs2_ea_header) + (er)->er_name_len + \
32 sizeof(uint64_t) * DIV_RU((er)->er_data_len, (sdp)->sd_jbsize), 8) 32 sizeof(uint64_t) * DIV_ROUND_UP((er)->er_data_len, (sdp)->sd_jbsize), 8)
33 33
34#define GFS2_EA2NAME(ea) ((char *)((struct gfs2_ea_header *)(ea) + 1)) 34#define GFS2_EA2NAME(ea) ((char *)((struct gfs2_ea_header *)(ea) + 1))
35#define GFS2_EA2DATA(ea) (GFS2_EA2NAME(ea) + (ea)->ea_name_len) 35#define GFS2_EA2DATA(ea) (GFS2_EA2NAME(ea) + (ea)->ea_name_len)
diff --git a/fs/gfs2/gfs2.h b/fs/gfs2/gfs2.h
index 6c53d080675c..57175f70e2bd 100644
--- a/fs/gfs2/gfs2.h
+++ b/fs/gfs2/gfs2.h
@@ -10,13 +10,6 @@
10#ifndef __GFS2_DOT_H__ 10#ifndef __GFS2_DOT_H__
11#define __GFS2_DOT_H__ 11#define __GFS2_DOT_H__
12 12
13#include <linux/gfs2_ondisk.h>
14
15#include "lm_interface.h"
16#include "lvb.h"
17#include "incore.h"
18#include "util.h"
19
20enum { 13enum {
21 NO_CREATE = 0, 14 NO_CREATE = 0,
22 CREATE = 1, 15 CREATE = 1,
@@ -32,29 +25,7 @@ enum {
32 FORCE = 1, 25 FORCE = 1,
33}; 26};
34 27
35/* Divide num by den. Round up if there is a remainder. */
36#define DIV_RU(num, den) (((num) + (den) - 1) / (den))
37
38#define GFS2_FAST_NAME_SIZE 8 28#define GFS2_FAST_NAME_SIZE 8
39 29
40#define get_v2sdp(sb) ((struct gfs2_sbd *)(sb)->s_fs_info)
41#define set_v2sdp(sb, sdp) (sb)->s_fs_info = (sdp)
42#define get_v2ip(inode) ((struct gfs2_inode *)(inode)->u.generic_ip)
43#define set_v2ip(inode, ip) (inode)->u.generic_ip = (ip)
44#define get_v2fp(file) ((struct gfs2_file *)(file)->private_data)
45#define set_v2fp(file, fp) (file)->private_data = (fp)
46#define get_v2bd(bh) ((struct gfs2_bufdata *)(bh)->b_private)
47#define set_v2bd(bh, bd) (bh)->b_private = (bd)
48
49#define get_transaction ((struct gfs2_trans *)(current->journal_info))
50#define set_transaction(tr) (current->journal_info) = (tr)
51
52#define get_gl2ip(gl) ((struct gfs2_inode *)(gl)->gl_object)
53#define set_gl2ip(gl, ip) (gl)->gl_object = (ip)
54#define get_gl2rgd(gl) ((struct gfs2_rgrpd *)(gl)->gl_object)
55#define set_gl2rgd(gl, rgd) (gl)->gl_object = (rgd)
56#define get_gl2gl(gl) ((struct gfs2_glock *)(gl)->gl_object)
57#define set_gl2gl(gl, gl2) (gl)->gl_object = (gl2)
58
59#endif /* __GFS2_DOT_H__ */ 30#endif /* __GFS2_DOT_H__ */
60 31
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index f30fde91d14a..81b06812b329 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -16,10 +16,13 @@
16#include <linux/sort.h> 16#include <linux/sort.h>
17#include <linux/jhash.h> 17#include <linux/jhash.h>
18#include <linux/kref.h> 18#include <linux/kref.h>
19#include <linux/gfs2_ondisk.h>
19#include <asm/semaphore.h> 20#include <asm/semaphore.h>
20#include <asm/uaccess.h> 21#include <asm/uaccess.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 "quota.h" 32#include "quota.h"
30#include "super.h" 33#include "super.h"
34#include "util.h"
31 35
32/* Must be kept in sync with the beginning of struct gfs2_glock */ 36/* Must be kept in sync with the beginning of struct gfs2_glock */
33struct glock_plug { 37struct glock_plug {
@@ -1962,7 +1966,7 @@ void gfs2_try_toss_inode(struct gfs2_sbd *sdp, struct gfs2_inum *inum)
1962 if (!gfs2_glmutex_trylock(gl)) 1966 if (!gfs2_glmutex_trylock(gl))
1963 goto out; 1967 goto out;
1964 1968
1965 ip = get_gl2ip(gl); 1969 ip = gl->gl_object;
1966 if (!ip) 1970 if (!ip)
1967 goto out_unlock; 1971 goto out_unlock;
1968 1972
@@ -1994,7 +1998,7 @@ void gfs2_iopen_go_callback(struct gfs2_glock *io_gl, unsigned int state)
1994 return; 1998 return;
1995 1999
1996 spin_lock(&io_gl->gl_spin); 2000 spin_lock(&io_gl->gl_spin);
1997 i_gl = get_gl2gl(io_gl); 2001 i_gl = io_gl->gl_object;
1998 if (i_gl) { 2002 if (i_gl) {
1999 gfs2_glock_hold(i_gl); 2003 gfs2_glock_hold(i_gl);
2000 spin_unlock(&io_gl->gl_spin); 2004 spin_unlock(&io_gl->gl_spin);
@@ -2004,7 +2008,7 @@ void gfs2_iopen_go_callback(struct gfs2_glock *io_gl, unsigned int state)
2004 } 2008 }
2005 2009
2006 if (gfs2_glmutex_trylock(i_gl)) { 2010 if (gfs2_glmutex_trylock(i_gl)) {
2007 struct gfs2_inode *ip = get_gl2ip(i_gl); 2011 struct gfs2_inode *ip = i_gl->gl_object;
2008 if (ip) { 2012 if (ip) {
2009 gfs2_try_toss_vnode(ip); 2013 gfs2_try_toss_vnode(ip);
2010 gfs2_glmutex_unlock(i_gl); 2014 gfs2_glmutex_unlock(i_gl);
@@ -2093,7 +2097,7 @@ void gfs2_reclaim_glock(struct gfs2_sbd *sdp)
2093 2097
2094 if (gfs2_glmutex_trylock(gl)) { 2098 if (gfs2_glmutex_trylock(gl)) {
2095 if (gl->gl_ops == &gfs2_inode_glops) { 2099 if (gl->gl_ops == &gfs2_inode_glops) {
2096 struct gfs2_inode *ip = get_gl2ip(gl); 2100 struct gfs2_inode *ip = gl->gl_object;
2097 if (ip && !atomic_read(&ip->i_count)) 2101 if (ip && !atomic_read(&ip->i_count))
2098 gfs2_inode_destroy(ip); 2102 gfs2_inode_destroy(ip);
2099 } 2103 }
@@ -2174,7 +2178,7 @@ static void scan_glock(struct gfs2_glock *gl)
2174{ 2178{
2175 if (gfs2_glmutex_trylock(gl)) { 2179 if (gfs2_glmutex_trylock(gl)) {
2176 if (gl->gl_ops == &gfs2_inode_glops) { 2180 if (gl->gl_ops == &gfs2_inode_glops) {
2177 struct gfs2_inode *ip = get_gl2ip(gl); 2181 struct gfs2_inode *ip = gl->gl_object;
2178 if (ip && !atomic_read(&ip->i_count)) 2182 if (ip && !atomic_read(&ip->i_count))
2179 goto out_schedule; 2183 goto out_schedule;
2180 } 2184 }
@@ -2234,7 +2238,7 @@ static void clear_glock(struct gfs2_glock *gl)
2234 2238
2235 if (gfs2_glmutex_trylock(gl)) { 2239 if (gfs2_glmutex_trylock(gl)) {
2236 if (gl->gl_ops == &gfs2_inode_glops) { 2240 if (gl->gl_ops == &gfs2_inode_glops) {
2237 struct gfs2_inode *ip = get_gl2ip(gl); 2241 struct gfs2_inode *ip = gl->gl_object;
2238 if (ip && !atomic_read(&ip->i_count)) 2242 if (ip && !atomic_read(&ip->i_count))
2239 gfs2_inode_destroy(ip); 2243 gfs2_inode_destroy(ip);
2240 } 2244 }
@@ -2430,10 +2434,10 @@ static int dump_glock(struct gfs2_glock *gl)
2430 if (error) 2434 if (error)
2431 goto out; 2435 goto out;
2432 } 2436 }
2433 if (gl->gl_ops == &gfs2_inode_glops && get_gl2ip(gl)) { 2437 if (gl->gl_ops == &gfs2_inode_glops && gl->gl_object) {
2434 if (!test_bit(GLF_LOCK, &gl->gl_flags) && 2438 if (!test_bit(GLF_LOCK, &gl->gl_flags) &&
2435 list_empty(&gl->gl_holders)) { 2439 list_empty(&gl->gl_holders)) {
2436 error = dump_inode(get_gl2ip(gl)); 2440 error = dump_inode(gl->gl_object);
2437 if (error) 2441 if (error)
2438 goto out; 2442 goto out;
2439 } else { 2443 } else {
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index 27374306ecde..d9334eb72df8 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -12,9 +12,12 @@
12#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13#include <linux/completion.h> 13#include <linux/completion.h>
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/gfs2_ondisk.h>
15#include <asm/semaphore.h> 16#include <asm/semaphore.h>
16 17
17#include "gfs2.h" 18#include "gfs2.h"
19#include "lm_interface.h"
20#include "incore.h"
18#include "bmap.h" 21#include "bmap.h"
19#include "glock.h" 22#include "glock.h"
20#include "glops.h" 23#include "glops.h"
@@ -24,6 +27,7 @@
24#include "page.h" 27#include "page.h"
25#include "recovery.h" 28#include "recovery.h"
26#include "rgrp.h" 29#include "rgrp.h"
30#include "util.h"
27 31
28/** 32/**
29 * meta_go_sync - sync out the metadata for this glock 33 * meta_go_sync - sync out the metadata for this glock
@@ -193,7 +197,7 @@ static int inode_go_demote_ok(struct gfs2_glock *gl)
193 struct gfs2_sbd *sdp = gl->gl_sbd; 197 struct gfs2_sbd *sdp = gl->gl_sbd;
194 int demote = 0; 198 int demote = 0;
195 199
196 if (!get_gl2ip(gl) && !gl->gl_aspace->i_mapping->nrpages) 200 if (!gl->gl_object && !gl->gl_aspace->i_mapping->nrpages)
197 demote = 1; 201 demote = 1;
198 else if (!sdp->sd_args.ar_localcaching && 202 else if (!sdp->sd_args.ar_localcaching &&
199 time_after_eq(jiffies, gl->gl_stamp + 203 time_after_eq(jiffies, gl->gl_stamp +
@@ -214,7 +218,7 @@ static int inode_go_demote_ok(struct gfs2_glock *gl)
214static int inode_go_lock(struct gfs2_holder *gh) 218static int inode_go_lock(struct gfs2_holder *gh)
215{ 219{
216 struct gfs2_glock *gl = gh->gh_gl; 220 struct gfs2_glock *gl = gh->gh_gl;
217 struct gfs2_inode *ip = get_gl2ip(gl); 221 struct gfs2_inode *ip = gl->gl_object;
218 int error = 0; 222 int error = 0;
219 223
220 if (!ip) 224 if (!ip)
@@ -246,7 +250,7 @@ static int inode_go_lock(struct gfs2_holder *gh)
246static void inode_go_unlock(struct gfs2_holder *gh) 250static void inode_go_unlock(struct gfs2_holder *gh)
247{ 251{
248 struct gfs2_glock *gl = gh->gh_gl; 252 struct gfs2_glock *gl = gh->gh_gl;
249 struct gfs2_inode *ip = get_gl2ip(gl); 253 struct gfs2_inode *ip = gl->gl_object;
250 254
251 if (ip && test_bit(GLF_DIRTY, &gl->gl_flags)) 255 if (ip && test_bit(GLF_DIRTY, &gl->gl_flags))
252 gfs2_inode_attr_in(ip); 256 gfs2_inode_attr_in(ip);
@@ -264,7 +268,7 @@ static void inode_go_unlock(struct gfs2_holder *gh)
264static void inode_greedy(struct gfs2_glock *gl) 268static void inode_greedy(struct gfs2_glock *gl)
265{ 269{
266 struct gfs2_sbd *sdp = gl->gl_sbd; 270 struct gfs2_sbd *sdp = gl->gl_sbd;
267 struct gfs2_inode *ip = get_gl2ip(gl); 271 struct gfs2_inode *ip = gl->gl_object;
268 unsigned int quantum = gfs2_tune_get(sdp, gt_greedy_quantum); 272 unsigned int quantum = gfs2_tune_get(sdp, gt_greedy_quantum);
269 unsigned int max = gfs2_tune_get(sdp, gt_greedy_max); 273 unsigned int max = gfs2_tune_get(sdp, gt_greedy_max);
270 unsigned int new_time; 274 unsigned int new_time;
@@ -311,7 +315,7 @@ static int rgrp_go_demote_ok(struct gfs2_glock *gl)
311 315
312static int rgrp_go_lock(struct gfs2_holder *gh) 316static int rgrp_go_lock(struct gfs2_holder *gh)
313{ 317{
314 return gfs2_rgrp_bh_get(get_gl2rgd(gh->gh_gl)); 318 return gfs2_rgrp_bh_get(gh->gh_gl->gl_object);
315} 319}
316 320
317/** 321/**
@@ -324,7 +328,7 @@ static int rgrp_go_lock(struct gfs2_holder *gh)
324 328
325static void rgrp_go_unlock(struct gfs2_holder *gh) 329static void rgrp_go_unlock(struct gfs2_holder *gh)
326{ 330{
327 gfs2_rgrp_bh_put(get_gl2rgd(gh->gh_gl)); 331 gfs2_rgrp_bh_put(gh->gh_gl->gl_object);
328} 332}
329 333
330/** 334/**
@@ -358,13 +362,14 @@ static void trans_go_xmote_th(struct gfs2_glock *gl, unsigned int state,
358static void trans_go_xmote_bh(struct gfs2_glock *gl) 362static void trans_go_xmote_bh(struct gfs2_glock *gl)
359{ 363{
360 struct gfs2_sbd *sdp = gl->gl_sbd; 364 struct gfs2_sbd *sdp = gl->gl_sbd;
361 struct gfs2_glock *j_gl = get_v2ip(sdp->sd_jdesc->jd_inode)->i_gl; 365 struct gfs2_inode *ip = sdp->sd_jdesc->jd_inode->u.generic_ip;
366 struct gfs2_glock *j_gl = ip->i_gl;
362 struct gfs2_log_header head; 367 struct gfs2_log_header head;
363 int error; 368 int error;
364 369
365 if (gl->gl_state != LM_ST_UNLOCKED && 370 if (gl->gl_state != LM_ST_UNLOCKED &&
366 test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) { 371 test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) {
367 gfs2_meta_cache_flush(get_v2ip(sdp->sd_jdesc->jd_inode)); 372 gfs2_meta_cache_flush(sdp->sd_jdesc->jd_inode->u.generic_ip);
368 j_gl->gl_ops->go_inval(j_gl, DIO_METADATA | DIO_DATA); 373 j_gl->gl_ops->go_inval(j_gl, DIO_METADATA | DIO_DATA);
369 374
370 error = gfs2_find_jhead(sdp->sd_jdesc, &head); 375 error = gfs2_find_jhead(sdp->sd_jdesc, &head);
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 0e550e8e5be3..2443e9aad598 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -313,6 +313,14 @@ enum {
313 QDF_LOCKED = 2, 313 QDF_LOCKED = 2,
314}; 314};
315 315
316struct gfs2_quota_lvb {
317 uint32_t qb_magic;
318 uint32_t __pad;
319 uint64_t qb_limit; /* Hard limit of # blocks to alloc */
320 uint64_t qb_warn; /* Warn user when alloc is above this # */
321 int64_t qb_value; /* Current # blocks allocated */
322};
323
316struct gfs2_quota_data { 324struct gfs2_quota_data {
317 struct list_head qd_list; 325 struct list_head qd_list;
318 unsigned int qd_count; 326 unsigned int qd_count;
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 51ecdb8503b0..ea9e996f3673 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -14,9 +14,12 @@
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/posix_acl.h> 15#include <linux/posix_acl.h>
16#include <linux/sort.h> 16#include <linux/sort.h>
17#include <linux/gfs2_ondisk.h>
17#include <asm/semaphore.h> 18#include <asm/semaphore.h>
18 19
19#include "gfs2.h" 20#include "gfs2.h"
21#include "lm_interface.h"
22#include "incore.h"
20#include "acl.h" 23#include "acl.h"
21#include "bmap.h" 24#include "bmap.h"
22#include "dir.h" 25#include "dir.h"
@@ -33,6 +36,7 @@
33#include "rgrp.h" 36#include "rgrp.h"
34#include "trans.h" 37#include "trans.h"
35#include "unlinked.h" 38#include "unlinked.h"
39#include "util.h"
36 40
37/** 41/**
38 * inode_attr_in - Copy attributes from the dinode into the VFS inode 42 * inode_attr_in - Copy attributes from the dinode into the VFS inode
@@ -176,7 +180,7 @@ struct inode *gfs2_ip2v(struct gfs2_inode *ip)
176 init_special_inode(tmp, tmp->i_mode, tmp->i_rdev); 180 init_special_inode(tmp, tmp->i_mode, tmp->i_rdev);
177 } 181 }
178 182
179 set_v2ip(tmp, NULL); 183 tmp->u.generic_ip = NULL;
180 184
181 for (;;) { 185 for (;;) {
182 spin_lock(&ip->i_spin); 186 spin_lock(&ip->i_spin);
@@ -196,7 +200,7 @@ struct inode *gfs2_ip2v(struct gfs2_inode *ip)
196 200
197 gfs2_inode_hold(ip); 201 gfs2_inode_hold(ip);
198 ip->i_vnode = inode; 202 ip->i_vnode = inode;
199 set_v2ip(inode, ip); 203 inode->u.generic_ip = ip;
200 204
201 spin_unlock(&ip->i_spin); 205 spin_unlock(&ip->i_spin);
202 206
@@ -207,7 +211,7 @@ struct inode *gfs2_ip2v(struct gfs2_inode *ip)
207 211
208static int iget_test(struct inode *inode, void *opaque) 212static int iget_test(struct inode *inode, void *opaque)
209{ 213{
210 struct gfs2_inode *ip = get_v2ip(inode); 214 struct gfs2_inode *ip = inode->u.generic_ip;
211 struct gfs2_inum *inum = (struct gfs2_inum *)opaque; 215 struct gfs2_inum *inum = (struct gfs2_inum *)opaque;
212 216
213 if (ip && ip->i_num.no_addr == inum->no_addr) 217 if (ip && ip->i_num.no_addr == inum->no_addr)
@@ -320,11 +324,11 @@ static int inode_create(struct gfs2_glock *i_gl, struct gfs2_inum *inum,
320 324
321 spin_lock(&io_gl->gl_spin); 325 spin_lock(&io_gl->gl_spin);
322 gfs2_glock_hold(i_gl); 326 gfs2_glock_hold(i_gl);
323 set_gl2gl(io_gl, i_gl); 327 io_gl->gl_object = i_gl;
324 spin_unlock(&io_gl->gl_spin); 328 spin_unlock(&io_gl->gl_spin);
325 329
326 gfs2_glock_hold(i_gl); 330 gfs2_glock_hold(i_gl);
327 set_gl2ip(i_gl, ip); 331 i_gl->gl_object = ip;
328 332
329 atomic_inc(&sdp->sd_inode_count); 333 atomic_inc(&sdp->sd_inode_count);
330 334
@@ -359,7 +363,7 @@ int gfs2_inode_get(struct gfs2_glock *i_gl, struct gfs2_inum *inum, int create,
359 363
360 gfs2_glmutex_lock(i_gl); 364 gfs2_glmutex_lock(i_gl);
361 365
362 *ipp = get_gl2ip(i_gl); 366 *ipp = i_gl->gl_object;
363 if (*ipp) { 367 if (*ipp) {
364 error = -ESTALE; 368 error = -ESTALE;
365 if ((*ipp)->i_num.no_formal_ino != inum->no_formal_ino) 369 if ((*ipp)->i_num.no_formal_ino != inum->no_formal_ino)
@@ -404,10 +408,10 @@ void gfs2_inode_destroy(struct gfs2_inode *ip)
404 struct gfs2_glock *i_gl = ip->i_gl; 408 struct gfs2_glock *i_gl = ip->i_gl;
405 409
406 gfs2_assert_warn(sdp, !atomic_read(&ip->i_count)); 410 gfs2_assert_warn(sdp, !atomic_read(&ip->i_count));
407 gfs2_assert(sdp, get_gl2gl(io_gl) == i_gl); 411 gfs2_assert(sdp, io_gl->gl_object == i_gl);
408 412
409 spin_lock(&io_gl->gl_spin); 413 spin_lock(&io_gl->gl_spin);
410 set_gl2gl(io_gl, NULL); 414 io_gl->gl_object = NULL;
411 gfs2_glock_put(i_gl); 415 gfs2_glock_put(i_gl);
412 spin_unlock(&io_gl->gl_spin); 416 spin_unlock(&io_gl->gl_spin);
413 417
@@ -416,7 +420,7 @@ void gfs2_inode_destroy(struct gfs2_inode *ip)
416 gfs2_meta_cache_flush(ip); 420 gfs2_meta_cache_flush(ip);
417 kmem_cache_free(gfs2_inode_cachep, ip); 421 kmem_cache_free(gfs2_inode_cachep, ip);
418 422
419 set_gl2ip(i_gl, NULL); 423 i_gl->gl_object = NULL;
420 gfs2_glock_put(i_gl); 424 gfs2_glock_put(i_gl);
421 425
422 atomic_dec(&sdp->sd_inode_count); 426 atomic_dec(&sdp->sd_inode_count);
@@ -524,7 +528,7 @@ static int inode_dealloc(struct gfs2_sbd *sdp, struct gfs2_unlinked *ul,
524 goto out; 528 goto out;
525 } 529 }
526 530
527 gfs2_assert_warn(sdp, !get_gl2ip(i_gh.gh_gl)); 531 gfs2_assert_warn(sdp, !i_gh.gh_gl->gl_object);
528 error = inode_create(i_gh.gh_gl, &ul->ul_ut.ut_inum, io_gh->gh_gl, 532 error = inode_create(i_gh.gh_gl, &ul->ul_ut.ut_inum, io_gh->gh_gl,
529 LM_ST_EXCLUSIVE, &ip); 533 LM_ST_EXCLUSIVE, &ip);
530 534
@@ -715,7 +719,7 @@ int gfs2_lookupi(struct inode *dir, struct qstr *name, int is_root,
715 struct inode **inodep) 719 struct inode **inodep)
716{ 720{
717 struct gfs2_inode *ipp; 721 struct gfs2_inode *ipp;
718 struct gfs2_inode *dip = get_v2ip(dir); 722 struct gfs2_inode *dip = dir->u.generic_ip;
719 struct gfs2_sbd *sdp = dip->i_sbd; 723 struct gfs2_sbd *sdp = dip->i_sbd;
720 struct gfs2_holder d_gh; 724 struct gfs2_holder d_gh;
721 struct gfs2_inum inum; 725 struct gfs2_inum inum;
@@ -774,7 +778,7 @@ done:
774 778
775static int pick_formal_ino_1(struct gfs2_sbd *sdp, uint64_t *formal_ino) 779static int pick_formal_ino_1(struct gfs2_sbd *sdp, uint64_t *formal_ino)
776{ 780{
777 struct gfs2_inode *ip = get_v2ip(sdp->sd_ir_inode); 781 struct gfs2_inode *ip = sdp->sd_ir_inode->u.generic_ip;
778 struct buffer_head *bh; 782 struct buffer_head *bh;
779 struct gfs2_inum_range ir; 783 struct gfs2_inum_range ir;
780 int error; 784 int error;
@@ -815,8 +819,8 @@ static int pick_formal_ino_1(struct gfs2_sbd *sdp, uint64_t *formal_ino)
815 819
816static int pick_formal_ino_2(struct gfs2_sbd *sdp, uint64_t *formal_ino) 820static int pick_formal_ino_2(struct gfs2_sbd *sdp, uint64_t *formal_ino)
817{ 821{
818 struct gfs2_inode *ip = get_v2ip(sdp->sd_ir_inode); 822 struct gfs2_inode *ip = sdp->sd_ir_inode->u.generic_ip;
819 struct gfs2_inode *m_ip = get_v2ip(sdp->sd_inum_inode); 823 struct gfs2_inode *m_ip = sdp->sd_inum_inode->u.generic_ip;
820 struct gfs2_holder gh; 824 struct gfs2_holder gh;
821 struct buffer_head *bh; 825 struct buffer_head *bh;
822 struct gfs2_inum_range ir; 826 struct gfs2_inum_range ir;
@@ -1194,7 +1198,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, struct qstr *name,
1194 unsigned int mode) 1198 unsigned int mode)
1195{ 1199{
1196 struct inode *inode; 1200 struct inode *inode;
1197 struct gfs2_inode *dip = get_gl2ip(ghs->gh_gl); 1201 struct gfs2_inode *dip = ghs->gh_gl->gl_object;
1198 struct gfs2_sbd *sdp = dip->i_sbd; 1202 struct gfs2_sbd *sdp = dip->i_sbd;
1199 struct gfs2_unlinked *ul; 1203 struct gfs2_unlinked *ul;
1200 struct gfs2_inode *ip; 1204 struct gfs2_inode *ip;
@@ -1570,7 +1574,7 @@ int gfs2_glock_nq_atime(struct gfs2_holder *gh)
1570{ 1574{
1571 struct gfs2_glock *gl = gh->gh_gl; 1575 struct gfs2_glock *gl = gh->gh_gl;
1572 struct gfs2_sbd *sdp = gl->gl_sbd; 1576 struct gfs2_sbd *sdp = gl->gl_sbd;
1573 struct gfs2_inode *ip = get_gl2ip(gl); 1577 struct gfs2_inode *ip = gl->gl_object;
1574 int64_t curtime, quantum = gfs2_tune_get(sdp, gt_atime_quantum); 1578 int64_t curtime, quantum = gfs2_tune_get(sdp, gt_atime_quantum);
1575 unsigned int state; 1579 unsigned int state;
1576 int flags; 1580 int flags;
@@ -1817,7 +1821,7 @@ int gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr)
1817{ 1821{
1818 int error; 1822 int error;
1819 1823
1820 if (get_transaction) 1824 if (current->journal_info)
1821 return __gfs2_setattr_simple(ip, attr); 1825 return __gfs2_setattr_simple(ip, attr);
1822 1826
1823 error = gfs2_trans_begin(ip->i_sbd, RES_DINODE, 0); 1827 error = gfs2_trans_begin(ip->i_sbd, RES_DINODE, 0);
diff --git a/fs/gfs2/lm.c b/fs/gfs2/lm.c
index 3df8fa00442d..5b3c56d2df2f 100644
--- a/fs/gfs2/lm.c
+++ b/fs/gfs2/lm.c
@@ -13,12 +13,17 @@
13#include <linux/completion.h> 13#include <linux/completion.h>
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/gfs2_ondisk.h>
16#include <asm/semaphore.h> 17#include <asm/semaphore.h>
17 18
18#include "gfs2.h" 19#include "gfs2.h"
20#include "lm_interface.h"
21#include "incore.h"
19#include "glock.h" 22#include "glock.h"
20#include "lm.h" 23#include "lm.h"
21#include "super.h" 24#include "super.h"
25#include "util.h"
26#include "lvb.h"
22 27
23/** 28/**
24 * gfs2_lm_mount - mount a locking protocol 29 * gfs2_lm_mount - mount a locking protocol
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 0e31d46edd4d..32a41a274bf8 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -12,14 +12,18 @@
12#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13#include <linux/completion.h> 13#include <linux/completion.h>
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/gfs2_ondisk.h>
15#include <asm/semaphore.h> 16#include <asm/semaphore.h>
16 17
17#include "gfs2.h" 18#include "gfs2.h"
19#include "lm_interface.h"
20#include "incore.h"
18#include "bmap.h" 21#include "bmap.h"
19#include "glock.h" 22#include "glock.h"
20#include "log.h" 23#include "log.h"
21#include "lops.h" 24#include "lops.h"
22#include "meta_io.h" 25#include "meta_io.h"
26#include "util.h"
23 27
24#define PULL 1 28#define PULL 1
25 29
@@ -80,7 +84,7 @@ unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct,
80 if (nstruct > first) { 84 if (nstruct > first) {
81 second = (sdp->sd_sb.sb_bsize - 85 second = (sdp->sd_sb.sb_bsize -
82 sizeof(struct gfs2_meta_header)) / ssize; 86 sizeof(struct gfs2_meta_header)) / ssize;
83 blks += DIV_RU(nstruct - first, second); 87 blks += DIV_ROUND_UP(nstruct - first, second);
84 } 88 }
85 89
86 return blks; 90 return blks;
@@ -257,7 +261,7 @@ static uint64_t log_bmap(struct gfs2_sbd *sdp, unsigned int lbn)
257 uint64_t dbn; 261 uint64_t dbn;
258 int error; 262 int error;
259 263
260 error = gfs2_block_map(get_v2ip(sdp->sd_jdesc->jd_inode), 264 error = gfs2_block_map(sdp->sd_jdesc->jd_inode->u.generic_ip,
261 lbn, &new, &dbn, NULL); 265 lbn, &new, &dbn, NULL);
262 gfs2_assert_withdraw(sdp, !error && dbn); 266 gfs2_assert_withdraw(sdp, !error && dbn);
263 267
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
index 4bd89c0781e7..430161a05a21 100644
--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -12,9 +12,12 @@
12#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13#include <linux/completion.h> 13#include <linux/completion.h>
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/gfs2_ondisk.h>
15#include <asm/semaphore.h> 16#include <asm/semaphore.h>
16 17
17#include "gfs2.h" 18#include "gfs2.h"
19#include "lm_interface.h"
20#include "incore.h"
18#include "glock.h" 21#include "glock.h"
19#include "log.h" 22#include "log.h"
20#include "lops.h" 23#include "lops.h"
@@ -22,12 +25,14 @@
22#include "recovery.h" 25#include "recovery.h"
23#include "rgrp.h" 26#include "rgrp.h"
24#include "trans.h" 27#include "trans.h"
28#include "util.h"
25 29
26static void glock_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) 30static void glock_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
27{ 31{
28 struct gfs2_glock *gl; 32 struct gfs2_glock *gl;
33 struct gfs2_trans *tr = current->journal_info;
29 34
30 get_transaction->tr_touched = 1; 35 tr->tr_touched = 1;
31 36
32 if (!list_empty(&le->le_list)) 37 if (!list_empty(&le->le_list))
33 return; 38 return;
@@ -68,7 +73,7 @@ static void buf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
68 if (!list_empty(&bd->bd_list_tr)) 73 if (!list_empty(&bd->bd_list_tr))
69 return; 74 return;
70 75
71 tr = get_transaction; 76 tr = current->journal_info;
72 tr->tr_touched = 1; 77 tr->tr_touched = 1;
73 tr->tr_num_buf++; 78 tr->tr_num_buf++;
74 list_add(&bd->bd_list_tr, &tr->tr_list_buf); 79 list_add(&bd->bd_list_tr, &tr->tr_list_buf);
@@ -179,7 +184,8 @@ static void buf_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
179static void buf_lo_before_scan(struct gfs2_jdesc *jd, 184static void buf_lo_before_scan(struct gfs2_jdesc *jd,
180 struct gfs2_log_header *head, int pass) 185 struct gfs2_log_header *head, int pass)
181{ 186{
182 struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; 187 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip;
188 struct gfs2_sbd *sdp = ip->i_sbd;
183 189
184 if (pass != 0) 190 if (pass != 0)
185 return; 191 return;
@@ -192,8 +198,9 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
192 struct gfs2_log_descriptor *ld, __be64 *ptr, 198 struct gfs2_log_descriptor *ld, __be64 *ptr,
193 int pass) 199 int pass)
194{ 200{
195 struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; 201 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip;
196 struct gfs2_glock *gl = get_v2ip(jd->jd_inode)->i_gl; 202 struct gfs2_sbd *sdp = ip->i_sbd;
203 struct gfs2_glock *gl = ip->i_gl;
197 unsigned int blks = be32_to_cpu(ld->ld_data1); 204 unsigned int blks = be32_to_cpu(ld->ld_data1);
198 struct buffer_head *bh_log, *bh_ip; 205 struct buffer_head *bh_log, *bh_ip;
199 uint64_t blkno; 206 uint64_t blkno;
@@ -238,17 +245,18 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
238 245
239static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) 246static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
240{ 247{
241 struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; 248 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip;
249 struct gfs2_sbd *sdp = ip->i_sbd;
242 250
243 if (error) { 251 if (error) {
244 gfs2_meta_sync(get_v2ip(jd->jd_inode)->i_gl, 252 gfs2_meta_sync(ip->i_gl,
245 DIO_START | DIO_WAIT); 253 DIO_START | DIO_WAIT);
246 return; 254 return;
247 } 255 }
248 if (pass != 1) 256 if (pass != 1)
249 return; 257 return;
250 258
251 gfs2_meta_sync(get_v2ip(jd->jd_inode)->i_gl, DIO_START | DIO_WAIT); 259 gfs2_meta_sync(ip->i_gl, DIO_START | DIO_WAIT);
252 260
253 fs_info(sdp, "jid=%u: Replayed %u of %u blocks\n", 261 fs_info(sdp, "jid=%u: Replayed %u of %u blocks\n",
254 jd->jd_jid, sdp->sd_replayed_blocks, sdp->sd_found_blocks); 262 jd->jd_jid, sdp->sd_replayed_blocks, sdp->sd_found_blocks);
@@ -258,7 +266,7 @@ static void revoke_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
258{ 266{
259 struct gfs2_trans *tr; 267 struct gfs2_trans *tr;
260 268
261 tr = get_transaction; 269 tr = current->journal_info;
262 tr->tr_touched = 1; 270 tr->tr_touched = 1;
263 tr->tr_num_revoke++; 271 tr->tr_num_revoke++;
264 272
@@ -324,7 +332,8 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp)
324static void revoke_lo_before_scan(struct gfs2_jdesc *jd, 332static void revoke_lo_before_scan(struct gfs2_jdesc *jd,
325 struct gfs2_log_header *head, int pass) 333 struct gfs2_log_header *head, int pass)
326{ 334{
327 struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; 335 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip;
336 struct gfs2_sbd *sdp = ip->i_sbd;
328 337
329 if (pass != 0) 338 if (pass != 0)
330 return; 339 return;
@@ -337,7 +346,8 @@ static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
337 struct gfs2_log_descriptor *ld, __be64 *ptr, 346 struct gfs2_log_descriptor *ld, __be64 *ptr,
338 int pass) 347 int pass)
339{ 348{
340 struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; 349 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip;
350 struct gfs2_sbd *sdp = ip->i_sbd;
341 unsigned int blks = be32_to_cpu(ld->ld_length); 351 unsigned int blks = be32_to_cpu(ld->ld_length);
342 unsigned int revokes = be32_to_cpu(ld->ld_data1); 352 unsigned int revokes = be32_to_cpu(ld->ld_data1);
343 struct buffer_head *bh; 353 struct buffer_head *bh;
@@ -383,7 +393,8 @@ static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
383 393
384static void revoke_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) 394static void revoke_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
385{ 395{
386 struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; 396 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip;
397 struct gfs2_sbd *sdp = ip->i_sbd;
387 398
388 if (error) { 399 if (error) {
389 gfs2_revoke_clean(sdp); 400 gfs2_revoke_clean(sdp);
@@ -401,8 +412,9 @@ static void revoke_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
401static void rg_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) 412static void rg_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
402{ 413{
403 struct gfs2_rgrpd *rgd; 414 struct gfs2_rgrpd *rgd;
415 struct gfs2_trans *tr = current->journal_info;
404 416
405 get_transaction->tr_touched = 1; 417 tr->tr_touched = 1;
406 418
407 if (!list_empty(&le->le_list)) 419 if (!list_empty(&le->le_list))
408 return; 420 return;
@@ -451,9 +463,9 @@ static void rg_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
451static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) 463static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
452{ 464{
453 struct gfs2_bufdata *bd = container_of(le, struct gfs2_bufdata, bd_le); 465 struct gfs2_bufdata *bd = container_of(le, struct gfs2_bufdata, bd_le);
454 struct gfs2_trans *tr = get_transaction; 466 struct gfs2_trans *tr = current->journal_info;
455 struct address_space *mapping = bd->bd_bh->b_page->mapping; 467 struct address_space *mapping = bd->bd_bh->b_page->mapping;
456 struct gfs2_inode *ip = get_v2ip(mapping->host); 468 struct gfs2_inode *ip = mapping->host->u.generic_ip;
457 469
458 tr->tr_touched = 1; 470 tr->tr_touched = 1;
459 if (!list_empty(&bd->bd_list_tr) && 471 if (!list_empty(&bd->bd_list_tr) &&
@@ -633,7 +645,7 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
633 645
634 bh = bd1->bd_bh; 646 bh = bd1->bd_bh;
635 if (bh) { 647 if (bh) {
636 set_v2bd(bh, NULL); 648 bh->b_private = NULL;
637 gfs2_log_unlock(sdp); 649 gfs2_log_unlock(sdp);
638 wait_on_buffer(bh); 650 wait_on_buffer(bh);
639 brelse(bh); 651 brelse(bh);
@@ -651,8 +663,9 @@ static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
651 struct gfs2_log_descriptor *ld, 663 struct gfs2_log_descriptor *ld,
652 __be64 *ptr, int pass) 664 __be64 *ptr, int pass)
653{ 665{
654 struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; 666 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip;
655 struct gfs2_glock *gl = get_v2ip(jd->jd_inode)->i_gl; 667 struct gfs2_sbd *sdp = ip->i_sbd;
668 struct gfs2_glock *gl = ip->i_gl;
656 unsigned int blks = be32_to_cpu(ld->ld_data1); 669 unsigned int blks = be32_to_cpu(ld->ld_data1);
657 struct buffer_head *bh_log, *bh_ip; 670 struct buffer_head *bh_log, *bh_ip;
658 uint64_t blkno; 671 uint64_t blkno;
@@ -701,10 +714,11 @@ static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
701 714
702static void databuf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) 715static void databuf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
703{ 716{
704 struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; 717 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip;
718 struct gfs2_sbd *sdp = ip->i_sbd;
705 719
706 if (error) { 720 if (error) {
707 gfs2_meta_sync(get_v2ip(jd->jd_inode)->i_gl, 721 gfs2_meta_sync(ip->i_gl,
708 DIO_START | DIO_WAIT); 722 DIO_START | DIO_WAIT);
709 return; 723 return;
710 } 724 }
@@ -712,7 +726,7 @@ static void databuf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
712 return; 726 return;
713 727
714 /* data sync? */ 728 /* data sync? */
715 gfs2_meta_sync(get_v2ip(jd->jd_inode)->i_gl, DIO_START | DIO_WAIT); 729 gfs2_meta_sync(ip->i_gl, DIO_START | DIO_WAIT);
716 730
717 fs_info(sdp, "jid=%u: Replayed %u of %u data blocks\n", 731 fs_info(sdp, "jid=%u: Replayed %u of %u data blocks\n",
718 jd->jd_jid, sdp->sd_replayed_blocks, sdp->sd_found_blocks); 732 jd->jd_jid, sdp->sd_replayed_blocks, sdp->sd_found_blocks);
diff --git a/fs/gfs2/lvb.c b/fs/gfs2/lvb.c
index ca959ebb80c1..63b815dad8e7 100644
--- a/fs/gfs2/lvb.c
+++ b/fs/gfs2/lvb.c
@@ -12,9 +12,13 @@
12#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13#include <linux/completion.h> 13#include <linux/completion.h>
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/gfs2_ondisk.h>
15#include <asm/semaphore.h> 16#include <asm/semaphore.h>
16 17
17#include "gfs2.h" 18#include "gfs2.h"
19#include "lm_interface.h"
20#include "incore.h"
21#include "lvb.h"
18 22
19#define pv(struct, member, fmt) printk(KERN_INFO " "#member" = "fmt"\n", \ 23#define pv(struct, member, fmt) printk(KERN_INFO " "#member" = "fmt"\n", \
20 struct->member); 24 struct->member);
diff --git a/fs/gfs2/lvb.h b/fs/gfs2/lvb.h
index ca9732b2d9f4..1b9eb69b9534 100644
--- a/fs/gfs2/lvb.h
+++ b/fs/gfs2/lvb.h
@@ -12,14 +12,6 @@
12 12
13#define GFS2_MIN_LVB_SIZE 32 13#define GFS2_MIN_LVB_SIZE 32
14 14
15struct gfs2_quota_lvb {
16 uint32_t qb_magic;
17 uint32_t __pad;
18 uint64_t qb_limit; /* Hard limit of # blocks to alloc */
19 uint64_t qb_warn; /* Warn user when alloc is above this # */
20 int64_t qb_value; /* Current # blocks allocated */
21};
22
23void gfs2_quota_lvb_in(struct gfs2_quota_lvb *qb, char *lvb); 15void gfs2_quota_lvb_in(struct gfs2_quota_lvb *qb, char *lvb);
24void gfs2_quota_lvb_out(struct gfs2_quota_lvb *qb, char *lvb); 16void gfs2_quota_lvb_out(struct gfs2_quota_lvb *qb, char *lvb);
25void gfs2_quota_lvb_print(struct gfs2_quota_lvb *qb); 17void gfs2_quota_lvb_print(struct gfs2_quota_lvb *qb);
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c
index 0c60f2b10fdd..c54177790318 100644
--- a/fs/gfs2/main.c
+++ b/fs/gfs2/main.c
@@ -14,11 +14,15 @@
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/gfs2_ondisk.h>
17#include <asm/semaphore.h> 18#include <asm/semaphore.h>
18 19
19#include "gfs2.h" 20#include "gfs2.h"
21#include "lm_interface.h"
22#include "incore.h"
20#include "ops_fstype.h" 23#include "ops_fstype.h"
21#include "sys.h" 24#include "sys.h"
25#include "util.h"
22 26
23/** 27/**
24 * init_gfs2_fs - Register GFS2 as a filesystem 28 * init_gfs2_fs - Register GFS2 as a filesystem
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) {
diff --git a/fs/gfs2/mount.c b/fs/gfs2/mount.c
index 3e42697aafc7..e90ea7d32f9e 100644
--- a/fs/gfs2/mount.c
+++ b/fs/gfs2/mount.c
@@ -12,11 +12,15 @@
12#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13#include <linux/completion.h> 13#include <linux/completion.h>
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/gfs2_ondisk.h>
15#include <asm/semaphore.h> 16#include <asm/semaphore.h>
16 17
17#include "gfs2.h" 18#include "gfs2.h"
19#include "lm_interface.h"
20#include "incore.h"
18#include "mount.h" 21#include "mount.h"
19#include "sys.h" 22#include "sys.h"
23#include "util.h"
20 24
21/** 25/**
22 * gfs2_mount_args - Parse mount options 26 * gfs2_mount_args - Parse mount options
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index 89a8b8fad2e7..01aa4a9b48c3 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -15,9 +15,12 @@
15#include <linux/pagemap.h> 15#include <linux/pagemap.h>
16#include <linux/mpage.h> 16#include <linux/mpage.h>
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/gfs2_ondisk.h>
18#include <asm/semaphore.h> 19#include <asm/semaphore.h>
19 20
20#include "gfs2.h" 21#include "gfs2.h"
22#include "lm_interface.h"
23#include "incore.h"
21#include "bmap.h" 24#include "bmap.h"
22#include "glock.h" 25#include "glock.h"
23#include "inode.h" 26#include "inode.h"
@@ -29,6 +32,7 @@
29#include "trans.h" 32#include "trans.h"
30#include "rgrp.h" 33#include "rgrp.h"
31#include "ops_file.h" 34#include "ops_file.h"
35#include "util.h"
32 36
33/** 37/**
34 * gfs2_get_block - Fills in a buffer head with details about a block 38 * gfs2_get_block - Fills in a buffer head with details about a block
@@ -43,7 +47,7 @@
43int gfs2_get_block(struct inode *inode, sector_t lblock, 47int gfs2_get_block(struct inode *inode, sector_t lblock,
44 struct buffer_head *bh_result, int create) 48 struct buffer_head *bh_result, int create)
45{ 49{
46 struct gfs2_inode *ip = get_v2ip(inode); 50 struct gfs2_inode *ip = inode->u.generic_ip;
47 int new = create; 51 int new = create;
48 uint64_t dblock; 52 uint64_t dblock;
49 int error; 53 int error;
@@ -75,7 +79,7 @@ int gfs2_get_block(struct inode *inode, sector_t lblock,
75static int get_block_noalloc(struct inode *inode, sector_t lblock, 79static int get_block_noalloc(struct inode *inode, sector_t lblock,
76 struct buffer_head *bh_result, int create) 80 struct buffer_head *bh_result, int create)
77{ 81{
78 struct gfs2_inode *ip = get_v2ip(inode); 82 struct gfs2_inode *ip = inode->u.generic_ip;
79 int new = 0; 83 int new = 0;
80 uint64_t dblock; 84 uint64_t dblock;
81 int error; 85 int error;
@@ -96,7 +100,7 @@ static int get_blocks(struct inode *inode, sector_t lblock,
96 unsigned long max_blocks, struct buffer_head *bh_result, 100 unsigned long max_blocks, struct buffer_head *bh_result,
97 int create) 101 int create)
98{ 102{
99 struct gfs2_inode *ip = get_v2ip(inode); 103 struct gfs2_inode *ip = inode->u.generic_ip;
100 int new = create; 104 int new = create;
101 uint64_t dblock; 105 uint64_t dblock;
102 uint32_t extlen; 106 uint32_t extlen;
@@ -124,7 +128,7 @@ static int get_blocks_noalloc(struct inode *inode, sector_t lblock,
124 unsigned long max_blocks, 128 unsigned long max_blocks,
125 struct buffer_head *bh_result, int create) 129 struct buffer_head *bh_result, int create)
126{ 130{
127 struct gfs2_inode *ip = get_v2ip(inode); 131 struct gfs2_inode *ip = inode->u.generic_ip;
128 int new = 0; 132 int new = 0;
129 uint64_t dblock; 133 uint64_t dblock;
130 uint32_t extlen; 134 uint32_t extlen;
@@ -158,7 +162,7 @@ static int get_blocks_noalloc(struct inode *inode, sector_t lblock,
158static int gfs2_writepage(struct page *page, struct writeback_control *wbc) 162static int gfs2_writepage(struct page *page, struct writeback_control *wbc)
159{ 163{
160 struct inode *inode = page->mapping->host; 164 struct inode *inode = page->mapping->host;
161 struct gfs2_inode *ip = get_v2ip(page->mapping->host); 165 struct gfs2_inode *ip = page->mapping->host->u.generic_ip;
162 struct gfs2_sbd *sdp = ip->i_sbd; 166 struct gfs2_sbd *sdp = ip->i_sbd;
163 loff_t i_size = i_size_read(inode); 167 loff_t i_size = i_size_read(inode);
164 pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT; 168 pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT;
@@ -170,7 +174,7 @@ static int gfs2_writepage(struct page *page, struct writeback_control *wbc)
170 unlock_page(page); 174 unlock_page(page);
171 return -EIO; 175 return -EIO;
172 } 176 }
173 if (get_transaction) 177 if (current->journal_info)
174 goto out_ignore; 178 goto out_ignore;
175 179
176 /* Is the page fully outside i_size? (truncate in progress) */ 180 /* Is the page fully outside i_size? (truncate in progress) */
@@ -259,7 +263,7 @@ static int zero_readpage(struct page *page)
259 263
260static int gfs2_readpage(struct file *file, struct page *page) 264static int gfs2_readpage(struct file *file, struct page *page)
261{ 265{
262 struct gfs2_inode *ip = get_v2ip(page->mapping->host); 266 struct gfs2_inode *ip = page->mapping->host->u.generic_ip;
263 struct gfs2_sbd *sdp = ip->i_sbd; 267 struct gfs2_sbd *sdp = ip->i_sbd;
264 struct gfs2_holder gh; 268 struct gfs2_holder gh;
265 int error; 269 int error;
@@ -307,7 +311,7 @@ out_unlock:
307static int gfs2_prepare_write(struct file *file, struct page *page, 311static int gfs2_prepare_write(struct file *file, struct page *page,
308 unsigned from, unsigned to) 312 unsigned from, unsigned to)
309{ 313{
310 struct gfs2_inode *ip = get_v2ip(page->mapping->host); 314 struct gfs2_inode *ip = page->mapping->host->u.generic_ip;
311 struct gfs2_sbd *sdp = ip->i_sbd; 315 struct gfs2_sbd *sdp = ip->i_sbd;
312 unsigned int data_blocks, ind_blocks, rblocks; 316 unsigned int data_blocks, ind_blocks, rblocks;
313 int alloc_required; 317 int alloc_required;
@@ -402,7 +406,7 @@ static int gfs2_commit_write(struct file *file, struct page *page,
402 unsigned from, unsigned to) 406 unsigned from, unsigned to)
403{ 407{
404 struct inode *inode = page->mapping->host; 408 struct inode *inode = page->mapping->host;
405 struct gfs2_inode *ip = get_v2ip(inode); 409 struct gfs2_inode *ip = inode->u.generic_ip;
406 struct gfs2_sbd *sdp = ip->i_sbd; 410 struct gfs2_sbd *sdp = ip->i_sbd;
407 int error = -EOPNOTSUPP; 411 int error = -EOPNOTSUPP;
408 struct buffer_head *dibh; 412 struct buffer_head *dibh;
@@ -482,7 +486,7 @@ fail_nounlock:
482 486
483static sector_t gfs2_bmap(struct address_space *mapping, sector_t lblock) 487static sector_t gfs2_bmap(struct address_space *mapping, sector_t lblock)
484{ 488{
485 struct gfs2_inode *ip = get_v2ip(mapping->host); 489 struct gfs2_inode *ip = mapping->host->u.generic_ip;
486 struct gfs2_holder i_gh; 490 struct gfs2_holder i_gh;
487 sector_t dblock = 0; 491 sector_t dblock = 0;
488 int error; 492 int error;
@@ -504,10 +508,10 @@ static void discard_buffer(struct gfs2_sbd *sdp, struct buffer_head *bh)
504 struct gfs2_bufdata *bd; 508 struct gfs2_bufdata *bd;
505 509
506 gfs2_log_lock(sdp); 510 gfs2_log_lock(sdp);
507 bd = get_v2bd(bh); 511 bd = bh->b_private;
508 if (bd) { 512 if (bd) {
509 bd->bd_bh = NULL; 513 bd->bd_bh = NULL;
510 set_v2bd(bh, NULL); 514 bh->b_private = NULL;
511 gfs2_log_unlock(sdp); 515 gfs2_log_unlock(sdp);
512 brelse(bh); 516 brelse(bh);
513 } else 517 } else
@@ -525,7 +529,7 @@ static void discard_buffer(struct gfs2_sbd *sdp, struct buffer_head *bh)
525 529
526static int gfs2_invalidatepage(struct page *page, unsigned long offset) 530static int gfs2_invalidatepage(struct page *page, unsigned long offset)
527{ 531{
528 struct gfs2_sbd *sdp = get_v2sdp(page->mapping->host->i_sb); 532 struct gfs2_sbd *sdp = page->mapping->host->i_sb->s_fs_info;
529 struct buffer_head *head, *bh, *next; 533 struct buffer_head *head, *bh, *next;
530 unsigned int curr_off = 0; 534 unsigned int curr_off = 0;
531 int ret = 1; 535 int ret = 1;
@@ -557,7 +561,7 @@ static ssize_t gfs2_direct_IO_write(struct kiocb *iocb, const struct iovec *iov,
557{ 561{
558 struct file *file = iocb->ki_filp; 562 struct file *file = iocb->ki_filp;
559 struct inode *inode = file->f_mapping->host; 563 struct inode *inode = file->f_mapping->host;
560 struct gfs2_inode *ip = get_v2ip(inode); 564 struct gfs2_inode *ip = inode->u.generic_ip;
561 struct gfs2_holder gh; 565 struct gfs2_holder gh;
562 int rv; 566 int rv;
563 567
@@ -604,7 +608,7 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb,
604{ 608{
605 struct file *file = iocb->ki_filp; 609 struct file *file = iocb->ki_filp;
606 struct inode *inode = file->f_mapping->host; 610 struct inode *inode = file->f_mapping->host;
607 struct gfs2_inode *ip = get_v2ip(inode); 611 struct gfs2_inode *ip = inode->u.generic_ip;
608 struct gfs2_sbd *sdp = ip->i_sbd; 612 struct gfs2_sbd *sdp = ip->i_sbd;
609 613
610 if (rw == WRITE) 614 if (rw == WRITE)
diff --git a/fs/gfs2/ops_dentry.c b/fs/gfs2/ops_dentry.c
index b020ad8f180b..7f6139288519 100644
--- a/fs/gfs2/ops_dentry.c
+++ b/fs/gfs2/ops_dentry.c
@@ -13,12 +13,16 @@
13#include <linux/completion.h> 13#include <linux/completion.h>
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/smp_lock.h> 15#include <linux/smp_lock.h>
16#include <linux/gfs2_ondisk.h>
16#include <asm/semaphore.h> 17#include <asm/semaphore.h>
17 18
18#include "gfs2.h" 19#include "gfs2.h"
20#include "lm_interface.h"
21#include "incore.h"
19#include "dir.h" 22#include "dir.h"
20#include "glock.h" 23#include "glock.h"
21#include "ops_dentry.h" 24#include "ops_dentry.h"
25#include "util.h"
22 26
23/** 27/**
24 * gfs2_drevalidate - Check directory lookup consistency 28 * gfs2_drevalidate - Check directory lookup consistency
@@ -34,7 +38,7 @@
34static int gfs2_drevalidate(struct dentry *dentry, struct nameidata *nd) 38static int gfs2_drevalidate(struct dentry *dentry, struct nameidata *nd)
35{ 39{
36 struct dentry *parent = dget_parent(dentry); 40 struct dentry *parent = dget_parent(dentry);
37 struct gfs2_inode *dip = get_v2ip(parent->d_inode); 41 struct gfs2_inode *dip = parent->d_inode->u.generic_ip;
38 struct inode *inode; 42 struct inode *inode;
39 struct gfs2_holder d_gh; 43 struct gfs2_holder d_gh;
40 struct gfs2_inode *ip; 44 struct gfs2_inode *ip;
@@ -66,7 +70,7 @@ static int gfs2_drevalidate(struct dentry *dentry, struct nameidata *nd)
66 goto fail_gunlock; 70 goto fail_gunlock;
67 } 71 }
68 72
69 ip = get_v2ip(inode); 73 ip = inode->u.generic_ip;
70 74
71 if (!gfs2_inum_equal(&ip->i_num, &inum)) 75 if (!gfs2_inum_equal(&ip->i_num, &inum))
72 goto invalid_gunlock; 76 goto invalid_gunlock;
diff --git a/fs/gfs2/ops_export.c b/fs/gfs2/ops_export.c
index 60d006402553..d149584cff30 100644
--- a/fs/gfs2/ops_export.c
+++ b/fs/gfs2/ops_export.c
@@ -12,9 +12,12 @@
12#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13#include <linux/completion.h> 13#include <linux/completion.h>
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/gfs2_ondisk.h>
15#include <asm/semaphore.h> 16#include <asm/semaphore.h>
16 17
17#include "gfs2.h" 18#include "gfs2.h"
19#include "lm_interface.h"
20#include "incore.h"
18#include "dir.h" 21#include "dir.h"
19#include "glock.h" 22#include "glock.h"
20#include "glops.h" 23#include "glops.h"
@@ -61,7 +64,7 @@ static int gfs2_encode_fh(struct dentry *dentry, __u32 *fh, int *len,
61 int connectable) 64 int connectable)
62{ 65{
63 struct inode *inode = dentry->d_inode; 66 struct inode *inode = dentry->d_inode;
64 struct gfs2_inode *ip = get_v2ip(inode); 67 struct gfs2_inode *ip = inode->u.generic_ip;
65 struct gfs2_sbd *sdp = ip->i_sbd; 68 struct gfs2_sbd *sdp = ip->i_sbd;
66 69
67 if (*len < 4 || (connectable && *len < 8)) 70 if (*len < 4 || (connectable && *len < 8))
@@ -77,12 +80,12 @@ static int gfs2_encode_fh(struct dentry *dentry, __u32 *fh, int *len,
77 fh[3] = cpu_to_be32(fh[3]); 80 fh[3] = cpu_to_be32(fh[3]);
78 *len = 4; 81 *len = 4;
79 82
80 if (!connectable || ip == get_v2ip(sdp->sd_root_dir)) 83 if (!connectable || ip == sdp->sd_root_dir->u.generic_ip)
81 return *len; 84 return *len;
82 85
83 spin_lock(&dentry->d_lock); 86 spin_lock(&dentry->d_lock);
84 inode = dentry->d_parent->d_inode; 87 inode = dentry->d_parent->d_inode;
85 ip = get_v2ip(inode); 88 ip = inode->u.generic_ip;
86 gfs2_inode_hold(ip); 89 gfs2_inode_hold(ip);
87 spin_unlock(&dentry->d_lock); 90 spin_unlock(&dentry->d_lock);
88 91
@@ -138,8 +141,8 @@ static int gfs2_get_name(struct dentry *parent, char *name,
138 if (!S_ISDIR(dir->i_mode) || !inode) 141 if (!S_ISDIR(dir->i_mode) || !inode)
139 return -EINVAL; 142 return -EINVAL;
140 143
141 dip = get_v2ip(dir); 144 dip = dir->u.generic_ip;
142 ip = get_v2ip(inode); 145 ip = inode->u.generic_ip;
143 146
144 *name = 0; 147 *name = 0;
145 gnfd.inum = ip->i_num; 148 gnfd.inum = ip->i_num;
@@ -181,7 +184,7 @@ static struct dentry *gfs2_get_parent(struct dentry *child)
181 184
182static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_p) 185static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_p)
183{ 186{
184 struct gfs2_sbd *sdp = get_v2sdp(sb); 187 struct gfs2_sbd *sdp = sb->s_fs_info;
185 struct gfs2_inum *inum = (struct gfs2_inum *)inum_p; 188 struct gfs2_inum *inum = (struct gfs2_inum *)inum_p;
186 struct gfs2_holder i_gh, ri_gh, rgd_gh; 189 struct gfs2_holder i_gh, ri_gh, rgd_gh;
187 struct gfs2_rgrpd *rgd; 190 struct gfs2_rgrpd *rgd;
@@ -194,7 +197,7 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_p)
194 197
195 inode = gfs2_iget(sb, inum); 198 inode = gfs2_iget(sb, inum);
196 if (inode) { 199 if (inode) {
197 ip = get_v2ip(inode); 200 ip = inode->u.generic_ip;
198 if (ip->i_num.no_formal_ino != inum->no_formal_ino) { 201 if (ip->i_num.no_formal_ino != inum->no_formal_ino) {
199 iput(inode); 202 iput(inode);
200 return ERR_PTR(-ESTALE); 203 return ERR_PTR(-ESTALE);
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index e6ae2551b0cb..d30c6db46241 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -19,10 +19,13 @@
19#include <linux/smp_lock.h> 19#include <linux/smp_lock.h>
20#include <linux/gfs2_ioctl.h> 20#include <linux/gfs2_ioctl.h>
21#include <linux/fs.h> 21#include <linux/fs.h>
22#include <linux/gfs2_ondisk.h>
22#include <asm/semaphore.h> 23#include <asm/semaphore.h>
23#include <asm/uaccess.h> 24#include <asm/uaccess.h>
24 25
25#include "gfs2.h" 26#include "gfs2.h"
27#include "lm_interface.h"
28#include "incore.h"
26#include "bmap.h" 29#include "bmap.h"
27#include "dir.h" 30#include "dir.h"
28#include "glock.h" 31#include "glock.h"
@@ -36,6 +39,7 @@
36#include "quota.h" 39#include "quota.h"
37#include "rgrp.h" 40#include "rgrp.h"
38#include "trans.h" 41#include "trans.h"
42#include "util.h"
39 43
40/* "bad" is for NFS support */ 44/* "bad" is for NFS support */
41struct filldir_bad_entry { 45struct filldir_bad_entry {
@@ -125,7 +129,7 @@ int gfs2_internal_read(struct gfs2_inode *ip, struct file_ra_state *ra_state,
125 129
126static loff_t gfs2_llseek(struct file *file, loff_t offset, int origin) 130static loff_t gfs2_llseek(struct file *file, loff_t offset, int origin)
127{ 131{
128 struct gfs2_inode *ip = get_v2ip(file->f_mapping->host); 132 struct gfs2_inode *ip = file->f_mapping->host->u.generic_ip;
129 struct gfs2_holder i_gh; 133 struct gfs2_holder i_gh;
130 loff_t error; 134 loff_t error;
131 135
@@ -172,7 +176,7 @@ static ssize_t __gfs2_file_aio_read(struct kiocb *iocb,
172 unsigned long nr_segs, loff_t *ppos) 176 unsigned long nr_segs, loff_t *ppos)
173{ 177{
174 struct file *filp = iocb->ki_filp; 178 struct file *filp = iocb->ki_filp;
175 struct gfs2_inode *ip = get_v2ip(filp->f_mapping->host); 179 struct gfs2_inode *ip = filp->f_mapping->host->u.generic_ip;
176 struct gfs2_holder gh; 180 struct gfs2_holder gh;
177 ssize_t retval; 181 ssize_t retval;
178 unsigned long seg; 182 unsigned long seg;
@@ -354,7 +358,7 @@ static int filldir_reg_func(void *opaque, const char *name, unsigned int length,
354 358
355static int readdir_reg(struct file *file, void *dirent, filldir_t filldir) 359static int readdir_reg(struct file *file, void *dirent, filldir_t filldir)
356{ 360{
357 struct gfs2_inode *dip = get_v2ip(file->f_mapping->host); 361 struct gfs2_inode *dip = file->f_mapping->host->u.generic_ip;
358 struct filldir_reg fdr; 362 struct filldir_reg fdr;
359 struct gfs2_holder d_gh; 363 struct gfs2_holder d_gh;
360 uint64_t offset = file->f_pos; 364 uint64_t offset = file->f_pos;
@@ -443,7 +447,7 @@ static int filldir_bad_func(void *opaque, const char *name, unsigned int length,
443 447
444static int readdir_bad(struct file *file, void *dirent, filldir_t filldir) 448static int readdir_bad(struct file *file, void *dirent, filldir_t filldir)
445{ 449{
446 struct gfs2_inode *dip = get_v2ip(file->f_mapping->host); 450 struct gfs2_inode *dip = file->f_mapping->host->u.generic_ip;
447 struct gfs2_sbd *sdp = dip->i_sbd; 451 struct gfs2_sbd *sdp = dip->i_sbd;
448 struct filldir_reg fdr; 452 struct filldir_reg fdr;
449 unsigned int entries, size; 453 unsigned int entries, size;
@@ -608,7 +612,7 @@ out:
608static int gfs2_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 612static int gfs2_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
609 unsigned long arg) 613 unsigned long arg)
610{ 614{
611 struct gfs2_inode *ip = get_v2ip(inode); 615 struct gfs2_inode *ip = inode->u.generic_ip;
612 616
613 switch (cmd) { 617 switch (cmd) {
614 case GFS2_IOCTL_SETFLAGS: 618 case GFS2_IOCTL_SETFLAGS:
@@ -630,7 +634,7 @@ static int gfs2_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
630 634
631static int gfs2_mmap(struct file *file, struct vm_area_struct *vma) 635static int gfs2_mmap(struct file *file, struct vm_area_struct *vma)
632{ 636{
633 struct gfs2_inode *ip = get_v2ip(file->f_mapping->host); 637 struct gfs2_inode *ip = file->f_mapping->host->u.generic_ip;
634 struct gfs2_holder i_gh; 638 struct gfs2_holder i_gh;
635 int error; 639 int error;
636 640
@@ -665,7 +669,7 @@ static int gfs2_mmap(struct file *file, struct vm_area_struct *vma)
665 669
666static int gfs2_open(struct inode *inode, struct file *file) 670static int gfs2_open(struct inode *inode, struct file *file)
667{ 671{
668 struct gfs2_inode *ip = get_v2ip(inode); 672 struct gfs2_inode *ip = inode->u.generic_ip;
669 struct gfs2_holder i_gh; 673 struct gfs2_holder i_gh;
670 struct gfs2_file *fp; 674 struct gfs2_file *fp;
671 int error; 675 int error;
@@ -679,8 +683,8 @@ static int gfs2_open(struct inode *inode, struct file *file)
679 fp->f_inode = ip; 683 fp->f_inode = ip;
680 fp->f_vfile = file; 684 fp->f_vfile = file;
681 685
682 gfs2_assert_warn(ip->i_sbd, !get_v2fp(file)); 686 gfs2_assert_warn(ip->i_sbd, !file->private_data);
683 set_v2fp(file, fp); 687 file->private_data = fp;
684 688
685 if (S_ISREG(ip->i_di.di_mode)) { 689 if (S_ISREG(ip->i_di.di_mode)) {
686 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, 690 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY,
@@ -708,7 +712,7 @@ static int gfs2_open(struct inode *inode, struct file *file)
708 gfs2_glock_dq_uninit(&i_gh); 712 gfs2_glock_dq_uninit(&i_gh);
709 713
710 fail: 714 fail:
711 set_v2fp(file, NULL); 715 file->private_data = NULL;
712 kfree(fp); 716 kfree(fp);
713 717
714 return error; 718 return error;
@@ -724,11 +728,11 @@ static int gfs2_open(struct inode *inode, struct file *file)
724 728
725static int gfs2_close(struct inode *inode, struct file *file) 729static int gfs2_close(struct inode *inode, struct file *file)
726{ 730{
727 struct gfs2_sbd *sdp = get_v2sdp(inode->i_sb); 731 struct gfs2_sbd *sdp = inode->i_sb->s_fs_info;
728 struct gfs2_file *fp; 732 struct gfs2_file *fp;
729 733
730 fp = get_v2fp(file); 734 fp = file->private_data;
731 set_v2fp(file, NULL); 735 file->private_data = NULL;
732 736
733 if (gfs2_assert_warn(sdp, fp)) 737 if (gfs2_assert_warn(sdp, fp))
734 return -EIO; 738 return -EIO;
@@ -748,7 +752,7 @@ static int gfs2_close(struct inode *inode, struct file *file)
748 752
749static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync) 753static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync)
750{ 754{
751 struct gfs2_inode *ip = get_v2ip(dentry->d_inode); 755 struct gfs2_inode *ip = dentry->d_inode->u.generic_ip;
752 756
753 gfs2_log_flush_glock(ip->i_gl); 757 gfs2_log_flush_glock(ip->i_gl);
754 758
@@ -766,7 +770,7 @@ static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync)
766 770
767static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl) 771static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
768{ 772{
769 struct gfs2_inode *ip = get_v2ip(file->f_mapping->host); 773 struct gfs2_inode *ip = file->f_mapping->host->u.generic_ip;
770 struct gfs2_sbd *sdp = ip->i_sbd; 774 struct gfs2_sbd *sdp = ip->i_sbd;
771 struct lm_lockname name = 775 struct lm_lockname name =
772 { .ln_number = ip->i_num.no_addr, 776 { .ln_number = ip->i_num.no_addr,
@@ -824,7 +828,7 @@ static ssize_t gfs2_sendfile(struct file *in_file, loff_t *offset, size_t count,
824 828
825static int do_flock(struct file *file, int cmd, struct file_lock *fl) 829static int do_flock(struct file *file, int cmd, struct file_lock *fl)
826{ 830{
827 struct gfs2_file *fp = get_v2fp(file); 831 struct gfs2_file *fp = file->private_data;
828 struct gfs2_holder *fl_gh = &fp->f_fl_gh; 832 struct gfs2_holder *fl_gh = &fp->f_fl_gh;
829 struct gfs2_inode *ip = fp->f_inode; 833 struct gfs2_inode *ip = fp->f_inode;
830 struct gfs2_glock *gl; 834 struct gfs2_glock *gl;
@@ -874,7 +878,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
874 878
875static void do_unflock(struct file *file, struct file_lock *fl) 879static void do_unflock(struct file *file, struct file_lock *fl)
876{ 880{
877 struct gfs2_file *fp = get_v2fp(file); 881 struct gfs2_file *fp = file->private_data;
878 struct gfs2_holder *fl_gh = &fp->f_fl_gh; 882 struct gfs2_holder *fl_gh = &fp->f_fl_gh;
879 883
880 mutex_lock(&fp->f_fl_mutex); 884 mutex_lock(&fp->f_fl_mutex);
@@ -895,7 +899,7 @@ static void do_unflock(struct file *file, struct file_lock *fl)
895 899
896static int gfs2_flock(struct file *file, int cmd, struct file_lock *fl) 900static int gfs2_flock(struct file *file, int cmd, struct file_lock *fl)
897{ 901{
898 struct gfs2_inode *ip = get_v2ip(file->f_mapping->host); 902 struct gfs2_inode *ip = file->f_mapping->host->u.generic_ip;
899 struct gfs2_sbd *sdp = ip->i_sbd; 903 struct gfs2_sbd *sdp = ip->i_sbd;
900 904
901 if (!(fl->fl_flags & FL_FLOCK)) 905 if (!(fl->fl_flags & FL_FLOCK))
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 535f020f1e0c..4c4115f9d960 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -15,9 +15,12 @@
15#include <linux/vmalloc.h> 15#include <linux/vmalloc.h>
16#include <linux/blkdev.h> 16#include <linux/blkdev.h>
17#include <linux/kthread.h> 17#include <linux/kthread.h>
18#include <linux/gfs2_ondisk.h>
18#include <asm/semaphore.h> 19#include <asm/semaphore.h>
19 20
20#include "gfs2.h" 21#include "gfs2.h"
22#include "lm_interface.h"
23#include "incore.h"
21#include "daemon.h" 24#include "daemon.h"
22#include "glock.h" 25#include "glock.h"
23#include "glops.h" 26#include "glops.h"
@@ -32,6 +35,7 @@
32#include "super.h" 35#include "super.h"
33#include "unlinked.h" 36#include "unlinked.h"
34#include "sys.h" 37#include "sys.h"
38#include "util.h"
35 39
36#define DO 0 40#define DO 0
37#define UNDO 1 41#define UNDO 1
@@ -47,7 +51,7 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)
47 51
48 memset(sdp, 0, sizeof(struct gfs2_sbd)); 52 memset(sdp, 0, sizeof(struct gfs2_sbd));
49 53
50 set_v2sdp(sb, sdp); 54 sb->s_fs_info = sdp;
51 sdp->sd_vfs = sb; 55 sdp->sd_vfs = sb;
52 56
53 gfs2_tune_init(&sdp->sd_tune); 57 gfs2_tune_init(&sdp->sd_tune);
@@ -382,6 +386,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
382{ 386{
383 struct gfs2_holder ji_gh; 387 struct gfs2_holder ji_gh;
384 struct task_struct *p; 388 struct task_struct *p;
389 struct gfs2_inode *ip;
385 int jindex = 1; 390 int jindex = 1;
386 int error = 0; 391 int error = 0;
387 392
@@ -396,7 +401,8 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
396 fs_err(sdp, "can't lookup journal index: %d\n", error); 401 fs_err(sdp, "can't lookup journal index: %d\n", error);
397 return error; 402 return error;
398 } 403 }
399 set_bit(GLF_STICKY, &get_v2ip(sdp->sd_jindex)->i_gl->gl_flags); 404 ip = sdp->sd_jindex->u.generic_ip;
405 set_bit(GLF_STICKY, &ip->i_gl->gl_flags);
400 406
401 /* Load in the journal index special file */ 407 /* Load in the journal index special file */
402 408
@@ -436,8 +442,8 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
436 goto fail_jindex; 442 goto fail_jindex;
437 } 443 }
438 444
439 error = gfs2_glock_nq_init( 445 ip = sdp->sd_jdesc->jd_inode->u.generic_ip;
440 get_v2ip(sdp->sd_jdesc->jd_inode)->i_gl, 446 error = gfs2_glock_nq_init(ip->i_gl,
441 LM_ST_SHARED, 447 LM_ST_SHARED,
442 LM_FLAG_NOEXP | GL_EXACT, 448 LM_FLAG_NOEXP | GL_EXACT,
443 &sdp->sd_jinode_gh); 449 &sdp->sd_jinode_gh);
@@ -522,6 +528,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
522static int init_inodes(struct gfs2_sbd *sdp, int undo) 528static int init_inodes(struct gfs2_sbd *sdp, int undo)
523{ 529{
524 int error = 0; 530 int error = 0;
531 struct gfs2_inode *ip;
525 532
526 if (undo) 533 if (undo)
527 goto fail_qinode; 534 goto fail_qinode;
@@ -560,8 +567,9 @@ static int init_inodes(struct gfs2_sbd *sdp, int undo)
560 fs_err(sdp, "can't get resource index inode: %d\n", error); 567 fs_err(sdp, "can't get resource index inode: %d\n", error);
561 goto fail_statfs; 568 goto fail_statfs;
562 } 569 }
563 set_bit(GLF_STICKY, &get_v2ip(sdp->sd_rindex)->i_gl->gl_flags); 570 ip = sdp->sd_rindex->u.generic_ip;
564 sdp->sd_rindex_vn = get_v2ip(sdp->sd_rindex)->i_gl->gl_vn - 1; 571 set_bit(GLF_STICKY, &ip->i_gl->gl_flags);
572 sdp->sd_rindex_vn = ip->i_gl->gl_vn - 1;
565 573
566 /* Read in the quota inode */ 574 /* Read in the quota inode */
567 error = gfs2_lookup_simple(sdp->sd_master_dir, "quota", 575 error = gfs2_lookup_simple(sdp->sd_master_dir, "quota",
@@ -597,6 +605,7 @@ static int init_per_node(struct gfs2_sbd *sdp, int undo)
597 struct inode *pn = NULL; 605 struct inode *pn = NULL;
598 char buf[30]; 606 char buf[30];
599 int error = 0; 607 int error = 0;
608 struct gfs2_inode *ip;
600 609
601 if (sdp->sd_args.ar_spectator) 610 if (sdp->sd_args.ar_spectator)
602 return 0; 611 return 0;
@@ -641,7 +650,8 @@ static int init_per_node(struct gfs2_sbd *sdp, int undo)
641 iput(pn); 650 iput(pn);
642 pn = NULL; 651 pn = NULL;
643 652
644 error = gfs2_glock_nq_init(get_v2ip(sdp->sd_ir_inode)->i_gl, 653 ip = sdp->sd_ir_inode->u.generic_ip;
654 error = gfs2_glock_nq_init(ip->i_gl,
645 LM_ST_EXCLUSIVE, GL_NEVER_RECURSE, 655 LM_ST_EXCLUSIVE, GL_NEVER_RECURSE,
646 &sdp->sd_ir_gh); 656 &sdp->sd_ir_gh);
647 if (error) { 657 if (error) {
@@ -649,7 +659,8 @@ static int init_per_node(struct gfs2_sbd *sdp, int undo)
649 goto fail_qc_i; 659 goto fail_qc_i;
650 } 660 }
651 661
652 error = gfs2_glock_nq_init(get_v2ip(sdp->sd_sc_inode)->i_gl, 662 ip = sdp->sd_sc_inode->u.generic_ip;
663 error = gfs2_glock_nq_init(ip->i_gl,
653 LM_ST_EXCLUSIVE, GL_NEVER_RECURSE, 664 LM_ST_EXCLUSIVE, GL_NEVER_RECURSE,
654 &sdp->sd_sc_gh); 665 &sdp->sd_sc_gh);
655 if (error) { 666 if (error) {
@@ -657,7 +668,8 @@ static int init_per_node(struct gfs2_sbd *sdp, int undo)
657 goto fail_ir_gh; 668 goto fail_ir_gh;
658 } 669 }
659 670
660 error = gfs2_glock_nq_init(get_v2ip(sdp->sd_ut_inode)->i_gl, 671 ip = sdp->sd_ut_inode->u.generic_ip;
672 error = gfs2_glock_nq_init(ip->i_gl,
661 LM_ST_EXCLUSIVE, GL_NEVER_RECURSE, 673 LM_ST_EXCLUSIVE, GL_NEVER_RECURSE,
662 &sdp->sd_ut_gh); 674 &sdp->sd_ut_gh);
663 if (error) { 675 if (error) {
@@ -665,7 +677,8 @@ static int init_per_node(struct gfs2_sbd *sdp, int undo)
665 goto fail_sc_gh; 677 goto fail_sc_gh;
666 } 678 }
667 679
668 error = gfs2_glock_nq_init(get_v2ip(sdp->sd_qc_inode)->i_gl, 680 ip = sdp->sd_qc_inode->u.generic_ip;
681 error = gfs2_glock_nq_init(ip->i_gl,
669 LM_ST_EXCLUSIVE, GL_NEVER_RECURSE, 682 LM_ST_EXCLUSIVE, GL_NEVER_RECURSE,
670 &sdp->sd_qc_gh); 683 &sdp->sd_qc_gh);
671 if (error) { 684 if (error) {
@@ -862,7 +875,7 @@ static int fill_super(struct super_block *sb, void *data, int silent)
862 875
863 fail: 876 fail:
864 vfree(sdp); 877 vfree(sdp);
865 set_v2sdp(sb, NULL); 878 sb->s_fs_info = NULL;
866 879
867 return error; 880 return error;
868} 881}
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index 9971a30eb78e..7633a8584b0d 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -17,10 +17,13 @@
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/xattr.h> 18#include <linux/xattr.h>
19#include <linux/posix_acl.h> 19#include <linux/posix_acl.h>
20#include <linux/gfs2_ondisk.h>
20#include <asm/semaphore.h> 21#include <asm/semaphore.h>
21#include <asm/uaccess.h> 22#include <asm/uaccess.h>
22 23
23#include "gfs2.h" 24#include "gfs2.h"
25#include "lm_interface.h"
26#include "incore.h"
24#include "acl.h" 27#include "acl.h"
25#include "bmap.h" 28#include "bmap.h"
26#include "dir.h" 29#include "dir.h"
@@ -36,6 +39,7 @@
36#include "rgrp.h" 39#include "rgrp.h"
37#include "trans.h" 40#include "trans.h"
38#include "unlinked.h" 41#include "unlinked.h"
42#include "util.h"
39 43
40/** 44/**
41 * gfs2_create - Create a file 45 * gfs2_create - Create a file
@@ -49,7 +53,7 @@
49static int gfs2_create(struct inode *dir, struct dentry *dentry, 53static int gfs2_create(struct inode *dir, struct dentry *dentry,
50 int mode, struct nameidata *nd) 54 int mode, struct nameidata *nd)
51{ 55{
52 struct gfs2_inode *dip = get_v2ip(dir); 56 struct gfs2_inode *dip = dir->u.generic_ip;
53 struct gfs2_sbd *sdp = dip->i_sbd; 57 struct gfs2_sbd *sdp = dip->i_sbd;
54 struct gfs2_holder ghs[2]; 58 struct gfs2_holder ghs[2];
55 struct inode *inode; 59 struct inode *inode;
@@ -106,7 +110,7 @@ static int gfs2_create(struct inode *dir, struct dentry *dentry,
106static struct dentry *gfs2_lookup(struct inode *dir, struct dentry *dentry, 110static struct dentry *gfs2_lookup(struct inode *dir, struct dentry *dentry,
107 struct nameidata *nd) 111 struct nameidata *nd)
108{ 112{
109 struct gfs2_inode *dip = get_v2ip(dir); 113 struct gfs2_inode *dip = dir->u.generic_ip;
110 struct gfs2_sbd *sdp = dip->i_sbd; 114 struct gfs2_sbd *sdp = dip->i_sbd;
111 struct inode *inode = NULL; 115 struct inode *inode = NULL;
112 int error; 116 int error;
@@ -140,10 +144,10 @@ static struct dentry *gfs2_lookup(struct inode *dir, struct dentry *dentry,
140static int gfs2_link(struct dentry *old_dentry, struct inode *dir, 144static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
141 struct dentry *dentry) 145 struct dentry *dentry)
142{ 146{
143 struct gfs2_inode *dip = get_v2ip(dir); 147 struct gfs2_inode *dip = dir->u.generic_ip;
144 struct gfs2_sbd *sdp = dip->i_sbd; 148 struct gfs2_sbd *sdp = dip->i_sbd;
145 struct inode *inode = old_dentry->d_inode; 149 struct inode *inode = old_dentry->d_inode;
146 struct gfs2_inode *ip = get_v2ip(inode); 150 struct gfs2_inode *ip = inode->u.generic_ip;
147 struct gfs2_holder ghs[2]; 151 struct gfs2_holder ghs[2];
148 int alloc_required; 152 int alloc_required;
149 int error; 153 int error;
@@ -274,9 +278,9 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
274 278
275static int gfs2_unlink(struct inode *dir, struct dentry *dentry) 279static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
276{ 280{
277 struct gfs2_inode *dip = get_v2ip(dir); 281 struct gfs2_inode *dip = dir->u.generic_ip;
278 struct gfs2_sbd *sdp = dip->i_sbd; 282 struct gfs2_sbd *sdp = dip->i_sbd;
279 struct gfs2_inode *ip = get_v2ip(dentry->d_inode); 283 struct gfs2_inode *ip = dentry->d_inode->u.generic_ip;
280 struct gfs2_unlinked *ul; 284 struct gfs2_unlinked *ul;
281 struct gfs2_holder ghs[2]; 285 struct gfs2_holder ghs[2];
282 int error; 286 int error;
@@ -329,7 +333,7 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
329static int gfs2_symlink(struct inode *dir, struct dentry *dentry, 333static int gfs2_symlink(struct inode *dir, struct dentry *dentry,
330 const char *symname) 334 const char *symname)
331{ 335{
332 struct gfs2_inode *dip = get_v2ip(dir), *ip; 336 struct gfs2_inode *dip = dir->u.generic_ip, *ip;
333 struct gfs2_sbd *sdp = dip->i_sbd; 337 struct gfs2_sbd *sdp = dip->i_sbd;
334 struct gfs2_holder ghs[2]; 338 struct gfs2_holder ghs[2];
335 struct inode *inode; 339 struct inode *inode;
@@ -350,7 +354,7 @@ static int gfs2_symlink(struct inode *dir, struct dentry *dentry,
350 return PTR_ERR(inode); 354 return PTR_ERR(inode);
351 } 355 }
352 356
353 ip = get_gl2ip(ghs[1].gh_gl); 357 ip = ghs[1].gh_gl->gl_object;
354 358
355 ip->i_di.di_size = size; 359 ip->i_di.di_size = size;
356 360
@@ -388,7 +392,7 @@ static int gfs2_symlink(struct inode *dir, struct dentry *dentry,
388 392
389static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode) 393static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode)
390{ 394{
391 struct gfs2_inode *dip = get_v2ip(dir), *ip; 395 struct gfs2_inode *dip = dir->u.generic_ip, *ip;
392 struct gfs2_sbd *sdp = dip->i_sbd; 396 struct gfs2_sbd *sdp = dip->i_sbd;
393 struct gfs2_holder ghs[2]; 397 struct gfs2_holder ghs[2];
394 struct inode *inode; 398 struct inode *inode;
@@ -403,7 +407,7 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode)
403 return PTR_ERR(inode); 407 return PTR_ERR(inode);
404 } 408 }
405 409
406 ip = get_gl2ip(ghs[1].gh_gl); 410 ip = ghs[1].gh_gl->gl_object;
407 411
408 ip->i_di.di_nlink = 2; 412 ip->i_di.di_nlink = 2;
409 ip->i_di.di_size = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode); 413 ip->i_di.di_size = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode);
@@ -468,9 +472,9 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode)
468 472
469static int gfs2_rmdir(struct inode *dir, struct dentry *dentry) 473static int gfs2_rmdir(struct inode *dir, struct dentry *dentry)
470{ 474{
471 struct gfs2_inode *dip = get_v2ip(dir); 475 struct gfs2_inode *dip = dir->u.generic_ip;
472 struct gfs2_sbd *sdp = dip->i_sbd; 476 struct gfs2_sbd *sdp = dip->i_sbd;
473 struct gfs2_inode *ip = get_v2ip(dentry->d_inode); 477 struct gfs2_inode *ip = dentry->d_inode->u.generic_ip;
474 struct gfs2_unlinked *ul; 478 struct gfs2_unlinked *ul;
475 struct gfs2_holder ghs[2]; 479 struct gfs2_holder ghs[2];
476 int error; 480 int error;
@@ -534,7 +538,7 @@ static int gfs2_rmdir(struct inode *dir, struct dentry *dentry)
534static int gfs2_mknod(struct inode *dir, struct dentry *dentry, int mode, 538static int gfs2_mknod(struct inode *dir, struct dentry *dentry, int mode,
535 dev_t dev) 539 dev_t dev)
536{ 540{
537 struct gfs2_inode *dip = get_v2ip(dir), *ip; 541 struct gfs2_inode *dip = dir->u.generic_ip, *ip;
538 struct gfs2_sbd *sdp = dip->i_sbd; 542 struct gfs2_sbd *sdp = dip->i_sbd;
539 struct gfs2_holder ghs[2]; 543 struct gfs2_holder ghs[2];
540 struct inode *inode; 544 struct inode *inode;
@@ -563,7 +567,7 @@ static int gfs2_mknod(struct inode *dir, struct dentry *dentry, int mode,
563 return PTR_ERR(inode); 567 return PTR_ERR(inode);
564 } 568 }
565 569
566 ip = get_gl2ip(ghs[1].gh_gl); 570 ip = ghs[1].gh_gl->gl_object;
567 571
568 ip->i_di.di_major = major; 572 ip->i_di.di_major = major;
569 ip->i_di.di_minor = minor; 573 ip->i_di.di_minor = minor;
@@ -602,9 +606,9 @@ static int gfs2_mknod(struct inode *dir, struct dentry *dentry, int mode,
602static int gfs2_rename(struct inode *odir, struct dentry *odentry, 606static int gfs2_rename(struct inode *odir, struct dentry *odentry,
603 struct inode *ndir, struct dentry *ndentry) 607 struct inode *ndir, struct dentry *ndentry)
604{ 608{
605 struct gfs2_inode *odip = get_v2ip(odir); 609 struct gfs2_inode *odip = odir->u.generic_ip;
606 struct gfs2_inode *ndip = get_v2ip(ndir); 610 struct gfs2_inode *ndip = ndir->u.generic_ip;
607 struct gfs2_inode *ip = get_v2ip(odentry->d_inode); 611 struct gfs2_inode *ip = odentry->d_inode->u.generic_ip;
608 struct gfs2_inode *nip = NULL; 612 struct gfs2_inode *nip = NULL;
609 struct gfs2_sbd *sdp = odip->i_sbd; 613 struct gfs2_sbd *sdp = odip->i_sbd;
610 struct gfs2_unlinked *ul; 614 struct gfs2_unlinked *ul;
@@ -616,7 +620,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
616 int error; 620 int error;
617 621
618 if (ndentry->d_inode) { 622 if (ndentry->d_inode) {
619 nip = get_v2ip(ndentry->d_inode); 623 nip = ndentry->d_inode->u.generic_ip;
620 if (ip == nip) 624 if (ip == nip)
621 return 0; 625 return 0;
622 } 626 }
@@ -848,7 +852,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
848static int gfs2_readlink(struct dentry *dentry, char __user *user_buf, 852static int gfs2_readlink(struct dentry *dentry, char __user *user_buf,
849 int user_size) 853 int user_size)
850{ 854{
851 struct gfs2_inode *ip = get_v2ip(dentry->d_inode); 855 struct gfs2_inode *ip = dentry->d_inode->u.generic_ip;
852 char array[GFS2_FAST_NAME_SIZE], *buf = array; 856 char array[GFS2_FAST_NAME_SIZE], *buf = array;
853 unsigned int len = GFS2_FAST_NAME_SIZE; 857 unsigned int len = GFS2_FAST_NAME_SIZE;
854 int error; 858 int error;
@@ -884,7 +888,7 @@ static int gfs2_readlink(struct dentry *dentry, char __user *user_buf,
884 888
885static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd) 889static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd)
886{ 890{
887 struct gfs2_inode *ip = get_v2ip(dentry->d_inode); 891 struct gfs2_inode *ip = dentry->d_inode->u.generic_ip;
888 char array[GFS2_FAST_NAME_SIZE], *buf = array; 892 char array[GFS2_FAST_NAME_SIZE], *buf = array;
889 unsigned int len = GFS2_FAST_NAME_SIZE; 893 unsigned int len = GFS2_FAST_NAME_SIZE;
890 int error; 894 int error;
@@ -910,7 +914,7 @@ static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd)
910 914
911static int gfs2_permission(struct inode *inode, int mask, struct nameidata *nd) 915static int gfs2_permission(struct inode *inode, int mask, struct nameidata *nd)
912{ 916{
913 struct gfs2_inode *ip = get_v2ip(inode); 917 struct gfs2_inode *ip = inode->u.generic_ip;
914 struct gfs2_holder i_gh; 918 struct gfs2_holder i_gh;
915 int error; 919 int error;
916 920
@@ -930,7 +934,7 @@ static int gfs2_permission(struct inode *inode, int mask, struct nameidata *nd)
930 934
931static int setattr_size(struct inode *inode, struct iattr *attr) 935static int setattr_size(struct inode *inode, struct iattr *attr)
932{ 936{
933 struct gfs2_inode *ip = get_v2ip(inode); 937 struct gfs2_inode *ip = inode->u.generic_ip;
934 int error; 938 int error;
935 939
936 if (attr->ia_size != ip->i_di.di_size) { 940 if (attr->ia_size != ip->i_di.di_size) {
@@ -948,7 +952,7 @@ static int setattr_size(struct inode *inode, struct iattr *attr)
948 952
949static int setattr_chown(struct inode *inode, struct iattr *attr) 953static int setattr_chown(struct inode *inode, struct iattr *attr)
950{ 954{
951 struct gfs2_inode *ip = get_v2ip(inode); 955 struct gfs2_inode *ip = inode->u.generic_ip;
952 struct gfs2_sbd *sdp = ip->i_sbd; 956 struct gfs2_sbd *sdp = ip->i_sbd;
953 struct buffer_head *dibh; 957 struct buffer_head *dibh;
954 uint32_t ouid, ogid, nuid, ngid; 958 uint32_t ouid, ogid, nuid, ngid;
@@ -1025,7 +1029,7 @@ static int setattr_chown(struct inode *inode, struct iattr *attr)
1025static int gfs2_setattr(struct dentry *dentry, struct iattr *attr) 1029static int gfs2_setattr(struct dentry *dentry, struct iattr *attr)
1026{ 1030{
1027 struct inode *inode = dentry->d_inode; 1031 struct inode *inode = dentry->d_inode;
1028 struct gfs2_inode *ip = get_v2ip(inode); 1032 struct gfs2_inode *ip = inode->u.generic_ip;
1029 struct gfs2_holder i_gh; 1033 struct gfs2_holder i_gh;
1030 int error; 1034 int error;
1031 1035
@@ -1072,7 +1076,7 @@ static int gfs2_getattr(struct vfsmount *mnt, struct dentry *dentry,
1072 struct kstat *stat) 1076 struct kstat *stat)
1073{ 1077{
1074 struct inode *inode = dentry->d_inode; 1078 struct inode *inode = dentry->d_inode;
1075 struct gfs2_inode *ip = get_v2ip(inode); 1079 struct gfs2_inode *ip = inode->u.generic_ip;
1076 struct gfs2_holder gh; 1080 struct gfs2_holder gh;
1077 int error; 1081 int error;
1078 1082
@@ -1088,7 +1092,7 @@ static int gfs2_getattr(struct vfsmount *mnt, struct dentry *dentry,
1088static int gfs2_setxattr(struct dentry *dentry, const char *name, 1092static int gfs2_setxattr(struct dentry *dentry, const char *name,
1089 const void *data, size_t size, int flags) 1093 const void *data, size_t size, int flags)
1090{ 1094{
1091 struct gfs2_inode *ip = get_v2ip(dentry->d_inode); 1095 struct gfs2_inode *ip = dentry->d_inode->u.generic_ip;
1092 struct gfs2_ea_request er; 1096 struct gfs2_ea_request er;
1093 1097
1094 memset(&er, 0, sizeof(struct gfs2_ea_request)); 1098 memset(&er, 0, sizeof(struct gfs2_ea_request));
@@ -1118,7 +1122,7 @@ static ssize_t gfs2_getxattr(struct dentry *dentry, const char *name,
1118 er.er_name_len = strlen(er.er_name); 1122 er.er_name_len = strlen(er.er_name);
1119 er.er_data_len = size; 1123 er.er_data_len = size;
1120 1124
1121 return gfs2_ea_get(get_v2ip(dentry->d_inode), &er); 1125 return gfs2_ea_get(dentry->d_inode->u.generic_ip, &er);
1122} 1126}
1123 1127
1124static ssize_t gfs2_listxattr(struct dentry *dentry, char *buffer, size_t size) 1128static ssize_t gfs2_listxattr(struct dentry *dentry, char *buffer, size_t size)
@@ -1129,7 +1133,7 @@ static ssize_t gfs2_listxattr(struct dentry *dentry, char *buffer, size_t size)
1129 er.er_data = (size) ? buffer : NULL; 1133 er.er_data = (size) ? buffer : NULL;
1130 er.er_data_len = size; 1134 er.er_data_len = size;
1131 1135
1132 return gfs2_ea_list(get_v2ip(dentry->d_inode), &er); 1136 return gfs2_ea_list(dentry->d_inode->u.generic_ip, &er);
1133} 1137}
1134 1138
1135static int gfs2_removexattr(struct dentry *dentry, const char *name) 1139static int gfs2_removexattr(struct dentry *dentry, const char *name)
@@ -1142,7 +1146,7 @@ static int gfs2_removexattr(struct dentry *dentry, const char *name)
1142 return -EOPNOTSUPP; 1146 return -EOPNOTSUPP;
1143 er.er_name_len = strlen(er.er_name); 1147 er.er_name_len = strlen(er.er_name);
1144 1148
1145 return gfs2_ea_remove(get_v2ip(dentry->d_inode), &er); 1149 return gfs2_ea_remove(dentry->d_inode->u.generic_ip, &er);
1146} 1150}
1147 1151
1148struct inode_operations gfs2_file_iops = { 1152struct inode_operations gfs2_file_iops = {
diff --git a/fs/gfs2/ops_super.c b/fs/gfs2/ops_super.c
index 48a94522406e..10f70ee12161 100644
--- a/fs/gfs2/ops_super.c
+++ b/fs/gfs2/ops_super.c
@@ -18,9 +18,12 @@
18#include <linux/mount.h> 18#include <linux/mount.h>
19#include <linux/kthread.h> 19#include <linux/kthread.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/gfs2_ondisk.h>
21#include <asm/semaphore.h> 22#include <asm/semaphore.h>
22 23
23#include "gfs2.h" 24#include "gfs2.h"
25#include "lm_interface.h"
26#include "incore.h"
24#include "glock.h" 27#include "glock.h"
25#include "inode.h" 28#include "inode.h"
26#include "lm.h" 29#include "lm.h"
@@ -33,6 +36,7 @@
33#include "rgrp.h" 36#include "rgrp.h"
34#include "super.h" 37#include "super.h"
35#include "sys.h" 38#include "sys.h"
39#include "util.h"
36 40
37/** 41/**
38 * gfs2_write_inode - Make sure the inode is stable on the disk 42 * gfs2_write_inode - Make sure the inode is stable on the disk
@@ -44,7 +48,7 @@
44 48
45static int gfs2_write_inode(struct inode *inode, int sync) 49static int gfs2_write_inode(struct inode *inode, int sync)
46{ 50{
47 struct gfs2_inode *ip = get_v2ip(inode); 51 struct gfs2_inode *ip = inode->u.generic_ip;
48 52
49 if (current->flags & PF_MEMALLOC) 53 if (current->flags & PF_MEMALLOC)
50 return 0; 54 return 0;
@@ -62,7 +66,7 @@ static int gfs2_write_inode(struct inode *inode, int sync)
62 66
63static void gfs2_put_super(struct super_block *sb) 67static void gfs2_put_super(struct super_block *sb)
64{ 68{
65 struct gfs2_sbd *sdp = get_v2sdp(sb); 69 struct gfs2_sbd *sdp = sb->s_fs_info;
66 int error; 70 int error;
67 71
68 if (!sdp) 72 if (!sdp)
@@ -138,7 +142,7 @@ static void gfs2_put_super(struct super_block *sb)
138 142
139 vfree(sdp); 143 vfree(sdp);
140 144
141 set_v2sdp(sb, NULL); 145 sb->s_fs_info = NULL;
142} 146}
143 147
144/** 148/**
@@ -151,7 +155,7 @@ static void gfs2_put_super(struct super_block *sb)
151 155
152static void gfs2_write_super(struct super_block *sb) 156static void gfs2_write_super(struct super_block *sb)
153{ 157{
154 struct gfs2_sbd *sdp = get_v2sdp(sb); 158 struct gfs2_sbd *sdp = sb->s_fs_info;
155 gfs2_log_flush(sdp); 159 gfs2_log_flush(sdp);
156} 160}
157 161
@@ -163,7 +167,7 @@ static void gfs2_write_super(struct super_block *sb)
163 167
164static void gfs2_write_super_lockfs(struct super_block *sb) 168static void gfs2_write_super_lockfs(struct super_block *sb)
165{ 169{
166 struct gfs2_sbd *sdp = get_v2sdp(sb); 170 struct gfs2_sbd *sdp = sb->s_fs_info;
167 int error; 171 int error;
168 172
169 for (;;) { 173 for (;;) {
@@ -194,7 +198,7 @@ static void gfs2_write_super_lockfs(struct super_block *sb)
194 198
195static void gfs2_unlockfs(struct super_block *sb) 199static void gfs2_unlockfs(struct super_block *sb)
196{ 200{
197 struct gfs2_sbd *sdp = get_v2sdp(sb); 201 struct gfs2_sbd *sdp = sb->s_fs_info;
198 gfs2_unfreeze_fs(sdp); 202 gfs2_unfreeze_fs(sdp);
199} 203}
200 204
@@ -208,7 +212,7 @@ static void gfs2_unlockfs(struct super_block *sb)
208 212
209static int gfs2_statfs(struct super_block *sb, struct kstatfs *buf) 213static int gfs2_statfs(struct super_block *sb, struct kstatfs *buf)
210{ 214{
211 struct gfs2_sbd *sdp = get_v2sdp(sb); 215 struct gfs2_sbd *sdp = sb->s_fs_info;
212 struct gfs2_statfs_change sc; 216 struct gfs2_statfs_change sc;
213 int error; 217 int error;
214 218
@@ -245,7 +249,7 @@ static int gfs2_statfs(struct super_block *sb, struct kstatfs *buf)
245 249
246static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data) 250static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data)
247{ 251{
248 struct gfs2_sbd *sdp = get_v2sdp(sb); 252 struct gfs2_sbd *sdp = sb->s_fs_info;
249 int error; 253 int error;
250 254
251 error = gfs2_mount_args(sdp, data, 1); 255 error = gfs2_mount_args(sdp, data, 1);
@@ -283,12 +287,12 @@ static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data)
283 287
284static void gfs2_clear_inode(struct inode *inode) 288static void gfs2_clear_inode(struct inode *inode)
285{ 289{
286 struct gfs2_inode *ip = get_v2ip(inode); 290 struct gfs2_inode *ip = inode->u.generic_ip;
287 291
288 if (ip) { 292 if (ip) {
289 spin_lock(&ip->i_spin); 293 spin_lock(&ip->i_spin);
290 ip->i_vnode = NULL; 294 ip->i_vnode = NULL;
291 set_v2ip(inode, NULL); 295 inode->u.generic_ip = NULL;
292 spin_unlock(&ip->i_spin); 296 spin_unlock(&ip->i_spin);
293 297
294 gfs2_glock_schedule_for_reclaim(ip->i_gl); 298 gfs2_glock_schedule_for_reclaim(ip->i_gl);
@@ -306,7 +310,7 @@ static void gfs2_clear_inode(struct inode *inode)
306 310
307static int gfs2_show_options(struct seq_file *s, struct vfsmount *mnt) 311static int gfs2_show_options(struct seq_file *s, struct vfsmount *mnt)
308{ 312{
309 struct gfs2_sbd *sdp = get_v2sdp(mnt->mnt_sb); 313 struct gfs2_sbd *sdp = mnt->mnt_sb->s_fs_info;
310 struct gfs2_args *args = &sdp->sd_args; 314 struct gfs2_args *args = &sdp->sd_args;
311 315
312 if (args->ar_lockproto[0]) 316 if (args->ar_lockproto[0])
diff --git a/fs/gfs2/ops_vm.c b/fs/gfs2/ops_vm.c
index bfeb920dccee..dbc57071e7bb 100644
--- a/fs/gfs2/ops_vm.c
+++ b/fs/gfs2/ops_vm.c
@@ -14,9 +14,12 @@
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <linux/pagemap.h> 16#include <linux/pagemap.h>
17#include <linux/gfs2_ondisk.h>
17#include <asm/semaphore.h> 18#include <asm/semaphore.h>
18 19
19#include "gfs2.h" 20#include "gfs2.h"
21#include "lm_interface.h"
22#include "incore.h"
20#include "bmap.h" 23#include "bmap.h"
21#include "glock.h" 24#include "glock.h"
22#include "inode.h" 25#include "inode.h"
@@ -25,6 +28,7 @@
25#include "quota.h" 28#include "quota.h"
26#include "rgrp.h" 29#include "rgrp.h"
27#include "trans.h" 30#include "trans.h"
31#include "util.h"
28 32
29static void pfault_be_greedy(struct gfs2_inode *ip) 33static void pfault_be_greedy(struct gfs2_inode *ip)
30{ 34{
@@ -43,7 +47,7 @@ static void pfault_be_greedy(struct gfs2_inode *ip)
43static struct page *gfs2_private_nopage(struct vm_area_struct *area, 47static struct page *gfs2_private_nopage(struct vm_area_struct *area,
44 unsigned long address, int *type) 48 unsigned long address, int *type)
45{ 49{
46 struct gfs2_inode *ip = get_v2ip(area->vm_file->f_mapping->host); 50 struct gfs2_inode *ip = area->vm_file->f_mapping->host->u.generic_ip;
47 struct gfs2_holder i_gh; 51 struct gfs2_holder i_gh;
48 struct page *result; 52 struct page *result;
49 int error; 53 int error;
@@ -141,7 +145,7 @@ static int alloc_page_backing(struct gfs2_inode *ip, struct page *page)
141static struct page *gfs2_sharewrite_nopage(struct vm_area_struct *area, 145static struct page *gfs2_sharewrite_nopage(struct vm_area_struct *area,
142 unsigned long address, int *type) 146 unsigned long address, int *type)
143{ 147{
144 struct gfs2_inode *ip = get_v2ip(area->vm_file->f_mapping->host); 148 struct gfs2_inode *ip = area->vm_file->f_mapping->host->u.generic_ip;
145 struct gfs2_holder i_gh; 149 struct gfs2_holder i_gh;
146 struct page *result = NULL; 150 struct page *result = NULL;
147 unsigned long index = ((address - area->vm_start) >> PAGE_CACHE_SHIFT) + 151 unsigned long index = ((address - area->vm_start) >> PAGE_CACHE_SHIFT) +
diff --git a/fs/gfs2/page.c b/fs/gfs2/page.c
index 3542aa6b01c4..a2c9e93c7c39 100644
--- a/fs/gfs2/page.c
+++ b/fs/gfs2/page.c
@@ -14,14 +14,18 @@
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/pagemap.h> 15#include <linux/pagemap.h>
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/gfs2_ondisk.h>
17#include <asm/semaphore.h> 18#include <asm/semaphore.h>
18 19
19#include "gfs2.h" 20#include "gfs2.h"
21#include "lm_interface.h"
22#include "incore.h"
20#include "bmap.h" 23#include "bmap.h"
21#include "inode.h" 24#include "inode.h"
22#include "page.h" 25#include "page.h"
23#include "trans.h" 26#include "trans.h"
24#include "ops_address.h" 27#include "ops_address.h"
28#include "util.h"
25 29
26/** 30/**
27 * gfs2_pte_inval - Sync and invalidate all PTEs associated with a glock 31 * gfs2_pte_inval - Sync and invalidate all PTEs associated with a glock
@@ -34,7 +38,7 @@ void gfs2_pte_inval(struct gfs2_glock *gl)
34 struct gfs2_inode *ip; 38 struct gfs2_inode *ip;
35 struct inode *inode; 39 struct inode *inode;
36 40
37 ip = get_gl2ip(gl); 41 ip = gl->gl_object;
38 if (!ip || !S_ISREG(ip->i_di.di_mode)) 42 if (!ip || !S_ISREG(ip->i_di.di_mode))
39 return; 43 return;
40 44
@@ -64,7 +68,7 @@ void gfs2_page_inval(struct gfs2_glock *gl)
64 struct gfs2_inode *ip; 68 struct gfs2_inode *ip;
65 struct inode *inode; 69 struct inode *inode;
66 70
67 ip = get_gl2ip(gl); 71 ip = gl->gl_object;
68 if (!ip || !S_ISREG(ip->i_di.di_mode)) 72 if (!ip || !S_ISREG(ip->i_di.di_mode))
69 return; 73 return;
70 74
@@ -95,7 +99,7 @@ void gfs2_page_sync(struct gfs2_glock *gl, int flags)
95 struct gfs2_inode *ip; 99 struct gfs2_inode *ip;
96 struct inode *inode; 100 struct inode *inode;
97 101
98 ip = get_gl2ip(gl); 102 ip = gl->gl_object;
99 if (!ip || !S_ISREG(ip->i_di.di_mode)) 103 if (!ip || !S_ISREG(ip->i_di.di_mode))
100 return; 104 return;
101 105
@@ -192,7 +196,7 @@ int gfs2_unstuffer_page(struct gfs2_inode *ip, struct buffer_head *dibh,
192int gfs2_block_truncate_page(struct address_space *mapping) 196int gfs2_block_truncate_page(struct address_space *mapping)
193{ 197{
194 struct inode *inode = mapping->host; 198 struct inode *inode = mapping->host;
195 struct gfs2_inode *ip = get_v2ip(inode); 199 struct gfs2_inode *ip = inode->u.generic_ip;
196 struct gfs2_sbd *sdp = ip->i_sbd; 200 struct gfs2_sbd *sdp = ip->i_sbd;
197 loff_t from = inode->i_size; 201 loff_t from = inode->i_size;
198 unsigned long index = from >> PAGE_CACHE_SHIFT; 202 unsigned long index = from >> PAGE_CACHE_SHIFT;
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 40c7cf87eb44..c57b5cf1d583 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -44,13 +44,17 @@
44#include <linux/tty.h> 44#include <linux/tty.h>
45#include <linux/sort.h> 45#include <linux/sort.h>
46#include <linux/fs.h> 46#include <linux/fs.h>
47#include <linux/gfs2_ondisk.h>
47#include <asm/semaphore.h> 48#include <asm/semaphore.h>
48 49
49#include "gfs2.h" 50#include "gfs2.h"
51#include "lm_interface.h"
52#include "incore.h"
50#include "bmap.h" 53#include "bmap.h"
51#include "glock.h" 54#include "glock.h"
52#include "glops.h" 55#include "glops.h"
53#include "log.h" 56#include "log.h"
57#include "lvb.h"
54#include "meta_io.h" 58#include "meta_io.h"
55#include "quota.h" 59#include "quota.h"
56#include "rgrp.h" 60#include "rgrp.h"
@@ -59,6 +63,7 @@
59#include "inode.h" 63#include "inode.h"
60#include "ops_file.h" 64#include "ops_file.h"
61#include "ops_address.h" 65#include "ops_address.h"
66#include "util.h"
62 67
63#define QUOTA_USER 1 68#define QUOTA_USER 1
64#define QUOTA_GROUP 0 69#define QUOTA_GROUP 0
@@ -244,7 +249,7 @@ static void slot_put(struct gfs2_quota_data *qd)
244static int bh_get(struct gfs2_quota_data *qd) 249static int bh_get(struct gfs2_quota_data *qd)
245{ 250{
246 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; 251 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
247 struct gfs2_inode *ip = get_v2ip(sdp->sd_qc_inode); 252 struct gfs2_inode *ip = sdp->sd_qc_inode->u.generic_ip;
248 unsigned int block, offset; 253 unsigned int block, offset;
249 uint64_t dblock; 254 uint64_t dblock;
250 int new = 0; 255 int new = 0;
@@ -526,7 +531,7 @@ static int sort_qd(const void *a, const void *b)
526static void do_qc(struct gfs2_quota_data *qd, int64_t change) 531static void do_qc(struct gfs2_quota_data *qd, int64_t change)
527{ 532{
528 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; 533 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
529 struct gfs2_inode *ip = get_v2ip(sdp->sd_qc_inode); 534 struct gfs2_inode *ip = sdp->sd_qc_inode->u.generic_ip;
530 struct gfs2_quota_change *qc = qd->qd_bh_qc; 535 struct gfs2_quota_change *qc = qd->qd_bh_qc;
531 int64_t x; 536 int64_t x;
532 537
@@ -642,7 +647,7 @@ unlock:
642static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda) 647static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
643{ 648{
644 struct gfs2_sbd *sdp = (*qda)->qd_gl->gl_sbd; 649 struct gfs2_sbd *sdp = (*qda)->qd_gl->gl_sbd;
645 struct gfs2_inode *ip = get_v2ip(sdp->sd_quota_inode); 650 struct gfs2_inode *ip = sdp->sd_quota_inode->u.generic_ip;
646 unsigned int data_blocks, ind_blocks; 651 unsigned int data_blocks, ind_blocks;
647 struct file_ra_state ra_state; 652 struct file_ra_state ra_state;
648 struct gfs2_holder *ghs, i_gh; 653 struct gfs2_holder *ghs, i_gh;
@@ -753,6 +758,7 @@ static int do_glock(struct gfs2_quota_data *qd, int force_refresh,
753 struct gfs2_holder *q_gh) 758 struct gfs2_holder *q_gh)
754{ 759{
755 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; 760 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
761 struct gfs2_inode *ip = sdp->sd_quota_inode->u.generic_ip;
756 struct gfs2_holder i_gh; 762 struct gfs2_holder i_gh;
757 struct gfs2_quota q; 763 struct gfs2_quota q;
758 char buf[sizeof(struct gfs2_quota)]; 764 char buf[sizeof(struct gfs2_quota)];
@@ -776,7 +782,7 @@ static int do_glock(struct gfs2_quota_data *qd, int force_refresh,
776 if (error) 782 if (error)
777 return error; 783 return error;
778 784
779 error = gfs2_glock_nq_init(get_v2ip(sdp->sd_quota_inode)->i_gl, 785 error = gfs2_glock_nq_init(ip->i_gl,
780 LM_ST_SHARED, 0, 786 LM_ST_SHARED, 0,
781 &i_gh); 787 &i_gh);
782 if (error) 788 if (error)
@@ -784,7 +790,7 @@ static int do_glock(struct gfs2_quota_data *qd, int force_refresh,
784 790
785 memset(buf, 0, sizeof(struct gfs2_quota)); 791 memset(buf, 0, sizeof(struct gfs2_quota));
786 pos = qd2offset(qd); 792 pos = qd2offset(qd);
787 error = gfs2_internal_read(get_v2ip(sdp->sd_quota_inode), 793 error = gfs2_internal_read(ip,
788 &ra_state, buf, 794 &ra_state, buf,
789 &pos, 795 &pos,
790 sizeof(struct gfs2_quota)); 796 sizeof(struct gfs2_quota));
@@ -1118,7 +1124,7 @@ int gfs2_quota_read(struct gfs2_sbd *sdp, int user, uint32_t id,
1118 1124
1119int gfs2_quota_init(struct gfs2_sbd *sdp) 1125int gfs2_quota_init(struct gfs2_sbd *sdp)
1120{ 1126{
1121 struct gfs2_inode *ip = get_v2ip(sdp->sd_qc_inode); 1127 struct gfs2_inode *ip = sdp->sd_qc_inode->u.generic_ip;
1122 unsigned int blocks = ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift; 1128 unsigned int blocks = ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift;
1123 unsigned int x, slot = 0; 1129 unsigned int x, slot = 0;
1124 unsigned int found = 0; 1130 unsigned int found = 0;
@@ -1133,7 +1139,7 @@ int gfs2_quota_init(struct gfs2_sbd *sdp)
1133 return -EIO; 1139 return -EIO;
1134 } 1140 }
1135 sdp->sd_quota_slots = blocks * sdp->sd_qc_per_block; 1141 sdp->sd_quota_slots = blocks * sdp->sd_qc_per_block;
1136 sdp->sd_quota_chunks = DIV_RU(sdp->sd_quota_slots, 8 * PAGE_SIZE); 1142 sdp->sd_quota_chunks = DIV_ROUND_UP(sdp->sd_quota_slots, 8 * PAGE_SIZE);
1137 1143
1138 error = -ENOMEM; 1144 error = -ENOMEM;
1139 1145
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
index e5f2b284fa54..2df450e2f433 100644
--- a/fs/gfs2/recovery.c
+++ b/fs/gfs2/recovery.c
@@ -12,9 +12,12 @@
12#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13#include <linux/completion.h> 13#include <linux/completion.h>
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/gfs2_ondisk.h>
15#include <asm/semaphore.h> 16#include <asm/semaphore.h>
16 17
17#include "gfs2.h" 18#include "gfs2.h"
19#include "lm_interface.h"
20#include "incore.h"
18#include "bmap.h" 21#include "bmap.h"
19#include "glock.h" 22#include "glock.h"
20#include "glops.h" 23#include "glops.h"
@@ -23,22 +26,24 @@
23#include "meta_io.h" 26#include "meta_io.h"
24#include "recovery.h" 27#include "recovery.h"
25#include "super.h" 28#include "super.h"
29#include "util.h"
26 30
27int gfs2_replay_read_block(struct gfs2_jdesc *jd, unsigned int blk, 31int gfs2_replay_read_block(struct gfs2_jdesc *jd, unsigned int blk,
28 struct buffer_head **bh) 32 struct buffer_head **bh)
29{ 33{
30 struct gfs2_glock *gl = get_v2ip(jd->jd_inode)->i_gl; 34 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip;
35 struct gfs2_glock *gl = ip->i_gl;
31 int new = 0; 36 int new = 0;
32 uint64_t dblock; 37 uint64_t dblock;
33 uint32_t extlen; 38 uint32_t extlen;
34 int error; 39 int error;
35 40
36 error = gfs2_block_map(get_v2ip(jd->jd_inode), blk, &new, &dblock, 41 error = gfs2_block_map(ip, blk, &new, &dblock,
37 &extlen); 42 &extlen);
38 if (error) 43 if (error)
39 return error; 44 return error;
40 if (!dblock) { 45 if (!dblock) {
41 gfs2_consist_inode(get_v2ip(jd->jd_inode)); 46 gfs2_consist_inode(ip);
42 return -EIO; 47 return -EIO;
43 } 48 }
44 49
@@ -185,7 +190,7 @@ static int find_good_lh(struct gfs2_jdesc *jd, unsigned int *blk,
185 *blk = 0; 190 *blk = 0;
186 191
187 if (*blk == orig_blk) { 192 if (*blk == orig_blk) {
188 gfs2_consist_inode(get_v2ip(jd->jd_inode)); 193 gfs2_consist_inode(jd->jd_inode->u.generic_ip);
189 return -EIO; 194 return -EIO;
190 } 195 }
191 } 196 }
@@ -219,7 +224,7 @@ static int jhead_scan(struct gfs2_jdesc *jd, struct gfs2_log_header *head)
219 continue; 224 continue;
220 225
221 if (lh.lh_sequence == head->lh_sequence) { 226 if (lh.lh_sequence == head->lh_sequence) {
222 gfs2_consist_inode(get_v2ip(jd->jd_inode)); 227 gfs2_consist_inode(jd->jd_inode->u.generic_ip);
223 return -EIO; 228 return -EIO;
224 } 229 }
225 if (lh.lh_sequence < head->lh_sequence) 230 if (lh.lh_sequence < head->lh_sequence)
@@ -295,7 +300,8 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header *head)
295static int foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start, 300static int foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start,
296 unsigned int end, int pass) 301 unsigned int end, int pass)
297{ 302{
298 struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; 303 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip;
304 struct gfs2_sbd *sdp = ip->i_sbd;
299 struct buffer_head *bh; 305 struct buffer_head *bh;
300 struct gfs2_log_descriptor *ld; 306 struct gfs2_log_descriptor *ld;
301 int error = 0; 307 int error = 0;
@@ -324,7 +330,7 @@ static int foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start,
324 continue; 330 continue;
325 } 331 }
326 if (error == 1) { 332 if (error == 1) {
327 gfs2_consist_inode(get_v2ip(jd->jd_inode)); 333 gfs2_consist_inode(jd->jd_inode->u.generic_ip);
328 error = -EIO; 334 error = -EIO;
329 } 335 }
330 brelse(bh); 336 brelse(bh);
@@ -361,7 +367,7 @@ static int foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start,
361 367
362static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header *head) 368static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header *head)
363{ 369{
364 struct gfs2_inode *ip = get_v2ip(jd->jd_inode); 370 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip;
365 struct gfs2_sbd *sdp = ip->i_sbd; 371 struct gfs2_sbd *sdp = ip->i_sbd;
366 unsigned int lblock; 372 unsigned int lblock;
367 int new = 0; 373 int new = 0;
@@ -420,7 +426,8 @@ static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header *head)
420 426
421int gfs2_recover_journal(struct gfs2_jdesc *jd, int wait) 427int gfs2_recover_journal(struct gfs2_jdesc *jd, int wait)
422{ 428{
423 struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; 429 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip;
430 struct gfs2_sbd *sdp = ip->i_sbd;
424 struct gfs2_log_header head; 431 struct gfs2_log_header head;
425 struct gfs2_holder j_gh, ji_gh, t_gh; 432 struct gfs2_holder j_gh, ji_gh, t_gh;
426 unsigned long t; 433 unsigned long t;
@@ -450,7 +457,7 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd, int wait)
450 goto fail; 457 goto fail;
451 }; 458 };
452 459
453 error = gfs2_glock_nq_init(get_v2ip(jd->jd_inode)->i_gl, LM_ST_SHARED, 460 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED,
454 LM_FLAG_NOEXP, &ji_gh); 461 LM_FLAG_NOEXP, &ji_gh);
455 if (error) 462 if (error)
456 goto fail_gunlock_j; 463 goto fail_gunlock_j;
@@ -516,7 +523,7 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd, int wait)
516 523
517 gfs2_glock_dq_uninit(&t_gh); 524 gfs2_glock_dq_uninit(&t_gh);
518 525
519 t = DIV_RU(jiffies - t, HZ); 526 t = DIV_ROUND_UP(jiffies - t, HZ);
520 527
521 fs_info(sdp, "jid=%u: Journal replayed in %lus\n", 528 fs_info(sdp, "jid=%u: Journal replayed in %lus\n",
522 jd->jd_jid, t); 529 jd->jd_jid, t);
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 9525b176f502..4ae559694396 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -13,9 +13,12 @@
13#include <linux/completion.h> 13#include <linux/completion.h>
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/fs.h> 15#include <linux/fs.h>
16#include <linux/gfs2_ondisk.h>
16#include <asm/semaphore.h> 17#include <asm/semaphore.h>
17 18
18#include "gfs2.h" 19#include "gfs2.h"
20#include "lm_interface.h"
21#include "incore.h"
19#include "bits.h" 22#include "bits.h"
20#include "glock.h" 23#include "glock.h"
21#include "glops.h" 24#include "glops.h"
@@ -26,6 +29,7 @@
26#include "super.h" 29#include "super.h"
27#include "trans.h" 30#include "trans.h"
28#include "ops_file.h" 31#include "ops_file.h"
32#include "util.h"
29 33
30/** 34/**
31 * gfs2_rgrp_verify - Verify that a resource group is consistent 35 * gfs2_rgrp_verify - Verify that a resource group is consistent
@@ -171,7 +175,7 @@ static void clear_rgrpdi(struct gfs2_sbd *sdp)
171 list_del(&rgd->rd_list_mru); 175 list_del(&rgd->rd_list_mru);
172 176
173 if (gl) { 177 if (gl) {
174 set_gl2rgd(gl, NULL); 178 gl->gl_object = NULL;
175 gfs2_glock_put(gl); 179 gfs2_glock_put(gl);
176 } 180 }
177 181
@@ -320,7 +324,7 @@ static int gfs2_ri_update(struct gfs2_inode *ip)
320 if (error) 324 if (error)
321 goto fail; 325 goto fail;
322 326
323 set_gl2rgd(rgd->rd_gl, rgd); 327 rgd->rd_gl->gl_object = rgd;
324 rgd->rd_rg_vn = rgd->rd_gl->gl_vn - 1; 328 rgd->rd_rg_vn = rgd->rd_gl->gl_vn - 1;
325 } 329 }
326 330
@@ -354,7 +358,7 @@ static int gfs2_ri_update(struct gfs2_inode *ip)
354 358
355int gfs2_rindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ri_gh) 359int gfs2_rindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ri_gh)
356{ 360{
357 struct gfs2_inode *ip = get_v2ip(sdp->sd_rindex); 361 struct gfs2_inode *ip = sdp->sd_rindex->u.generic_ip;
358 struct gfs2_glock *gl = ip->i_gl; 362 struct gfs2_glock *gl = ip->i_gl;
359 int error; 363 int error;
360 364
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 2c1c6aa1c077..9ccf0b9c5980 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -12,9 +12,12 @@
12#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13#include <linux/completion.h> 13#include <linux/completion.h>
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/gfs2_ondisk.h>
15#include <asm/semaphore.h> 16#include <asm/semaphore.h>
16 17
17#include "gfs2.h" 18#include "gfs2.h"
19#include "lm_interface.h"
20#include "incore.h"
18#include "bmap.h" 21#include "bmap.h"
19#include "dir.h" 22#include "dir.h"
20#include "format.h" 23#include "format.h"
@@ -29,6 +32,7 @@
29#include "super.h" 32#include "super.h"
30#include "trans.h" 33#include "trans.h"
31#include "unlinked.h" 34#include "unlinked.h"
35#include "util.h"
32 36
33/** 37/**
34 * gfs2_tune_init - Fill a gfs2_tune structure with default values 38 * gfs2_tune_init - Fill a gfs2_tune structure with default values
@@ -207,12 +211,12 @@ int gfs2_read_sb(struct gfs2_sbd *sdp, struct gfs2_glock *gl, int silent)
207 211
208 /* Compute maximum reservation required to add a entry to a directory */ 212 /* Compute maximum reservation required to add a entry to a directory */
209 213
210 hash_blocks = DIV_RU(sizeof(uint64_t) * (1 << GFS2_DIR_MAX_DEPTH), 214 hash_blocks = DIV_ROUND_UP(sizeof(uint64_t) * (1 << GFS2_DIR_MAX_DEPTH),
211 sdp->sd_jbsize); 215 sdp->sd_jbsize);
212 216
213 ind_blocks = 0; 217 ind_blocks = 0;
214 for (tmp_blocks = hash_blocks; tmp_blocks > sdp->sd_diptrs;) { 218 for (tmp_blocks = hash_blocks; tmp_blocks > sdp->sd_diptrs;) {
215 tmp_blocks = DIV_RU(tmp_blocks, sdp->sd_inptrs); 219 tmp_blocks = DIV_ROUND_UP(tmp_blocks, sdp->sd_inptrs);
216 ind_blocks += tmp_blocks; 220 ind_blocks += tmp_blocks;
217 } 221 }
218 222
@@ -278,7 +282,7 @@ int gfs2_do_upgrade(struct gfs2_sbd *sdp, struct gfs2_glock *sb_gl)
278 282
279int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh) 283int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)
280{ 284{
281 struct gfs2_inode *dip = get_v2ip(sdp->sd_jindex); 285 struct gfs2_inode *dip = sdp->sd_jindex->u.generic_ip;
282 struct qstr name; 286 struct qstr name;
283 char buf[20]; 287 char buf[20];
284 struct gfs2_jdesc *jd; 288 struct gfs2_jdesc *jd;
@@ -296,7 +300,7 @@ int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)
296 300
297 name.len = sprintf(buf, "journal%u", sdp->sd_journals); 301 name.len = sprintf(buf, "journal%u", sdp->sd_journals);
298 302
299 error = gfs2_dir_search(get_v2ip(sdp->sd_jindex), 303 error = gfs2_dir_search(sdp->sd_jindex->u.generic_ip,
300 &name, NULL, NULL); 304 &name, NULL, NULL);
301 if (error == -ENOENT) { 305 if (error == -ENOENT) {
302 error = 0; 306 error = 0;
@@ -419,7 +423,7 @@ struct gfs2_jdesc *gfs2_jdesc_find_dirty(struct gfs2_sbd *sdp)
419 423
420int gfs2_jdesc_check(struct gfs2_jdesc *jd) 424int gfs2_jdesc_check(struct gfs2_jdesc *jd)
421{ 425{
422 struct gfs2_inode *ip = get_v2ip(jd->jd_inode); 426 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip;
423 struct gfs2_sbd *sdp = ip->i_sbd; 427 struct gfs2_sbd *sdp = ip->i_sbd;
424 int ar; 428 int ar;
425 int error; 429 int error;
@@ -471,7 +475,8 @@ int gfs2_lookup_master_dir(struct gfs2_sbd *sdp)
471 475
472int gfs2_make_fs_rw(struct gfs2_sbd *sdp) 476int gfs2_make_fs_rw(struct gfs2_sbd *sdp)
473{ 477{
474 struct gfs2_glock *j_gl = get_v2ip(sdp->sd_jdesc->jd_inode)->i_gl; 478 struct gfs2_inode *ip = sdp->sd_jdesc->jd_inode->u.generic_ip;
479 struct gfs2_glock *j_gl = ip->i_gl;
475 struct gfs2_holder t_gh; 480 struct gfs2_holder t_gh;
476 struct gfs2_log_header head; 481 struct gfs2_log_header head;
477 int error; 482 int error;
@@ -481,7 +486,7 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp)
481 if (error) 486 if (error)
482 return error; 487 return error;
483 488
484 gfs2_meta_cache_flush(get_v2ip(sdp->sd_jdesc->jd_inode)); 489 gfs2_meta_cache_flush(ip);
485 j_gl->gl_ops->go_inval(j_gl, DIO_METADATA | DIO_DATA); 490 j_gl->gl_ops->go_inval(j_gl, DIO_METADATA | DIO_DATA);
486 491
487 error = gfs2_find_jhead(sdp->sd_jdesc, &head); 492 error = gfs2_find_jhead(sdp->sd_jdesc, &head);
@@ -559,9 +564,9 @@ int gfs2_make_fs_ro(struct gfs2_sbd *sdp)
559 564
560int gfs2_statfs_init(struct gfs2_sbd *sdp) 565int gfs2_statfs_init(struct gfs2_sbd *sdp)
561{ 566{
562 struct gfs2_inode *m_ip = get_v2ip(sdp->sd_statfs_inode); 567 struct gfs2_inode *m_ip = sdp->sd_statfs_inode->u.generic_ip;
563 struct gfs2_statfs_change *m_sc = &sdp->sd_statfs_master; 568 struct gfs2_statfs_change *m_sc = &sdp->sd_statfs_master;
564 struct gfs2_inode *l_ip = get_v2ip(sdp->sd_sc_inode); 569 struct gfs2_inode *l_ip = sdp->sd_sc_inode->u.generic_ip;
565 struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local; 570 struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local;
566 struct buffer_head *m_bh, *l_bh; 571 struct buffer_head *m_bh, *l_bh;
567 struct gfs2_holder gh; 572 struct gfs2_holder gh;
@@ -608,7 +613,7 @@ int gfs2_statfs_init(struct gfs2_sbd *sdp)
608void gfs2_statfs_change(struct gfs2_sbd *sdp, int64_t total, int64_t free, 613void gfs2_statfs_change(struct gfs2_sbd *sdp, int64_t total, int64_t free,
609 int64_t dinodes) 614 int64_t dinodes)
610{ 615{
611 struct gfs2_inode *l_ip = get_v2ip(sdp->sd_sc_inode); 616 struct gfs2_inode *l_ip = sdp->sd_sc_inode->u.generic_ip;
612 struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local; 617 struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local;
613 struct buffer_head *l_bh; 618 struct buffer_head *l_bh;
614 int error; 619 int error;
@@ -634,8 +639,8 @@ void gfs2_statfs_change(struct gfs2_sbd *sdp, int64_t total, int64_t free,
634 639
635int gfs2_statfs_sync(struct gfs2_sbd *sdp) 640int gfs2_statfs_sync(struct gfs2_sbd *sdp)
636{ 641{
637 struct gfs2_inode *m_ip = get_v2ip(sdp->sd_statfs_inode); 642 struct gfs2_inode *m_ip = sdp->sd_statfs_inode->u.generic_ip;
638 struct gfs2_inode *l_ip = get_v2ip(sdp->sd_sc_inode); 643 struct gfs2_inode *l_ip = sdp->sd_sc_inode->u.generic_ip;
639 struct gfs2_statfs_change *m_sc = &sdp->sd_statfs_master; 644 struct gfs2_statfs_change *m_sc = &sdp->sd_statfs_master;
640 struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local; 645 struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local;
641 struct gfs2_holder gh; 646 struct gfs2_holder gh;
@@ -795,7 +800,8 @@ int gfs2_statfs_slow(struct gfs2_sbd *sdp, struct gfs2_statfs_change *sc)
795 error = err; 800 error = err;
796 } else { 801 } else {
797 if (!error) 802 if (!error)
798 error = statfs_slow_fill(get_gl2rgd(gh->gh_gl), sc); 803 error = statfs_slow_fill(
804 gh->gh_gl->gl_object, sc);
799 gfs2_glock_dq_uninit(gh); 805 gfs2_glock_dq_uninit(gh);
800 } 806 }
801 } 807 }
@@ -846,6 +852,7 @@ struct lfcc {
846 852
847int gfs2_lock_fs_check_clean(struct gfs2_sbd *sdp, struct gfs2_holder *t_gh) 853int gfs2_lock_fs_check_clean(struct gfs2_sbd *sdp, struct gfs2_holder *t_gh)
848{ 854{
855 struct gfs2_inode *ip;
849 struct gfs2_holder ji_gh; 856 struct gfs2_holder ji_gh;
850 struct gfs2_jdesc *jd; 857 struct gfs2_jdesc *jd;
851 struct lfcc *lfcc; 858 struct lfcc *lfcc;
@@ -863,7 +870,8 @@ int gfs2_lock_fs_check_clean(struct gfs2_sbd *sdp, struct gfs2_holder *t_gh)
863 error = -ENOMEM; 870 error = -ENOMEM;
864 goto out; 871 goto out;
865 } 872 }
866 error = gfs2_glock_nq_init(get_v2ip(jd->jd_inode)->i_gl, 873 ip = jd->jd_inode->u.generic_ip;
874 error = gfs2_glock_nq_init(ip->i_gl,
867 LM_ST_SHARED, 0, 875 LM_ST_SHARED, 0,
868 &lfcc->gh); 876 &lfcc->gh);
869 if (error) { 877 if (error) {
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index f87df8ec041e..f05ba8f69132 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -14,15 +14,19 @@
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/kobject.h> 16#include <linux/kobject.h>
17#include <linux/gfs2_ondisk.h>
17#include <asm/semaphore.h> 18#include <asm/semaphore.h>
18#include <asm/uaccess.h> 19#include <asm/uaccess.h>
19 20
20#include "gfs2.h" 21#include "gfs2.h"
22#include "lm_interface.h"
23#include "incore.h"
21#include "lm.h" 24#include "lm.h"
22#include "sys.h" 25#include "sys.h"
23#include "super.h" 26#include "super.h"
24#include "glock.h" 27#include "glock.h"
25#include "quota.h" 28#include "quota.h"
29#include "util.h"
26 30
27char *gfs2_sys_margs; 31char *gfs2_sys_margs;
28spinlock_t gfs2_sys_margs_lock; 32spinlock_t gfs2_sys_margs_lock;
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index 0a0ea70eac4c..2cce68aec134 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -12,14 +12,18 @@
12#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13#include <linux/completion.h> 13#include <linux/completion.h>
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/gfs2_ondisk.h>
15#include <asm/semaphore.h> 16#include <asm/semaphore.h>
16 17
17#include "gfs2.h" 18#include "gfs2.h"
19#include "lm_interface.h"
20#include "incore.h"
18#include "glock.h" 21#include "glock.h"
19#include "log.h" 22#include "log.h"
20#include "lops.h" 23#include "lops.h"
21#include "meta_io.h" 24#include "meta_io.h"
22#include "trans.h" 25#include "trans.h"
26#include "util.h"
23 27
24int gfs2_trans_begin_i(struct gfs2_sbd *sdp, unsigned int blocks, 28int gfs2_trans_begin_i(struct gfs2_sbd *sdp, unsigned int blocks,
25 unsigned int revokes, char *file, unsigned int line) 29 unsigned int revokes, char *file, unsigned int line)
@@ -27,7 +31,7 @@ int gfs2_trans_begin_i(struct gfs2_sbd *sdp, unsigned int blocks,
27 struct gfs2_trans *tr; 31 struct gfs2_trans *tr;
28 int error; 32 int error;
29 33
30 if (gfs2_assert_warn(sdp, !get_transaction) || 34 if (gfs2_assert_warn(sdp, !current->journal_info) ||
31 gfs2_assert_warn(sdp, blocks || revokes)) { 35 gfs2_assert_warn(sdp, blocks || revokes)) {
32 fs_warn(sdp, "(%s, %u)\n", file, line); 36 fs_warn(sdp, "(%s, %u)\n", file, line);
33 return -EINVAL; 37 return -EINVAL;
@@ -69,7 +73,7 @@ int gfs2_trans_begin_i(struct gfs2_sbd *sdp, unsigned int blocks,
69 if (error) 73 if (error)
70 goto fail_gunlock; 74 goto fail_gunlock;
71 75
72 set_transaction(tr); 76 current->journal_info = tr;
73 77
74 return 0; 78 return 0;
75 79
@@ -90,8 +94,8 @@ void gfs2_trans_end(struct gfs2_sbd *sdp)
90 struct gfs2_trans *tr; 94 struct gfs2_trans *tr;
91 struct gfs2_holder *t_gh; 95 struct gfs2_holder *t_gh;
92 96
93 tr = get_transaction; 97 tr = current->journal_info;
94 set_transaction(NULL); 98 current->journal_info = NULL;
95 99
96 if (gfs2_assert_warn(sdp, tr)) 100 if (gfs2_assert_warn(sdp, tr))
97 return; 101 return;
@@ -147,12 +151,12 @@ void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh, int meta)
147 struct gfs2_sbd *sdp = gl->gl_sbd; 151 struct gfs2_sbd *sdp = gl->gl_sbd;
148 struct gfs2_bufdata *bd; 152 struct gfs2_bufdata *bd;
149 153
150 bd = get_v2bd(bh); 154 bd = bh->b_private;
151 if (bd) 155 if (bd)
152 gfs2_assert(sdp, bd->bd_gl == gl); 156 gfs2_assert(sdp, bd->bd_gl == gl);
153 else { 157 else {
154 gfs2_attach_bufdata(gl, bh, meta); 158 gfs2_attach_bufdata(gl, bh, meta);
155 bd = get_v2bd(bh); 159 bd = bh->b_private;
156 } 160 }
157 lops_add(sdp, &bd->bd_le); 161 lops_add(sdp, &bd->bd_le);
158} 162}
@@ -186,8 +190,9 @@ void gfs2_trans_add_unrevoke(struct gfs2_sbd *sdp, uint64_t blkno)
186 gfs2_log_unlock(sdp); 190 gfs2_log_unlock(sdp);
187 191
188 if (found) { 192 if (found) {
193 struct gfs2_trans *tr = current->journal_info;
189 kfree(rv); 194 kfree(rv);
190 get_transaction->tr_num_revoke_rm++; 195 tr->tr_num_revoke_rm++;
191 } 196 }
192} 197}
193 198
diff --git a/fs/gfs2/unlinked.c b/fs/gfs2/unlinked.c
index e92a3a11815b..24b91c23bc2d 100644
--- a/fs/gfs2/unlinked.c
+++ b/fs/gfs2/unlinked.c
@@ -13,19 +13,23 @@
13#include <linux/completion.h> 13#include <linux/completion.h>
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/kthread.h> 15#include <linux/kthread.h>
16#include <linux/gfs2_ondisk.h>
16#include <asm/semaphore.h> 17#include <asm/semaphore.h>
17 18
18#include "gfs2.h" 19#include "gfs2.h"
20#include "lm_interface.h"
21#include "incore.h"
19#include "bmap.h" 22#include "bmap.h"
20#include "inode.h" 23#include "inode.h"
21#include "meta_io.h" 24#include "meta_io.h"
22#include "trans.h" 25#include "trans.h"
23#include "unlinked.h" 26#include "unlinked.h"
27#include "util.h"
24 28
25static int munge_ondisk(struct gfs2_sbd *sdp, unsigned int slot, 29static int munge_ondisk(struct gfs2_sbd *sdp, unsigned int slot,
26 struct gfs2_unlinked_tag *ut) 30 struct gfs2_unlinked_tag *ut)
27{ 31{
28 struct gfs2_inode *ip = get_v2ip(sdp->sd_ut_inode); 32 struct gfs2_inode *ip = sdp->sd_ut_inode->u.generic_ip;
29 unsigned int block, offset; 33 unsigned int block, offset;
30 uint64_t dblock; 34 uint64_t dblock;
31 int new = 0; 35 int new = 0;
@@ -312,7 +316,7 @@ int gfs2_unlinked_dealloc(struct gfs2_sbd *sdp)
312 316
313int gfs2_unlinked_init(struct gfs2_sbd *sdp) 317int gfs2_unlinked_init(struct gfs2_sbd *sdp)
314{ 318{
315 struct gfs2_inode *ip = get_v2ip(sdp->sd_ut_inode); 319 struct gfs2_inode *ip = sdp->sd_ut_inode->u.generic_ip;
316 unsigned int blocks = ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift; 320 unsigned int blocks = ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift;
317 unsigned int x, slot = 0; 321 unsigned int x, slot = 0;
318 unsigned int found = 0; 322 unsigned int found = 0;
@@ -327,7 +331,8 @@ int gfs2_unlinked_init(struct gfs2_sbd *sdp)
327 return -EIO; 331 return -EIO;
328 } 332 }
329 sdp->sd_unlinked_slots = blocks * sdp->sd_ut_per_block; 333 sdp->sd_unlinked_slots = blocks * sdp->sd_ut_per_block;
330 sdp->sd_unlinked_chunks = DIV_RU(sdp->sd_unlinked_slots, 8 * PAGE_SIZE); 334 sdp->sd_unlinked_chunks = DIV_ROUND_UP(sdp->sd_unlinked_slots,
335 8 * PAGE_SIZE);
331 336
332 error = -ENOMEM; 337 error = -ENOMEM;
333 338
diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
index 4fb1704aac10..8b22fa91bd14 100644
--- a/fs/gfs2/util.c
+++ b/fs/gfs2/util.c
@@ -13,12 +13,16 @@
13#include <linux/completion.h> 13#include <linux/completion.h>
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/crc32.h> 15#include <linux/crc32.h>
16#include <linux/gfs2_ondisk.h>
16#include <asm/semaphore.h> 17#include <asm/semaphore.h>
17#include <asm/uaccess.h> 18#include <asm/uaccess.h>
18 19
19#include "gfs2.h" 20#include "gfs2.h"
21#include "lm_interface.h"
22#include "incore.h"
20#include "glock.h" 23#include "glock.h"
21#include "lm.h" 24#include "lm.h"
25#include "util.h"
22 26
23kmem_cache_t *gfs2_glock_cachep __read_mostly; 27kmem_cache_t *gfs2_glock_cachep __read_mostly;
24kmem_cache_t *gfs2_inode_cachep __read_mostly; 28kmem_cache_t *gfs2_inode_cachep __read_mostly;