summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--include/linux/gfs2_ondisk.h11
-rw-r--r--include/linux/kernel.h1
40 files changed, 416 insertions, 272 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 @@
#include <linux/posix_acl.h>
#include <linux/posix_acl_xattr.h>
#include <asm/semaphore.h>
+#include <linux/gfs2_ondisk.h>
#include "gfs2.h"
+#include "lm_interface.h"
+#include "incore.h"
#include "acl.h"
#include "eaops.h"
#include "eattr.h"
@@ -24,6 +27,7 @@
#include "inode.h"
#include "meta_io.h"
#include "trans.h"
+#include "util.h"
#define ACL_ACCESS 1
#define ACL_DEFAULT 0
@@ -157,7 +161,7 @@ int gfs2_check_acl_locked(struct inode *inode, int mask)
struct posix_acl *acl = NULL;
int error;
- error = acl_get(get_v2ip(inode), ACL_ACCESS, &acl, NULL, NULL, NULL);
+ error = acl_get(inode->u.generic_ip, ACL_ACCESS, &acl, NULL, NULL, NULL);
if (error)
return error;
@@ -172,7 +176,7 @@ int gfs2_check_acl_locked(struct inode *inode, int mask)
int gfs2_check_acl(struct inode *inode, int mask)
{
- struct gfs2_inode *ip = get_v2ip(inode);
+ struct gfs2_inode *ip = inode->u.generic_ip;
struct gfs2_holder i_gh;
int error;
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 @@
#include <linux/spinlock.h>
#include <linux/completion.h>
#include <linux/buffer_head.h>
+#include <linux/gfs2_ondisk.h>
#include <asm/semaphore.h>
#include "gfs2.h"
+#include "lm_interface.h"
+#include "incore.h"
#include "bits.h"
+#include "util.h"
static const char valid_change[16] = {
/* 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 @@
#include <linux/spinlock.h>
#include <linux/completion.h>
#include <linux/buffer_head.h>
+#include <linux/gfs2_ondisk.h>
#include <asm/semaphore.h>
#include "gfs2.h"
+#include "lm_interface.h"
+#include "incore.h"
#include "bmap.h"
#include "glock.h"
#include "inode.h"
@@ -24,6 +27,7 @@
#include "rgrp.h"
#include "trans.h"
#include "dir.h"
+#include "util.h"
/* This doesn't need to be that large as max 64 bit pointers in a 4k
* 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,
for (x = 0; x < rlist.rl_rgrps; x++) {
struct gfs2_rgrpd *rgd;
- rgd = get_gl2rgd(rlist.rl_ghs[x].gh_gl);
+ rgd = rlist.rl_ghs[x].gh_gl->gl_object;
rg_blocks += rgd->rd_ri.ri_length;
}
@@ -1021,7 +1025,7 @@ void gfs2_write_calc_reserv(struct gfs2_inode *ip, unsigned int len,
unsigned int tmp;
if (gfs2_is_dir(ip)) {
- *data_blocks = DIV_RU(len, sdp->sd_jbsize) + 2;
+ *data_blocks = DIV_ROUND_UP(len, sdp->sd_jbsize) + 2;
*ind_blocks = 3 * (sdp->sd_max_jheight - 1);
} else {
*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,
}
for (tmp = *data_blocks; tmp > sdp->sd_diptrs;) {
- tmp = DIV_RU(tmp, sdp->sd_inptrs);
+ tmp = DIV_ROUND_UP(tmp, sdp->sd_inptrs);
*ind_blocks += tmp;
}
}
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 @@
#include <linux/buffer_head.h>
#include <linux/kthread.h>
#include <linux/delay.h>
+#include <linux/gfs2_ondisk.h>
#include <asm/semaphore.h>
#include "gfs2.h"
+#include "lm_interface.h"
+#include "incore.h"
#include "daemon.h"
#include "glock.h"
#include "log.h"
@@ -24,6 +27,7 @@
#include "recovery.h"
#include "super.h"
#include "unlinked.h"
+#include "util.h"
/* This uses schedule_timeout() instead of msleep() because it's good for
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 @@
#include <linux/completion.h>
#include <linux/buffer_head.h>
#include <linux/sort.h>
+#include <linux/gfs2_ondisk.h>
#include <asm/semaphore.h>
#include "gfs2.h"
+#include "lm_interface.h"
+#include "incore.h"
#include "dir.h"
#include "glock.h"
#include "inode.h"
@@ -70,6 +73,7 @@
#include "rgrp.h"
#include "trans.h"
#include "bmap.h"
+#include "util.h"
#define IS_LEAF 1 /* Hashed (leaf) directory */
#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,
for (x = 0; x < rlist.rl_rgrps; x++) {
struct gfs2_rgrpd *rgd;
- rgd = get_gl2rgd(rlist.rl_ghs[x].gh_gl);
+ rgd = rlist.rl_ghs[x].gh_gl->gl_object;
rg_blocks += rgd->rd_ri.ri_length;
}
@@ -2205,7 +2209,7 @@ static int leaf_dealloc(struct gfs2_inode *dip, uint32_t index, uint32_t len,
goto out_rlist;
error = gfs2_trans_begin(sdp,
- rg_blocks + (DIV_RU(size, sdp->sd_jbsize) + 1) +
+ rg_blocks + (DIV_ROUND_UP(size, sdp->sd_jbsize) + 1) +
RES_DINODE + RES_STATFS + RES_QUOTA, l_blocks);
if (error)
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 @@
#include <linux/completion.h>
#include <linux/buffer_head.h>
#include <linux/xattr.h>
+#include <linux/gfs2_ondisk.h>
#include <asm/semaphore.h>
#include <asm/uaccess.h>
#include "gfs2.h"
+#include "lm_interface.h"
+#include "incore.h"
#include "acl.h"
#include "eaops.h"
#include "eattr.h"
+#include "util.h"
/**
* 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 @@
#include <linux/completion.h>
#include <linux/buffer_head.h>
#include <linux/xattr.h>
+#include <linux/gfs2_ondisk.h>
#include <asm/semaphore.h>
#include <asm/uaccess.h>
#include "gfs2.h"
+#include "lm_interface.h"
+#include "incore.h"
#include "acl.h"
#include "eaops.h"
#include "eattr.h"
@@ -26,6 +29,7 @@
#include "quota.h"
#include "rgrp.h"
#include "trans.h"
+#include "util.h"
/**
* 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,
struct gfs2_sbd *sdp = ip->i_sbd;
struct buffer_head **bh;
unsigned int amount = GFS2_EA_DATA_LEN(ea);
- unsigned int nptrs = DIV_RU(amount, sdp->sd_jbsize);
+ unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize);
uint64_t *dataptrs = GFS2_EA2DATAPTRS(ea);
unsigned int x;
int error = 0;
@@ -676,7 +680,7 @@ static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
unsigned int copy;
unsigned int x;
- ea->ea_num_ptrs = DIV_RU(er->er_data_len, sdp->sd_jbsize);
+ ea->ea_num_ptrs = DIV_ROUND_UP(er->er_data_len, sdp->sd_jbsize);
for (x = 0; x < ea->ea_num_ptrs; x++) {
struct buffer_head *bh;
uint64_t block;
@@ -810,7 +814,7 @@ static int ea_init(struct gfs2_inode *ip, struct gfs2_ea_request *er)
unsigned int blks = 1;
if (GFS2_EAREQ_SIZE_STUFFED(er) > jbsize)
- blks += DIV_RU(er->er_data_len, jbsize);
+ blks += DIV_ROUND_UP(er->er_data_len, jbsize);
return ea_alloc_skeleton(ip, er, blks, ea_init_i, NULL);
}
@@ -962,7 +966,8 @@ static int ea_set_simple(struct gfs2_inode *ip, struct buffer_head *bh,
es->es_bh = bh;
es->es_ea = ea;
- blks = 2 + DIV_RU(es->es_er->er_data_len, ip->i_sbd->sd_jbsize);
+ blks = 2 + DIV_ROUND_UP(es->es_er->er_data_len,
+ ip->i_sbd->sd_jbsize);
error = ea_alloc_skeleton(ip, es->es_er, blks,
ea_set_simple_alloc, es);
@@ -1066,7 +1071,7 @@ static int ea_set_i(struct gfs2_inode *ip, struct gfs2_ea_request *er,
if (!(ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT))
blks++;
if (GFS2_EAREQ_SIZE_STUFFED(er) > ip->i_sbd->sd_jbsize)
- blks += DIV_RU(er->er_data_len, ip->i_sbd->sd_jbsize);
+ blks += DIV_ROUND_UP(er->er_data_len, ip->i_sbd->sd_jbsize);
return ea_alloc_skeleton(ip, er, blks, ea_set_block, el);
}
@@ -1250,7 +1255,7 @@ static int ea_acl_chmod_unstuffed(struct gfs2_inode *ip,
struct gfs2_sbd *sdp = ip->i_sbd;
struct buffer_head **bh;
unsigned int amount = GFS2_EA_DATA_LEN(ea);
- unsigned int nptrs = DIV_RU(amount, sdp->sd_jbsize);
+ unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize);
uint64_t *dataptrs = GFS2_EA2DATAPTRS(ea);
unsigned int x;
int error;
@@ -1402,7 +1407,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
for (x = 0; x < rlist.rl_rgrps; x++) {
struct gfs2_rgrpd *rgd;
- rgd = get_gl2rgd(rlist.rl_ghs[x].gh_gl);
+ rgd = rlist.rl_ghs[x].gh_gl->gl_object;
rg_blocks += rgd->rd_ri.ri_length;
}
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)
#define GFS2_EAREQ_SIZE_UNSTUFFED(sdp, er) \
ALIGN(sizeof(struct gfs2_ea_header) + (er)->er_name_len + \
- sizeof(uint64_t) * DIV_RU((er)->er_data_len, (sdp)->sd_jbsize), 8)
+ sizeof(uint64_t) * DIV_ROUND_UP((er)->er_data_len, (sdp)->sd_jbsize), 8)
#define GFS2_EA2NAME(ea) ((char *)((struct gfs2_ea_header *)(ea) + 1))
#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 @@
#ifndef __GFS2_DOT_H__
#define __GFS2_DOT_H__
-#include <linux/gfs2_ondisk.h>
-
-#include "lm_interface.h"
-#include "lvb.h"
-#include "incore.h"
-#include "util.h"
-
enum {
NO_CREATE = 0,
CREATE = 1,
@@ -32,29 +25,7 @@ enum {
FORCE = 1,
};
-/* Divide num by den. Round up if there is a remainder. */
-#define DIV_RU(num, den) (((num) + (den) - 1) / (den))
-
#define GFS2_FAST_NAME_SIZE 8
-#define get_v2sdp(sb) ((struct gfs2_sbd *)(sb)->s_fs_info)
-#define set_v2sdp(sb, sdp) (sb)->s_fs_info = (sdp)
-#define get_v2ip(inode) ((struct gfs2_inode *)(inode)->u.generic_ip)
-#define set_v2ip(inode, ip) (inode)->u.generic_ip = (ip)
-#define get_v2fp(file) ((struct gfs2_file *)(file)->private_data)
-#define set_v2fp(file, fp) (file)->private_data = (fp)
-#define get_v2bd(bh) ((struct gfs2_bufdata *)(bh)->b_private)
-#define set_v2bd(bh, bd) (bh)->b_private = (bd)
-
-#define get_transaction ((struct gfs2_trans *)(current->journal_info))
-#define set_transaction(tr) (current->journal_info) = (tr)
-
-#define get_gl2ip(gl) ((struct gfs2_inode *)(gl)->gl_object)
-#define set_gl2ip(gl, ip) (gl)->gl_object = (ip)
-#define get_gl2rgd(gl) ((struct gfs2_rgrpd *)(gl)->gl_object)
-#define set_gl2rgd(gl, rgd) (gl)->gl_object = (rgd)
-#define get_gl2gl(gl) ((struct gfs2_glock *)(gl)->gl_object)
-#define set_gl2gl(gl, gl2) (gl)->gl_object = (gl2)
-
#endif /* __GFS2_DOT_H__ */
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 @@
#include <linux/sort.h>
#include <linux/jhash.h>
#include <linux/kref.h>
+#include <linux/gfs2_ondisk.h>
#include <asm/semaphore.h>
#include <asm/uaccess.h>
#include "gfs2.h"
+#include "lm_interface.h"
+#include "incore.h"
#include "glock.h"
#include "glops.h"
#include "inode.h"
@@ -28,6 +31,7 @@
#include "meta_io.h"
#include "quota.h"
#include "super.h"
+#include "util.h"
/* Must be kept in sync with the beginning of struct gfs2_glock */
struct glock_plug {
@@ -1962,7 +1966,7 @@ void gfs2_try_toss_inode(struct gfs2_sbd *sdp, struct gfs2_inum *inum)
if (!gfs2_glmutex_trylock(gl))
goto out;
- ip = get_gl2ip(gl);
+ ip = gl->gl_object;
if (!ip)
goto out_unlock;
@@ -1994,7 +1998,7 @@ void gfs2_iopen_go_callback(struct gfs2_glock *io_gl, unsigned int state)
return;
spin_lock(&io_gl->gl_spin);
- i_gl = get_gl2gl(io_gl);
+ i_gl = io_gl->gl_object;
if (i_gl) {
gfs2_glock_hold(i_gl);
spin_unlock(&io_gl->gl_spin);
@@ -2004,7 +2008,7 @@ void gfs2_iopen_go_callback(struct gfs2_glock *io_gl, unsigned int state)
}
if (gfs2_glmutex_trylock(i_gl)) {
- struct gfs2_inode *ip = get_gl2ip(i_gl);
+ struct gfs2_inode *ip = i_gl->gl_object;
if (ip) {
gfs2_try_toss_vnode(ip);
gfs2_glmutex_unlock(i_gl);
@@ -2093,7 +2097,7 @@ void gfs2_reclaim_glock(struct gfs2_sbd *sdp)
if (gfs2_glmutex_trylock(gl)) {
if (gl->gl_ops == &gfs2_inode_glops) {
- struct gfs2_inode *ip = get_gl2ip(gl);
+ struct gfs2_inode *ip = gl->gl_object;
if (ip && !atomic_read(&ip->i_count))
gfs2_inode_destroy(ip);
}
@@ -2174,7 +2178,7 @@ static void scan_glock(struct gfs2_glock *gl)
{
if (gfs2_glmutex_trylock(gl)) {
if (gl->gl_ops == &gfs2_inode_glops) {
- struct gfs2_inode *ip = get_gl2ip(gl);
+ struct gfs2_inode *ip = gl->gl_object;
if (ip && !atomic_read(&ip->i_count))
goto out_schedule;
}
@@ -2234,7 +2238,7 @@ static void clear_glock(struct gfs2_glock *gl)
if (gfs2_glmutex_trylock(gl)) {
if (gl->gl_ops == &gfs2_inode_glops) {
- struct gfs2_inode *ip = get_gl2ip(gl);
+ struct gfs2_inode *ip = gl->gl_object;
if (ip && !atomic_read(&ip->i_count))
gfs2_inode_destroy(ip);
}
@@ -2430,10 +2434,10 @@ static int dump_glock(struct gfs2_glock *gl)
if (error)
goto out;
}
- if (gl->gl_ops == &gfs2_inode_glops && get_gl2ip(gl)) {
+ if (gl->gl_ops == &gfs2_inode_glops && gl->gl_object) {
if (!test_bit(GLF_LOCK, &gl->gl_flags) &&
list_empty(&gl->gl_holders)) {
- error = dump_inode(get_gl2ip(gl));
+ error = dump_inode(gl->gl_object);
if (error)
goto out;
} 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 @@
#include <linux/spinlock.h>
#include <linux/completion.h>
#include <linux/buffer_head.h>
+#include <linux/gfs2_ondisk.h>
#include <asm/semaphore.h>
#include "gfs2.h"
+#include "lm_interface.h"
+#include "incore.h"
#include "bmap.h"
#include "glock.h"
#include "glops.h"
@@ -24,6 +27,7 @@
#include "page.h"
#include "recovery.h"
#include "rgrp.h"
+#include "util.h"
/**
* meta_go_sync - sync out the metadata for this glock
@@ -193,7 +197,7 @@ static int inode_go_demote_ok(struct gfs2_glock *gl)
struct gfs2_sbd *sdp = gl->gl_sbd;
int demote = 0;
- if (!get_gl2ip(gl) && !gl->gl_aspace->i_mapping->nrpages)
+ if (!gl->gl_object && !gl->gl_aspace->i_mapping->nrpages)
demote = 1;
else if (!sdp->sd_args.ar_localcaching &&
time_after_eq(jiffies, gl->gl_stamp +
@@ -214,7 +218,7 @@ static int inode_go_demote_ok(struct gfs2_glock *gl)
static int inode_go_lock(struct gfs2_holder *gh)
{
struct gfs2_glock *gl = gh->gh_gl;
- struct gfs2_inode *ip = get_gl2ip(gl);
+ struct gfs2_inode *ip = gl->gl_object;
int error = 0;
if (!ip)
@@ -246,7 +250,7 @@ static int inode_go_lock(struct gfs2_holder *gh)
static void inode_go_unlock(struct gfs2_holder *gh)
{
struct gfs2_glock *gl = gh->gh_gl;
- struct gfs2_inode *ip = get_gl2ip(gl);
+ struct gfs2_inode *ip = gl->gl_object;
if (ip && test_bit(GLF_DIRTY, &gl->gl_flags))
gfs2_inode_attr_in(ip);
@@ -264,7 +268,7 @@ static void inode_go_unlock(struct gfs2_holder *gh)
static void inode_greedy(struct gfs2_glock *gl)
{
struct gfs2_sbd *sdp = gl->gl_sbd;
- struct gfs2_inode *ip = get_gl2ip(gl);
+ struct gfs2_inode *ip = gl->gl_object;
unsigned int quantum = gfs2_tune_get(sdp, gt_greedy_quantum);
unsigned int max = gfs2_tune_get(sdp, gt_greedy_max);
unsigned int new_time;
@@ -311,7 +315,7 @@ static int rgrp_go_demote_ok(struct gfs2_glock *gl)
static int rgrp_go_lock(struct gfs2_holder *gh)
{
- return gfs2_rgrp_bh_get(get_gl2rgd(gh->gh_gl));
+ return gfs2_rgrp_bh_get(gh->gh_gl->gl_object);
}
/**
@@ -324,7 +328,7 @@ static int rgrp_go_lock(struct gfs2_holder *gh)
static void rgrp_go_unlock(struct gfs2_holder *gh)
{
- gfs2_rgrp_bh_put(get_gl2rgd(gh->gh_gl));
+ gfs2_rgrp_bh_put(gh->gh_gl->gl_object);
}
/**
@@ -358,13 +362,14 @@ static void trans_go_xmote_th(struct gfs2_glock *gl, unsigned int state,
static void trans_go_xmote_bh(struct gfs2_glock *gl)
{
struct gfs2_sbd *sdp = gl->gl_sbd;
- struct gfs2_glock *j_gl = get_v2ip(sdp->sd_jdesc->jd_inode)->i_gl;
+ struct gfs2_inode *ip = sdp->sd_jdesc->jd_inode->u.generic_ip;
+ struct gfs2_glock *j_gl = ip->i_gl;
struct gfs2_log_header head;
int error;
if (gl->gl_state != LM_ST_UNLOCKED &&
test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) {
- gfs2_meta_cache_flush(get_v2ip(sdp->sd_jdesc->jd_inode));
+ gfs2_meta_cache_flush(sdp->sd_jdesc->jd_inode->u.generic_ip);
j_gl->gl_ops->go_inval(j_gl, DIO_METADATA | DIO_DATA);
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 {
QDF_LOCKED = 2,
};
+struct gfs2_quota_lvb {
+ uint32_t qb_magic;
+ uint32_t __pad;
+ uint64_t qb_limit; /* Hard limit of # blocks to alloc */
+ uint64_t qb_warn; /* Warn user when alloc is above this # */
+ int64_t qb_value; /* Current # blocks allocated */
+};
+
struct gfs2_quota_data {
struct list_head qd_list;
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 @@
#include <linux/buffer_head.h>
#include <linux/posix_acl.h>
#include <linux/sort.h>
+#include <linux/gfs2_ondisk.h>
#include <asm/semaphore.h>
#include "gfs2.h"
+#include "lm_interface.h"
+#include "incore.h"
#include "acl.h"
#include "bmap.h"
#include "dir.h"
@@ -33,6 +36,7 @@
#include "rgrp.h"
#include "trans.h"
#include "unlinked.h"
+#include "util.h"
/**
* inode_attr_in - Copy attributes from the dinode into the VFS inode
@@ -176,7 +180,7 @@ struct inode *gfs2_ip2v(struct gfs2_inode *ip)
init_special_inode(tmp, tmp->i_mode, tmp->i_rdev);
}
- set_v2ip(tmp, NULL);
+ tmp->u.generic_ip = NULL;
for (;;) {
spin_lock(&ip->i_spin);
@@ -196,7 +200,7 @@ struct inode *gfs2_ip2v(struct gfs2_inode *ip)
gfs2_inode_hold(ip);
ip->i_vnode = inode;
- set_v2ip(inode, ip);
+ inode->u.generic_ip = ip;
spin_unlock(&ip->i_spin);
@@ -207,7 +211,7 @@ struct inode *gfs2_ip2v(struct gfs2_inode *ip)
static int iget_test(struct inode *inode, void *opaque)
{
- struct gfs2_inode *ip = get_v2ip(inode);
+ struct gfs2_inode *ip = inode->u.generic_ip;
struct gfs2_inum *inum = (struct gfs2_inum *)opaque;
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,
spin_lock(&io_gl->gl_spin);
gfs2_glock_hold(i_gl);
- set_gl2gl(io_gl, i_gl);
+ io_gl->gl_object = i_gl;
spin_unlock(&io_gl->gl_spin);
gfs2_glock_hold(i_gl);
- set_gl2ip(i_gl, ip);
+ i_gl->gl_object = ip;
atomic_inc(&sdp->sd_inode_count);
@@ -359,7 +363,7 @@ int gfs2_inode_get(struct gfs2_glock *i_gl, struct gfs2_inum *inum, int create,
gfs2_glmutex_lock(i_gl);
- *ipp = get_gl2ip(i_gl);
+ *ipp = i_gl->gl_object;
if (*ipp) {
error = -ESTALE;
if ((*ipp)->i_num.no_formal_ino != inum->no_formal_ino)
@@ -404,10 +408,10 @@ void gfs2_inode_destroy(struct gfs2_inode *ip)
struct gfs2_glock *i_gl = ip->i_gl;
gfs2_assert_warn(sdp, !atomic_read(&ip->i_count));
- gfs2_assert(sdp, get_gl2gl(io_gl) == i_gl);
+ gfs2_assert(sdp, io_gl->gl_object == i_gl);
spin_lock(&io_gl->gl_spin);
- set_gl2gl(io_gl, NULL);
+ io_gl->gl_object = NULL;
gfs2_glock_put(i_gl);
spin_unlock(&io_gl->gl_spin);
@@ -416,7 +420,7 @@ void gfs2_inode_destroy(struct gfs2_inode *ip)
gfs2_meta_cache_flush(ip);
kmem_cache_free(gfs2_inode_cachep, ip);
- set_gl2ip(i_gl, NULL);
+ i_gl->gl_object = NULL;
gfs2_glock_put(i_gl);
atomic_dec(&sdp->sd_inode_count);
@@ -524,7 +528,7 @@ static int inode_dealloc(struct gfs2_sbd *sdp, struct gfs2_unlinked *ul,
goto out;
}
- gfs2_assert_warn(sdp, !get_gl2ip(i_gh.gh_gl));
+ gfs2_assert_warn(sdp, !i_gh.gh_gl->gl_object);
error = inode_create(i_gh.gh_gl, &ul->ul_ut.ut_inum, io_gh->gh_gl,
LM_ST_EXCLUSIVE, &ip);
@@ -715,7 +719,7 @@ int gfs2_lookupi(struct inode *dir, struct qstr *name, int is_root,
struct inode **inodep)
{
struct gfs2_inode *ipp;
- struct gfs2_inode *dip = get_v2ip(dir);
+ struct gfs2_inode *dip = dir->u.generic_ip;
struct gfs2_sbd *sdp = dip->i_sbd;
struct gfs2_holder d_gh;
struct gfs2_inum inum;
@@ -774,7 +778,7 @@ done:
static int pick_formal_ino_1(struct gfs2_sbd *sdp, uint64_t *formal_ino)
{
- struct gfs2_inode *ip = get_v2ip(sdp->sd_ir_inode);
+ struct gfs2_inode *ip = sdp->sd_ir_inode->u.generic_ip;
struct buffer_head *bh;
struct gfs2_inum_range ir;
int error;
@@ -815,8 +819,8 @@ static int pick_formal_ino_1(struct gfs2_sbd *sdp, uint64_t *formal_ino)
static int pick_formal_ino_2(struct gfs2_sbd *sdp, uint64_t *formal_ino)
{
- struct gfs2_inode *ip = get_v2ip(sdp->sd_ir_inode);
- struct gfs2_inode *m_ip = get_v2ip(sdp->sd_inum_inode);
+ struct gfs2_inode *ip = sdp->sd_ir_inode->u.generic_ip;
+ struct gfs2_inode *m_ip = sdp->sd_inum_inode->u.generic_ip;
struct gfs2_holder gh;
struct buffer_head *bh;
struct gfs2_inum_range ir;
@@ -1194,7 +1198,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, struct qstr *name,
unsigned int mode)
{
struct inode *inode;
- struct gfs2_inode *dip = get_gl2ip(ghs->gh_gl);
+ struct gfs2_inode *dip = ghs->gh_gl->gl_object;
struct gfs2_sbd *sdp = dip->i_sbd;
struct gfs2_unlinked *ul;
struct gfs2_inode *ip;
@@ -1570,7 +1574,7 @@ int gfs2_glock_nq_atime(struct gfs2_holder *gh)
{
struct gfs2_glock *gl = gh->gh_gl;
struct gfs2_sbd *sdp = gl->gl_sbd;
- struct gfs2_inode *ip = get_gl2ip(gl);
+ struct gfs2_inode *ip = gl->gl_object;
int64_t curtime, quantum = gfs2_tune_get(sdp, gt_atime_quantum);
unsigned int state;
int flags;
@@ -1817,7 +1821,7 @@ int gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr)
{
int error;
- if (get_transaction)
+ if (current->journal_info)
return __gfs2_setattr_simple(ip, attr);
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 @@
#include <linux/completion.h>
#include <linux/buffer_head.h>
#include <linux/delay.h>
+#include <linux/gfs2_ondisk.h>
#include <asm/semaphore.h>
#include "gfs2.h"
+#include "lm_interface.h"
+#include "incore.h"
#include "glock.h"
#include "lm.h"
#include "super.h"
+#include "util.h"
+#include "lvb.h"
/**
* 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 @@
#include <linux/spinlock.h>
#include <linux/completion.h>
#include <linux/buffer_head.h>
+#include <linux/gfs2_ondisk.h>
#include <asm/semaphore.h>
#include "gfs2.h"
+#include "lm_interface.h"
+#include "incore.h"
#include "bmap.h"
#include "glock.h"
#include "log.h"
#include "lops.h"
#include "meta_io.h"
+#include "util.h"
#define PULL 1
@@ -80,7 +84,7 @@ unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct,
if (nstruct > first) {
second = (sdp->sd_sb.sb_bsize -
sizeof(struct gfs2_meta_header)) / ssize;
- blks += DIV_RU(nstruct - first, second);
+ blks += DIV_ROUND_UP(nstruct - first, second);
}
return blks;
@@ -257,7 +261,7 @@ static uint64_t log_bmap(struct gfs2_sbd *sdp, unsigned int lbn)
uint64_t dbn;
int error;
- error = gfs2_block_map(get_v2ip(sdp->sd_jdesc->jd_inode),
+ error = gfs2_block_map(sdp->sd_jdesc->jd_inode->u.generic_ip,
lbn, &new, &dbn, NULL);
gfs2_assert_withdraw(sdp, !error && dbn);
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 @@
#include <linux/spinlock.h>
#include <linux/completion.h>
#include <linux/buffer_head.h>
+#include <linux/gfs2_ondisk.h>
#include <asm/semaphore.h>
#include "gfs2.h"
+#include "lm_interface.h"
+#include "incore.h"
#include "glock.h"
#include "log.h"
#include "lops.h"
@@ -22,12 +25,14 @@
#include "recovery.h"
#include "rgrp.h"
#include "trans.h"
+#include "util.h"
static void glock_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
{
struct gfs2_glock *gl;<