aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/gfs2/Makefile2
-rw-r--r--fs/gfs2/acl.c10
-rw-r--r--fs/gfs2/bmap.c44
-rw-r--r--fs/gfs2/daemon.c27
-rw-r--r--fs/gfs2/daemon.h1
-rw-r--r--fs/gfs2/dir.c66
-rw-r--r--fs/gfs2/eaops.c14
-rw-r--r--fs/gfs2/eattr.c70
-rw-r--r--fs/gfs2/glock.c102
-rw-r--r--fs/gfs2/glock.h5
-rw-r--r--fs/gfs2/glops.c9
-rw-r--r--fs/gfs2/incore.h48
-rw-r--r--fs/gfs2/inode.c809
-rw-r--r--fs/gfs2/inode.h32
-rw-r--r--fs/gfs2/log.c3
-rw-r--r--fs/gfs2/lops.c30
-rw-r--r--fs/gfs2/main.c2
-rw-r--r--fs/gfs2/meta_io.c12
-rw-r--r--fs/gfs2/ondisk.c17
-rw-r--r--fs/gfs2/ops_address.c31
-rw-r--r--fs/gfs2/ops_dentry.c6
-rw-r--r--fs/gfs2/ops_export.c60
-rw-r--r--fs/gfs2/ops_file.c42
-rw-r--r--fs/gfs2/ops_fstype.c103
-rw-r--r--fs/gfs2/ops_inode.c168
-rw-r--r--fs/gfs2/ops_super.c112
-rw-r--r--fs/gfs2/ops_vm.c12
-rw-r--r--fs/gfs2/page.c64
-rw-r--r--fs/gfs2/quota.c28
-rw-r--r--fs/gfs2/recovery.c23
-rw-r--r--fs/gfs2/rgrp.c118
-rw-r--r--fs/gfs2/rgrp.h1
-rw-r--r--fs/gfs2/super.c45
-rw-r--r--fs/gfs2/sys.c2
-rw-r--r--fs/gfs2/trans.h1
-rw-r--r--fs/gfs2/unlinked.c459
-rw-r--r--fs/gfs2/unlinked.h25
-rw-r--r--fs/gfs2/util.c2
38 files changed, 738 insertions, 1867 deletions
diff --git a/fs/gfs2/Makefile b/fs/gfs2/Makefile
index 9974201aa16..0b7977623b8 100644
--- a/fs/gfs2/Makefile
+++ b/fs/gfs2/Makefile
@@ -3,7 +3,7 @@ gfs2-y := acl.o bmap.o daemon.o dir.o eaops.o eattr.o glock.o \
glops.o inode.o lm.o log.o lops.o locking.o lvb.o main.o meta_io.o \
mount.o ondisk.o ops_address.o ops_dentry.o ops_export.o ops_file.o \
ops_fstype.o ops_inode.o ops_super.o ops_vm.o page.o quota.o \
- recovery.o rgrp.o super.o sys.o trans.o unlinked.o util.o
+ recovery.o rgrp.o super.o sys.o trans.o util.o
obj-$(CONFIG_GFS2_FS_LOCKING_NOLOCK) += locking/nolock/
obj-$(CONFIG_GFS2_FS_LOCKING_DLM) += locking/dlm/
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
index 343dbe3e87b..9ef4cf2c03d 100644
--- a/fs/gfs2/acl.c
+++ b/fs/gfs2/acl.c
@@ -73,7 +73,7 @@ int gfs2_acl_validate_set(struct gfs2_inode *ip, int access,
int gfs2_acl_validate_remove(struct gfs2_inode *ip, int access)
{
- if (!ip->i_sbd->sd_args.ar_posix_acl)
+ if (!GFS2_SB(&ip->i_inode)->sd_args.ar_posix_acl)
return -EOPNOTSUPP;
if (current->fsuid != ip->i_di.di_uid && !capable(CAP_FOWNER))
return -EPERM;
@@ -160,7 +160,7 @@ int gfs2_check_acl_locked(struct inode *inode, int mask)
struct posix_acl *acl = NULL;
int error;
- error = acl_get(inode->u.generic_ip, ACL_ACCESS, &acl, NULL, NULL, NULL);
+ error = acl_get(GFS2_I(inode), ACL_ACCESS, &acl, NULL, NULL, NULL);
if (error)
return error;
@@ -175,7 +175,7 @@ int gfs2_check_acl_locked(struct inode *inode, int mask)
int gfs2_check_acl(struct inode *inode, int mask)
{
- struct gfs2_inode *ip = inode->u.generic_ip;
+ struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_holder i_gh;
int error;
@@ -192,7 +192,7 @@ int gfs2_check_acl(struct inode *inode, int mask)
static int munge_mode(struct gfs2_inode *ip, mode_t mode)
{
- struct gfs2_sbd *sdp = ip->i_sbd;
+ struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct buffer_head *dibh;
int error;
@@ -217,7 +217,7 @@ static int munge_mode(struct gfs2_inode *ip, mode_t mode)
int gfs2_acl_create(struct gfs2_inode *dip, struct gfs2_inode *ip)
{
- struct gfs2_sbd *sdp = dip->i_sbd;
+ struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
struct posix_acl *acl = NULL, *clone;
struct gfs2_ea_request er;
mode_t mode = ip->i_di.di_mode;
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 41abd3f4fc7..98fa07c2b71 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -136,7 +136,7 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, gfs2_unstuffer_t unstuffer,
static unsigned int calc_tree_height(struct gfs2_inode *ip, uint64_t size)
{
- struct gfs2_sbd *sdp = ip->i_sbd;
+ struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
uint64_t *arr;
unsigned int max, height;
@@ -169,7 +169,7 @@ static unsigned int calc_tree_height(struct gfs2_inode *ip, uint64_t size)
static int build_height(struct inode *inode, unsigned height)
{
- struct gfs2_inode *ip = inode->u.generic_ip;
+ struct gfs2_inode *ip = GFS2_I(inode);
unsigned new_height = height - ip->i_di.di_height;
struct buffer_head *dibh;
struct buffer_head *blocks[GFS2_MAX_META_HEIGHT];
@@ -283,7 +283,7 @@ static int build_height(struct inode *inode, unsigned height)
static void find_metapath(struct gfs2_inode *ip, uint64_t block,
struct metapath *mp)
{
- struct gfs2_sbd *sdp = ip->i_sbd;
+ struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
uint64_t b = block;
unsigned int i;
@@ -382,8 +382,8 @@ static struct buffer_head *gfs2_block_pointers(struct inode *inode, u64 lblock,
int *boundary,
struct metapath *mp)
{
- struct gfs2_inode *ip = inode->u.generic_ip;
- struct gfs2_sbd *sdp = ip->i_sbd;
+ struct gfs2_inode *ip = GFS2_I(inode);
+ struct gfs2_sbd *sdp = GFS2_SB(inode);
struct buffer_head *bh;
int create = *new;
unsigned int bsize;
@@ -446,7 +446,7 @@ out:
static inline void bmap_lock(struct inode *inode, int create)
{
- struct gfs2_inode *ip = inode->u.generic_ip;
+ struct gfs2_inode *ip = GFS2_I(inode);
if (create)
down_write(&ip->i_rw_mutex);
else
@@ -455,7 +455,7 @@ static inline void bmap_lock(struct inode *inode, int create)
static inline void bmap_unlock(struct inode *inode, int create)
{
- struct gfs2_inode *ip = inode->u.generic_ip;
+ struct gfs2_inode *ip = GFS2_I(inode);
if (create)
up_write(&ip->i_rw_mutex);
else
@@ -481,8 +481,8 @@ int gfs2_block_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, int *
int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsigned *extlen)
{
- struct gfs2_inode *ip = inode->u.generic_ip;
- struct gfs2_sbd *sdp = ip->i_sbd;
+ struct gfs2_inode *ip = GFS2_I(inode);
+ struct gfs2_sbd *sdp = GFS2_SB(inode);
struct metapath mp;
struct buffer_head *bh;
int boundary;
@@ -541,7 +541,7 @@ static int recursive_scan(struct gfs2_inode *ip, struct buffer_head *dibh,
uint64_t block, int first, block_call_t bc,
void *data)
{
- struct gfs2_sbd *sdp = ip->i_sbd;
+ struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct buffer_head *bh = NULL;
uint64_t *top, *bottom;
uint64_t bn;
@@ -609,8 +609,8 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh,
struct buffer_head *bh, uint64_t *top, uint64_t *bottom,
unsigned int height, void *data)
{
- struct strip_mine *sm = (struct strip_mine *)data;
- struct gfs2_sbd *sdp = ip->i_sbd;
+ struct strip_mine *sm = data;
+ struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct gfs2_rgrp_list rlist;
uint64_t bn, bstart;
uint32_t blen;
@@ -756,7 +756,7 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh,
static int do_grow(struct gfs2_inode *ip, uint64_t size)
{
- struct gfs2_sbd *sdp = ip->i_sbd;
+ struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct gfs2_alloc *al;
struct buffer_head *dibh;
unsigned int h;
@@ -795,7 +795,7 @@ static int do_grow(struct gfs2_inode *ip, uint64_t size)
h = calc_tree_height(ip, size);
if (ip->i_di.di_height < h) {
down_write(&ip->i_rw_mutex);
- error = build_height(ip->i_vnode, h);
+ error = build_height(&ip->i_inode, h);
up_write(&ip->i_rw_mutex);
if (error)
goto out_end_trans;
@@ -830,7 +830,7 @@ static int do_grow(struct gfs2_inode *ip, uint64_t size)
static int trunc_start(struct gfs2_inode *ip, uint64_t size)
{
- struct gfs2_sbd *sdp = ip->i_sbd;
+ struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct buffer_head *dibh;
int journaled = gfs2_is_jdata(ip);
int error;
@@ -854,7 +854,7 @@ static int trunc_start(struct gfs2_inode *ip, uint64_t size)
} else {
if (size & (uint64_t)(sdp->sd_sb.sb_bsize - 1))
- error = gfs2_block_truncate_page(ip->i_vnode->i_mapping);
+ error = gfs2_block_truncate_page(ip->i_inode.i_mapping);
if (!error) {
ip->i_di.di_size = size;
@@ -883,7 +883,7 @@ static int trunc_dealloc(struct gfs2_inode *ip, uint64_t size)
if (!size)
lblock = 0;
else
- lblock = (size - 1) >> ip->i_sbd->sd_sb.sb_bsize_shift;
+ lblock = (size - 1) >> GFS2_SB(&ip->i_inode)->sd_sb.sb_bsize_shift;
find_metapath(ip, lblock, &mp);
gfs2_alloc_get(ip);
@@ -911,7 +911,7 @@ static int trunc_dealloc(struct gfs2_inode *ip, uint64_t size)
static int trunc_end(struct gfs2_inode *ip)
{
- struct gfs2_sbd *sdp = ip->i_sbd;
+ struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct buffer_head *dibh;
int error;
@@ -990,7 +990,7 @@ int gfs2_truncatei(struct gfs2_inode *ip, uint64_t size)
{
int error;
- if (gfs2_assert_warn(ip->i_sbd, S_ISREG(ip->i_di.di_mode)))
+ if (gfs2_assert_warn(GFS2_SB(&ip->i_inode), S_ISREG(ip->i_di.di_mode)))
return -EINVAL;
if (size > ip->i_di.di_size)
@@ -1027,7 +1027,7 @@ int gfs2_file_dealloc(struct gfs2_inode *ip)
void gfs2_write_calc_reserv(struct gfs2_inode *ip, unsigned int len,
unsigned int *data_blocks, unsigned int *ind_blocks)
{
- struct gfs2_sbd *sdp = ip->i_sbd;
+ struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
unsigned int tmp;
if (gfs2_is_dir(ip)) {
@@ -1057,7 +1057,7 @@ void gfs2_write_calc_reserv(struct gfs2_inode *ip, unsigned int len,
int gfs2_write_alloc_required(struct gfs2_inode *ip, uint64_t offset,
unsigned int len, int *alloc_required)
{
- struct gfs2_sbd *sdp = ip->i_sbd;
+ struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
uint64_t lblock, lblock_stop, dblock;
uint32_t extlen;
int new = 0;
@@ -1088,7 +1088,7 @@ int gfs2_write_alloc_required(struct gfs2_inode *ip, uint64_t offset,
}
for (; lblock < lblock_stop; lblock += extlen) {
- error = gfs2_extent_map(ip->i_vnode, lblock, &new, &dblock, &extlen);
+ error = gfs2_extent_map(&ip->i_inode, lblock, &new, &dblock, &extlen);
if (error)
return error;
diff --git a/fs/gfs2/daemon.c b/fs/gfs2/daemon.c
index 9e7b9f29678..1453605c8f3 100644
--- a/fs/gfs2/daemon.c
+++ b/fs/gfs2/daemon.c
@@ -25,7 +25,6 @@
#include "quota.h"
#include "recovery.h"
#include "super.h"
-#include "unlinked.h"
#include "util.h"
/* This uses schedule_timeout() instead of msleep() because it's good for
@@ -195,29 +194,3 @@ int gfs2_quotad(void *data)
return 0;
}
-/**
- * gfs2_inoded - Deallocate unlinked inodes
- * @sdp: Pointer to GFS2 superblock
- *
- */
-
-int gfs2_inoded(void *data)
-{
- struct gfs2_sbd *sdp = data;
- unsigned long t;
- int error;
-
- while (!kthread_should_stop()) {
- error = gfs2_unlinked_dealloc(sdp);
- if (error &&
- error != -EROFS &&
- !test_bit(SDF_SHUTDOWN, &sdp->sd_flags))
- fs_err(sdp, "inoded: error = %d\n", error);
-
- t = gfs2_tune_get(sdp, gt_inoded_secs) * HZ;
- schedule_timeout_interruptible(t);
- }
-
- return 0;
-}
-
diff --git a/fs/gfs2/daemon.h b/fs/gfs2/daemon.h
index aa68e7a1b0b..aa93eb6f668 100644
--- a/fs/gfs2/daemon.h
+++ b/fs/gfs2/daemon.h
@@ -15,6 +15,5 @@ int gfs2_glockd(void *data);
int gfs2_recoverd(void *data);
int gfs2_logd(void *data);
int gfs2_quotad(void *data);
-int gfs2_inoded(void *data);
#endif /* __DAEMON_DOT_H__ */
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 6918a58261e..b0353884dd7 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -113,7 +113,7 @@ static int gfs2_dir_get_existing_buffer(struct gfs2_inode *ip, uint64_t block,
error = gfs2_meta_read(ip->i_gl, block, DIO_START | DIO_WAIT, &bh);
if (error)
return error;
- if (gfs2_metatype_check(ip->i_sbd, bh, GFS2_METATYPE_JD)) {
+ if (gfs2_metatype_check(GFS2_SB(&ip->i_inode), bh, GFS2_METATYPE_JD)) {
brelse(bh);
return -EIO;
}
@@ -158,7 +158,7 @@ static int gfs2_dir_write_stuffed(struct gfs2_inode *ip, const char *buf,
static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,
uint64_t offset, unsigned int size)
{
- struct gfs2_sbd *sdp = ip->i_sbd;
+ struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct buffer_head *dibh;
uint64_t lblock, dblock;
uint32_t extlen = 0;
@@ -197,7 +197,7 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,
if (!extlen) {
new = 1;
- error = gfs2_extent_map(ip->i_vnode, lblock, &new,
+ error = gfs2_extent_map(&ip->i_inode, lblock, &new,
&dblock, &extlen);
if (error)
goto fail;
@@ -277,7 +277,7 @@ static int gfs2_dir_read_stuffed(struct gfs2_inode *ip, char *buf,
static int gfs2_dir_read_data(struct gfs2_inode *ip, char *buf,
uint64_t offset, unsigned int size)
{
- struct gfs2_sbd *sdp = ip->i_sbd;
+ struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
uint64_t lblock, dblock;
uint32_t extlen = 0;
unsigned int o;
@@ -314,7 +314,7 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, char *buf,
if (!extlen) {
new = 0;
- error = gfs2_extent_map(ip->i_vnode, lblock, &new,
+ error = gfs2_extent_map(&ip->i_inode, lblock, &new,
&dblock, &extlen);
if (error)
goto fail;
@@ -534,7 +534,7 @@ static struct gfs2_dirent *gfs2_dirent_scan(struct inode *inode,
}
consist_inode:
- gfs2_consist_inode(inode->u.generic_ip);
+ gfs2_consist_inode(GFS2_I(inode));
return ERR_PTR(-EIO);
}
@@ -556,13 +556,13 @@ static int dirent_first(struct gfs2_inode *dip, struct buffer_head *bh,
struct gfs2_meta_header *h = (struct gfs2_meta_header *)bh->b_data;
if (be32_to_cpu(h->mh_type) == GFS2_METATYPE_LF) {
- if (gfs2_meta_check(dip->i_sbd, bh))
+ if (gfs2_meta_check(GFS2_SB(&dip->i_inode), bh))
return -EIO;
*dent = (struct gfs2_dirent *)(bh->b_data +
sizeof(struct gfs2_leaf));
return IS_LEAF;
} else {
- if (gfs2_metatype_check(dip->i_sbd, bh, GFS2_METATYPE_DI))
+ if (gfs2_metatype_check(GFS2_SB(&dip->i_inode), bh, GFS2_METATYPE_DI))
return -EIO;
*dent = (struct gfs2_dirent *)(bh->b_data +
sizeof(struct gfs2_dinode));
@@ -674,7 +674,7 @@ static struct gfs2_dirent *gfs2_init_dirent(struct inode *inode,
const struct qstr *name,
struct buffer_head *bh)
{
- struct gfs2_inode *ip = inode->u.generic_ip;
+ struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_dirent *ndent;
unsigned offset = 0, totlen;
@@ -707,8 +707,10 @@ static int get_leaf(struct gfs2_inode *dip, uint64_t leaf_no,
int error;
error = gfs2_meta_read(dip->i_gl, leaf_no, DIO_START | DIO_WAIT, bhp);
- if (!error && gfs2_metatype_check(dip->i_sbd, *bhp, GFS2_METATYPE_LF))
+ if (!error && gfs2_metatype_check(GFS2_SB(&dip->i_inode), *bhp, GFS2_METATYPE_LF)) {
+ /* printk(KERN_INFO "block num=%llu\n", leaf_no); */
error = -EIO;
+ }
return error;
}
@@ -759,7 +761,7 @@ static struct gfs2_dirent *gfs2_dirent_search(struct inode *inode,
{
struct buffer_head *bh;
struct gfs2_dirent *dent;
- struct gfs2_inode *ip = inode->u.generic_ip;
+ struct gfs2_inode *ip = GFS2_I(inode);
int error;
if (ip->i_di.di_flags & GFS2_DIF_EXHASH) {
@@ -771,7 +773,7 @@ static struct gfs2_dirent *gfs2_dirent_search(struct inode *inode,
gfs2_consist_inode(ip);
return ERR_PTR(-EIO);
}
-
+
index = name->hash >> (32 - ip->i_di.di_depth);
error = get_first_leaf(ip, index, &bh);
if (error)
@@ -786,12 +788,14 @@ static struct gfs2_dirent *gfs2_dirent_search(struct inode *inode,
brelse(bh);
if (!ln)
break;
+
error = get_leaf(ip, ln, &bh);
} while(!error);
return error ? ERR_PTR(error) : NULL;
}
+
error = gfs2_meta_inode_buffer(ip, &bh);
if (error)
return ERR_PTR(error);
@@ -807,7 +811,7 @@ got_dent:
static struct gfs2_leaf *new_leaf(struct inode *inode, struct buffer_head **pbh, u16 depth)
{
- struct gfs2_inode *ip = inode->u.generic_ip;
+ struct gfs2_inode *ip = GFS2_I(inode);
u64 bn = gfs2_alloc_meta(ip);
struct buffer_head *bh = gfs2_meta_new(ip->i_gl, bn);
struct gfs2_leaf *leaf;
@@ -815,6 +819,7 @@ static struct gfs2_leaf *new_leaf(struct inode *inode, struct buffer_head **pbh,
struct qstr name = { .name = "", .len = 0, .hash = 0 };
if (!bh)
return NULL;
+
gfs2_trans_add_bh(ip->i_gl, bh, 1);
gfs2_metatype_set(bh, GFS2_METATYPE_LF, GFS2_FORMAT_LF);
leaf = (struct gfs2_leaf *)bh->b_data;
@@ -838,8 +843,8 @@ static struct gfs2_leaf *new_leaf(struct inode *inode, struct buffer_head **pbh,
static int dir_make_exhash(struct inode *inode)
{
- struct gfs2_inode *dip = inode->u.generic_ip;
- struct gfs2_sbd *sdp = dip->i_sbd;
+ struct gfs2_inode *dip = GFS2_I(inode);
+ struct gfs2_sbd *sdp = GFS2_SB(inode);
struct gfs2_dirent *dent;
struct qstr args;
struct buffer_head *bh, *dibh;
@@ -874,7 +879,7 @@ static int dir_make_exhash(struct inode *inode)
args.len = bh->b_size - sizeof(struct gfs2_dinode) +
sizeof(struct gfs2_leaf);
args.name = bh->b_data;
- dent = gfs2_dirent_scan(dip->i_vnode, bh->b_data, bh->b_size,
+ dent = gfs2_dirent_scan(&dip->i_inode, bh->b_data, bh->b_size,
gfs2_dirent_last, &args, NULL);
if (!dent) {
brelse(bh);
@@ -933,7 +938,7 @@ static int dir_make_exhash(struct inode *inode)
static int dir_split_leaf(struct inode *inode, const struct qstr *name)
{
- struct gfs2_inode *dip = inode->u.generic_ip;
+ struct gfs2_inode *dip = GFS2_I(inode);
struct buffer_head *nbh, *obh, *dibh;
struct gfs2_leaf *nleaf, *oleaf;
struct gfs2_dirent *dent, *prev = NULL, *next = NULL, *new;
@@ -1044,7 +1049,7 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name)
oleaf->lf_depth = nleaf->lf_depth;
error = gfs2_meta_inode_buffer(dip, &dibh);
- if (!gfs2_assert_withdraw(dip->i_sbd, !error)) {
+ if (!gfs2_assert_withdraw(GFS2_SB(&dip->i_inode), !error)) {
dip->i_di.di_blocks++;
gfs2_dinode_out(&dip->i_di, dibh->b_data);
brelse(dibh);
@@ -1073,7 +1078,7 @@ fail_brelse:
static int dir_double_exhash(struct gfs2_inode *dip)
{
- struct gfs2_sbd *sdp = dip->i_sbd;
+ struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
struct buffer_head *dibh;
uint32_t hsize;
uint64_t *buf;
@@ -1268,7 +1273,7 @@ static int gfs2_dir_read_leaf(struct inode *inode, u64 *offset, void *opaque,
gfs2_filldir_t filldir, int *copied,
unsigned *depth, u64 leaf_no)
{
- struct gfs2_inode *ip = inode->u.generic_ip;
+ struct gfs2_inode *ip = GFS2_I(inode);
struct buffer_head *bh;
struct gfs2_leaf *lf;
unsigned entries = 0;
@@ -1348,8 +1353,8 @@ out:
static int dir_e_read(struct inode *inode, uint64_t *offset, void *opaque,
gfs2_filldir_t filldir)
{
- struct gfs2_inode *dip = inode->u.generic_ip;
- struct gfs2_sbd *sdp = dip->i_sbd;
+ struct gfs2_inode *dip = GFS2_I(inode);
+ struct gfs2_sbd *sdp = GFS2_SB(inode);
uint32_t hsize, len = 0;
uint32_t ht_offset, lp_offset, ht_offset_cur = -1;
uint32_t hash, index;
@@ -1407,7 +1412,7 @@ out:
int gfs2_dir_read(struct inode *inode, uint64_t *offset, void *opaque,
gfs2_filldir_t filldir)
{
- struct gfs2_inode *dip = inode->u.generic_ip;
+ struct gfs2_inode *dip = GFS2_I(inode);
struct dirent_gather g;
const struct gfs2_dirent **darr, *dent;
struct buffer_head *dibh;
@@ -1490,7 +1495,7 @@ int gfs2_dir_search(struct inode *dir, const struct qstr *name,
static int dir_new_leaf(struct inode *inode, const struct qstr *name)
{
struct buffer_head *bh, *obh;
- struct gfs2_inode *ip = inode->u.generic_ip;
+ struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_leaf *leaf, *oleaf;
int error;
u32 index;
@@ -1545,7 +1550,7 @@ static int dir_new_leaf(struct inode *inode, const struct qstr *name)
int gfs2_dir_add(struct inode *inode, const struct qstr *name,
const struct gfs2_inum *inum, unsigned type)
{
- struct gfs2_inode *ip = inode->u.generic_ip;
+ struct gfs2_inode *ip = GFS2_I(inode);
struct buffer_head *bh;
struct gfs2_dirent *dent;
struct gfs2_leaf *leaf;
@@ -1623,7 +1628,7 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct qstr *name)
/* Returns _either_ the entry (if its first in block) or the
previous entry otherwise */
- dent = gfs2_dirent_search(dip->i_vnode, name, gfs2_dirent_prev, &bh);
+ dent = gfs2_dirent_search(&dip->i_inode, name, gfs2_dirent_prev, &bh);
if (!dent) {
gfs2_consist_inode(dip);
return -EIO;
@@ -1659,6 +1664,7 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct qstr *name)
dip->i_di.di_mtime = dip->i_di.di_ctime = get_seconds();
gfs2_dinode_out(&dip->i_di, bh->b_data);
brelse(bh);
+ mark_inode_dirty(&dip->i_inode);
return error;
}
@@ -1683,7 +1689,7 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
struct gfs2_dirent *dent;
int error;
- dent = gfs2_dirent_search(dip->i_vnode, filename, gfs2_dirent_find, &bh);
+ dent = gfs2_dirent_search(&dip->i_inode, filename, gfs2_dirent_find, &bh);
if (!dent) {
gfs2_consist_inode(dip);
return -EIO;
@@ -1720,7 +1726,7 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
static int foreach_leaf(struct gfs2_inode *dip, leaf_call_t lc, void *data)
{
- struct gfs2_sbd *sdp = dip->i_sbd;
+ struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
struct buffer_head *bh;
struct gfs2_leaf *leaf;
uint32_t hsize, len;
@@ -1800,7 +1806,7 @@ static int foreach_leaf(struct gfs2_inode *dip, leaf_call_t lc, void *data)
static int leaf_dealloc(struct gfs2_inode *dip, uint32_t index, uint32_t len,
uint64_t leaf_no, void *data)
{
- struct gfs2_sbd *sdp = dip->i_sbd;
+ struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
struct gfs2_leaf *tmp_leaf;
struct gfs2_rgrp_list rlist;
struct buffer_head *bh, *dibh;
@@ -1920,7 +1926,7 @@ static int leaf_dealloc(struct gfs2_inode *dip, uint32_t index, uint32_t len,
int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip)
{
- struct gfs2_sbd *sdp = dip->i_sbd;
+ struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
struct buffer_head *bh;
int error;
diff --git a/fs/gfs2/eaops.c b/fs/gfs2/eaops.c
index 1c5ac3160b3..b7e6a37cab6 100644
--- a/fs/gfs2/eaops.c
+++ b/fs/gfs2/eaops.c
@@ -58,7 +58,7 @@ unsigned int gfs2_ea_name2type(const char *name, char **truncated_name)
static int user_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er)
{
- struct inode *inode = ip->i_vnode;
+ struct inode *inode = &ip->i_inode;
int error = permission(inode, MAY_READ, NULL);
if (error)
return error;
@@ -68,7 +68,7 @@ static int user_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er)
static int user_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er)
{
- struct inode *inode = ip->i_vnode;
+ struct inode *inode = &ip->i_inode;
if (S_ISREG(inode->i_mode) ||
(S_ISDIR(inode->i_mode) && !(inode->i_mode & S_ISVTX))) {
@@ -83,7 +83,7 @@ static int user_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er)
static int user_eo_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er)
{
- struct inode *inode = ip->i_vnode;
+ struct inode *inode = &ip->i_inode;
if (S_ISREG(inode->i_mode) ||
(S_ISDIR(inode->i_mode) && !(inode->i_mode & S_ISVTX))) {
@@ -103,7 +103,7 @@ static int system_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er)
!capable(CAP_SYS_ADMIN))
return -EPERM;
- if (ip->i_sbd->sd_args.ar_posix_acl == 0 &&
+ if (GFS2_SB(&ip->i_inode)->sd_args.ar_posix_acl == 0 &&
(GFS2_ACL_IS_ACCESS(er->er_name, er->er_name_len) ||
GFS2_ACL_IS_DEFAULT(er->er_name, er->er_name_len)))
return -EOPNOTSUPP;
@@ -172,7 +172,7 @@ static int system_eo_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er)
static int security_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er)
{
- struct inode *inode = ip->i_vnode;
+ struct inode *inode = &ip->i_inode;
int error = permission(inode, MAY_READ, NULL);
if (error)
return error;
@@ -182,7 +182,7 @@ static int security_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er)
static int security_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er)
{
- struct inode *inode = ip->i_vnode;
+ struct inode *inode = &ip->i_inode;
int error = permission(inode, MAY_WRITE, NULL);
if (error)
return error;
@@ -192,7 +192,7 @@ static int security_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er)
static int security_eo_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er)
{
- struct inode *inode = ip->i_vnode;
+ struct inode *inode = &ip->i_inode;
int error = permission(inode, MAY_WRITE, NULL);
if (error)
return error;
diff --git a/fs/gfs2/eattr.c b/fs/gfs2/eattr.c
index 2e114c07570..96736932260 100644
--- a/fs/gfs2/eattr.c
+++ b/fs/gfs2/eattr.c
@@ -80,7 +80,7 @@ static int ea_foreach_i(struct gfs2_inode *ip, struct buffer_head *bh,
struct gfs2_ea_header *ea, *prev = NULL;
int error = 0;
- if (gfs2_metatype_check(ip->i_sbd, bh, GFS2_METATYPE_EA))
+ if (gfs2_metatype_check(GFS2_SB(&ip->i_inode), bh, GFS2_METATYPE_EA))
return -EIO;
for (ea = GFS2_EA_BH2FIRST(bh);; prev = ea, ea = GFS2_EA2NEXT(ea)) {
@@ -128,13 +128,13 @@ static int ea_foreach(struct gfs2_inode *ip, ea_call_t ea_call, void *data)
goto out;
}
- if (gfs2_metatype_check(ip->i_sbd, bh, GFS2_METATYPE_IN)) {
+ if (gfs2_metatype_check(GFS2_SB(&ip->i_inode), bh, GFS2_METATYPE_IN)) {
error = -EIO;
goto out;
}
eablk = (uint64_t *)(bh->b_data + sizeof(struct gfs2_meta_header));
- end = eablk + ip->i_sbd->sd_inptrs;
+ end = eablk + GFS2_SB(&ip->i_inode)->sd_inptrs;
for (; eablk < end; eablk++) {
uint64_t bn;
@@ -232,7 +232,7 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
struct gfs2_ea_header *prev, void *private)
{
int *leave = private;
- struct gfs2_sbd *sdp = ip->i_sbd;
+ struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct gfs2_rgrpd *rgd;
struct gfs2_holder rg_gh;
struct buffer_head *dibh;
@@ -338,7 +338,7 @@ static int ea_remove_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
if (error)
goto out_alloc;
- error = gfs2_rindex_hold(ip->i_sbd, &al->al_ri_gh);
+ error = gfs2_rindex_hold(GFS2_SB(&ip->i_inode), &al->al_ri_gh);
if (error)
goto out_quota;
@@ -459,7 +459,7 @@ int gfs2_ea_list(struct gfs2_inode *ip, struct gfs2_ea_request *er)
static int ea_get_unstuffed(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
char *data)
{
- struct gfs2_sbd *sdp = ip->i_sbd;
+ struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct buffer_head **bh;
unsigned int amount = GFS2_EA_DATA_LEN(ea);
unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize);
@@ -604,7 +604,7 @@ int gfs2_ea_get(struct gfs2_inode *ip, struct gfs2_ea_request *er)
static int ea_alloc_blk(struct gfs2_inode *ip, struct buffer_head **bhp)
{
- struct gfs2_sbd *sdp = ip->i_sbd;
+ struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct gfs2_ea_header *ea;
uint64_t block;
@@ -641,7 +641,7 @@ static int ea_alloc_blk(struct gfs2_inode *ip, struct buffer_head **bhp)
static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
struct gfs2_ea_request *er)
{
- struct gfs2_sbd *sdp = ip->i_sbd;
+ struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
ea->ea_data_len = cpu_to_be32(er->er_data_len);
ea->ea_name_len = er->er_name_len;
@@ -723,7 +723,7 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er,
if (error)
goto out_gunlock_q;
- error = gfs2_trans_begin(ip->i_sbd,
+ error = gfs2_trans_begin(GFS2_SB(&ip->i_inode),
blks + al->al_rgd->rd_ri.ri_length +
RES_DINODE + RES_STATFS + RES_QUOTA, 0);
if (error)
@@ -736,7 +736,7 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er,
error = gfs2_meta_inode_buffer(ip, &dibh);
if (!error) {
if (er->er_flags & GFS2_ERF_MODE) {
- gfs2_assert_withdraw(ip->i_sbd,
+ gfs2_assert_withdraw(GFS2_SB(&ip->i_inode),
(ip->i_di.di_mode & S_IFMT) ==
(er->er_mode & S_IFMT));
ip->i_di.di_mode = er->er_mode;
@@ -748,7 +748,7 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er,
}
out_end_trans:
- gfs2_trans_end(ip->i_sbd);
+ gfs2_trans_end(GFS2_SB(&ip->i_inode));
out_ipres:
gfs2_inplace_release(ip);
@@ -790,7 +790,7 @@ static int ea_init_i(struct gfs2_inode *ip, struct gfs2_ea_request *er,
static int ea_init(struct gfs2_inode *ip, struct