[GFS2] Fix unlinked file handling

This patch fixes the way we have been dealing with unlinked,
but still open files. It removes all limits (other than memory
for inodes, as per every other filesystem) on numbers of these
which we can support on GFS2. It also means that (like other
fs) its the responsibility of the last process to close the file
to deallocate the storage, rather than the person who did the
unlinking. Note that with GFS2, those two events might take place
on different nodes.

Also there are a number of other changes:

 o We use the Linux inode subsystem as it was intended to be
used, wrt allocating GFS2 inodes
 o The Linux inode cache is now the point which we use for
local enforcement of only holding one copy of the inode in
core at once (previous to this we used the glock layer).
 o We no longer use the unlinked "special" file. We just ignore it
completely. This makes unlinking more efficient.
 o We now use the 4th block allocation state. The previously unused
state is used to track unlinked but still open inodes.
 o gfs2_inoded is no longer needed
 o Several fields are now no longer needed (and removed) from the in
core struct gfs2_inode
 o Several fields are no longer needed (and removed) from the in core
superblock

There are a number of future possible optimisations and clean ups
which have been made possible by this patch.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
This commit is contained in:
Steven Whitehouse
2006-06-14 15:32:57 -04:00
parent 22da645fd6
commit feaa7bba02
39 changed files with 750 additions and 1897 deletions
+1 -1
View File
@@ -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 \ 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 \ 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 \ 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_NOLOCK) += locking/nolock/
obj-$(CONFIG_GFS2_FS_LOCKING_DLM) += locking/dlm/ obj-$(CONFIG_GFS2_FS_LOCKING_DLM) += locking/dlm/
+5 -5
View File
@@ -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) 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; return -EOPNOTSUPP;
if (current->fsuid != ip->i_di.di_uid && !capable(CAP_FOWNER)) if (current->fsuid != ip->i_di.di_uid && !capable(CAP_FOWNER))
return -EPERM; return -EPERM;
@@ -160,7 +160,7 @@ int gfs2_check_acl_locked(struct inode *inode, int mask)
struct posix_acl *acl = NULL; struct posix_acl *acl = NULL;
int error; 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) if (error)
return 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) 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; struct gfs2_holder i_gh;
int error; 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) 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; struct buffer_head *dibh;
int error; 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) 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 posix_acl *acl = NULL, *clone;
struct gfs2_ea_request er; struct gfs2_ea_request er;
mode_t mode = ip->i_di.di_mode; mode_t mode = ip->i_di.di_mode;
+22 -22
View File
@@ -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) 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; uint64_t *arr;
unsigned int max, height; 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) 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; unsigned new_height = height - ip->i_di.di_height;
struct buffer_head *dibh; struct buffer_head *dibh;
struct buffer_head *blocks[GFS2_MAX_META_HEIGHT]; 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, static void find_metapath(struct gfs2_inode *ip, uint64_t block,
struct metapath *mp) struct metapath *mp)
{ {
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
uint64_t b = block; uint64_t b = block;
unsigned int i; unsigned int i;
@@ -382,8 +382,8 @@ static struct buffer_head *gfs2_block_pointers(struct inode *inode, u64 lblock,
int *boundary, int *boundary,
struct metapath *mp) struct metapath *mp)
{ {
struct gfs2_inode *ip = inode->u.generic_ip; struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(inode);
struct buffer_head *bh; struct buffer_head *bh;
int create = *new; int create = *new;
unsigned int bsize; unsigned int bsize;
@@ -446,7 +446,7 @@ out:
static inline void bmap_lock(struct inode *inode, int create) 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) if (create)
down_write(&ip->i_rw_mutex); down_write(&ip->i_rw_mutex);
else 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) 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) if (create)
up_write(&ip->i_rw_mutex); up_write(&ip->i_rw_mutex);
else 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) 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_inode *ip = GFS2_I(inode);
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(inode);
struct metapath mp; struct metapath mp;
struct buffer_head *bh; struct buffer_head *bh;
int boundary; 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, uint64_t block, int first, block_call_t bc,
void *data) void *data)
{ {
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
uint64_t *top, *bottom; uint64_t *top, *bottom;
uint64_t bn; 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, struct buffer_head *bh, uint64_t *top, uint64_t *bottom,
unsigned int height, void *data) unsigned int height, void *data)
{ {
struct strip_mine *sm = (struct strip_mine *)data; struct strip_mine *sm = data;
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct gfs2_rgrp_list rlist; struct gfs2_rgrp_list rlist;
uint64_t bn, bstart; uint64_t bn, bstart;
uint32_t blen; 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) 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 gfs2_alloc *al;
struct buffer_head *dibh; struct buffer_head *dibh;
unsigned int h; unsigned int h;
@@ -795,7 +795,7 @@ static int do_grow(struct gfs2_inode *ip, uint64_t size)
h = calc_tree_height(ip, size); h = calc_tree_height(ip, size);
if (ip->i_di.di_height < h) { if (ip->i_di.di_height < h) {
down_write(&ip->i_rw_mutex); 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); up_write(&ip->i_rw_mutex);
if (error) if (error)
goto out_end_trans; 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) 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; struct buffer_head *dibh;
int journaled = gfs2_is_jdata(ip); int journaled = gfs2_is_jdata(ip);
int error; int error;
@@ -854,7 +854,7 @@ static int trunc_start(struct gfs2_inode *ip, uint64_t size)
} else { } else {
if (size & (uint64_t)(sdp->sd_sb.sb_bsize - 1)) 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) { if (!error) {
ip->i_di.di_size = size; ip->i_di.di_size = size;
@@ -883,7 +883,7 @@ static int trunc_dealloc(struct gfs2_inode *ip, uint64_t size)
if (!size) if (!size)
lblock = 0; lblock = 0;
else 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); find_metapath(ip, lblock, &mp);
gfs2_alloc_get(ip); 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) 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; struct buffer_head *dibh;
int error; int error;
@@ -990,7 +990,7 @@ int gfs2_truncatei(struct gfs2_inode *ip, uint64_t size)
{ {
int error; 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; return -EINVAL;
if (size > ip->i_di.di_size) 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, void gfs2_write_calc_reserv(struct gfs2_inode *ip, unsigned int len,
unsigned int *data_blocks, unsigned int *ind_blocks) 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; unsigned int tmp;
if (gfs2_is_dir(ip)) { 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, int gfs2_write_alloc_required(struct gfs2_inode *ip, uint64_t offset,
unsigned int len, int *alloc_required) 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; uint64_t lblock, lblock_stop, dblock;
uint32_t extlen; uint32_t extlen;
int new = 0; 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) { 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) if (error)
return error; return error;
-27
View File
@@ -25,7 +25,6 @@
#include "quota.h" #include "quota.h"
#include "recovery.h" #include "recovery.h"
#include "super.h" #include "super.h"
#include "unlinked.h"
#include "util.h" #include "util.h"
/* This uses schedule_timeout() instead of msleep() because it's good for /* This uses schedule_timeout() instead of msleep() because it's good for
@@ -195,29 +194,3 @@ int gfs2_quotad(void *data)
return 0; 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;
}
-1
View File
@@ -15,6 +15,5 @@ int gfs2_glockd(void *data);
int gfs2_recoverd(void *data); int gfs2_recoverd(void *data);
int gfs2_logd(void *data); int gfs2_logd(void *data);
int gfs2_quotad(void *data); int gfs2_quotad(void *data);
int gfs2_inoded(void *data);
#endif /* __DAEMON_DOT_H__ */ #endif /* __DAEMON_DOT_H__ */
+36 -30
View File
@@ -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); error = gfs2_meta_read(ip->i_gl, block, DIO_START | DIO_WAIT, &bh);
if (error) if (error)
return 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); brelse(bh);
return -EIO; 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, static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,
uint64_t offset, unsigned int size) 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; struct buffer_head *dibh;
uint64_t lblock, dblock; uint64_t lblock, dblock;
uint32_t extlen = 0; uint32_t extlen = 0;
@@ -197,7 +197,7 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,
if (!extlen) { if (!extlen) {
new = 1; new = 1;
error = gfs2_extent_map(ip->i_vnode, lblock, &new, error = gfs2_extent_map(&ip->i_inode, lblock, &new,
&dblock, &extlen); &dblock, &extlen);
if (error) if (error)
goto fail; 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, static int gfs2_dir_read_data(struct gfs2_inode *ip, char *buf,
uint64_t offset, unsigned int size) 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; uint64_t lblock, dblock;
uint32_t extlen = 0; uint32_t extlen = 0;
unsigned int o; unsigned int o;
@@ -314,7 +314,7 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, char *buf,
if (!extlen) { if (!extlen) {
new = 0; new = 0;
error = gfs2_extent_map(ip->i_vnode, lblock, &new, error = gfs2_extent_map(&ip->i_inode, lblock, &new,
&dblock, &extlen); &dblock, &extlen);
if (error) if (error)
goto fail; goto fail;
@@ -534,7 +534,7 @@ static struct gfs2_dirent *gfs2_dirent_scan(struct inode *inode,
} }
consist_inode: consist_inode:
gfs2_consist_inode(inode->u.generic_ip); gfs2_consist_inode(GFS2_I(inode));
return ERR_PTR(-EIO); 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; struct gfs2_meta_header *h = (struct gfs2_meta_header *)bh->b_data;
if (be32_to_cpu(h->mh_type) == GFS2_METATYPE_LF) { 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; return -EIO;
*dent = (struct gfs2_dirent *)(bh->b_data + *dent = (struct gfs2_dirent *)(bh->b_data +
sizeof(struct gfs2_leaf)); sizeof(struct gfs2_leaf));
return IS_LEAF; return IS_LEAF;
} else { } 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; return -EIO;
*dent = (struct gfs2_dirent *)(bh->b_data + *dent = (struct gfs2_dirent *)(bh->b_data +
sizeof(struct gfs2_dinode)); sizeof(struct gfs2_dinode));
@@ -674,7 +674,7 @@ static struct gfs2_dirent *gfs2_init_dirent(struct inode *inode,
const struct qstr *name, const struct qstr *name,
struct buffer_head *bh) struct buffer_head *bh)
{ {
struct gfs2_inode *ip = inode->u.generic_ip; struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_dirent *ndent; struct gfs2_dirent *ndent;
unsigned offset = 0, totlen; unsigned offset = 0, totlen;
@@ -707,8 +707,10 @@ static int get_leaf(struct gfs2_inode *dip, uint64_t leaf_no,
int error; int error;
error = gfs2_meta_read(dip->i_gl, leaf_no, DIO_START | DIO_WAIT, bhp); 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; error = -EIO;
}
return error; return error;
} }
@@ -759,7 +761,7 @@ static struct gfs2_dirent *gfs2_dirent_search(struct inode *inode,
{ {
struct buffer_head *bh; struct buffer_head *bh;
struct gfs2_dirent *dent; struct gfs2_dirent *dent;
struct gfs2_inode *ip = inode->u.generic_ip; struct gfs2_inode *ip = GFS2_I(inode);
int error; int error;
if (ip->i_di.di_flags & GFS2_DIF_EXHASH) { 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); gfs2_consist_inode(ip);
return ERR_PTR(-EIO); return ERR_PTR(-EIO);
} }
index = name->hash >> (32 - ip->i_di.di_depth); index = name->hash >> (32 - ip->i_di.di_depth);
error = get_first_leaf(ip, index, &bh); error = get_first_leaf(ip, index, &bh);
if (error) if (error)
@@ -786,12 +788,14 @@ static struct gfs2_dirent *gfs2_dirent_search(struct inode *inode,
brelse(bh); brelse(bh);
if (!ln) if (!ln)
break; break;
error = get_leaf(ip, ln, &bh); error = get_leaf(ip, ln, &bh);
} while(!error); } while(!error);
return error ? ERR_PTR(error) : NULL; return error ? ERR_PTR(error) : NULL;
} }
error = gfs2_meta_inode_buffer(ip, &bh); error = gfs2_meta_inode_buffer(ip, &bh);
if (error) if (error)
return ERR_PTR(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) 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); u64 bn = gfs2_alloc_meta(ip);
struct buffer_head *bh = gfs2_meta_new(ip->i_gl, bn); struct buffer_head *bh = gfs2_meta_new(ip->i_gl, bn);
struct gfs2_leaf *leaf; 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 }; struct qstr name = { .name = "", .len = 0, .hash = 0 };
if (!bh) if (!bh)
return NULL; return NULL;
gfs2_trans_add_bh(ip->i_gl, bh, 1); gfs2_trans_add_bh(ip->i_gl, bh, 1);
gfs2_metatype_set(bh, GFS2_METATYPE_LF, GFS2_FORMAT_LF); gfs2_metatype_set(bh, GFS2_METATYPE_LF, GFS2_FORMAT_LF);
leaf = (struct gfs2_leaf *)bh->b_data; 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) static int dir_make_exhash(struct inode *inode)
{ {
struct gfs2_inode *dip = inode->u.generic_ip; struct gfs2_inode *dip = GFS2_I(inode);
struct gfs2_sbd *sdp = dip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(inode);
struct gfs2_dirent *dent; struct gfs2_dirent *dent;
struct qstr args; struct qstr args;
struct buffer_head *bh, *dibh; 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) + args.len = bh->b_size - sizeof(struct gfs2_dinode) +
sizeof(struct gfs2_leaf); sizeof(struct gfs2_leaf);
args.name = bh->b_data; 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); gfs2_dirent_last, &args, NULL);
if (!dent) { if (!dent) {
brelse(bh); 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) 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 buffer_head *nbh, *obh, *dibh;
struct gfs2_leaf *nleaf, *oleaf; struct gfs2_leaf *nleaf, *oleaf;
struct gfs2_dirent *dent, *prev = NULL, *next = NULL, *new; 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; oleaf->lf_depth = nleaf->lf_depth;
error = gfs2_meta_inode_buffer(dip, &dibh); 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++; dip->i_di.di_blocks++;
gfs2_dinode_out(&dip->i_di, dibh->b_data); gfs2_dinode_out(&dip->i_di, dibh->b_data);
brelse(dibh); brelse(dibh);
@@ -1073,7 +1078,7 @@ fail_brelse:
static int dir_double_exhash(struct gfs2_inode *dip) 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; struct buffer_head *dibh;
uint32_t hsize; uint32_t hsize;
uint64_t *buf; 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, gfs2_filldir_t filldir, int *copied,
unsigned *depth, u64 leaf_no) 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 buffer_head *bh;
struct gfs2_leaf *lf; struct gfs2_leaf *lf;
unsigned entries = 0; unsigned entries = 0;
@@ -1348,8 +1353,8 @@ out:
static int dir_e_read(struct inode *inode, uint64_t *offset, void *opaque, static int dir_e_read(struct inode *inode, uint64_t *offset, void *opaque,
gfs2_filldir_t filldir) gfs2_filldir_t filldir)
{ {
struct gfs2_inode *dip = inode->u.generic_ip; struct gfs2_inode *dip = GFS2_I(inode);
struct gfs2_sbd *sdp = dip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(inode);
uint32_t hsize, len = 0; uint32_t hsize, len = 0;
uint32_t ht_offset, lp_offset, ht_offset_cur = -1; uint32_t ht_offset, lp_offset, ht_offset_cur = -1;
uint32_t hash, index; uint32_t hash, index;
@@ -1407,7 +1412,7 @@ out:
int gfs2_dir_read(struct inode *inode, uint64_t *offset, void *opaque, int gfs2_dir_read(struct inode *inode, uint64_t *offset, void *opaque,
gfs2_filldir_t filldir) gfs2_filldir_t filldir)
{ {
struct gfs2_inode *dip = inode->u.generic_ip; struct gfs2_inode *dip = GFS2_I(inode);
struct dirent_gather g; struct dirent_gather g;
const struct gfs2_dirent **darr, *dent; const struct gfs2_dirent **darr, *dent;
struct buffer_head *dibh; 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) static int dir_new_leaf(struct inode *inode, const struct qstr *name)
{ {
struct buffer_head *bh, *obh; 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; struct gfs2_leaf *leaf, *oleaf;
int error; int error;
u32 index; 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, int gfs2_dir_add(struct inode *inode, const struct qstr *name,
const struct gfs2_inum *inum, unsigned type) 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 buffer_head *bh;
struct gfs2_dirent *dent; struct gfs2_dirent *dent;
struct gfs2_leaf *leaf; 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 /* Returns _either_ the entry (if its first in block) or the
previous entry otherwise */ 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) { if (!dent) {
gfs2_consist_inode(dip); gfs2_consist_inode(dip);
return -EIO; 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(); dip->i_di.di_mtime = dip->i_di.di_ctime = get_seconds();
gfs2_dinode_out(&dip->i_di, bh->b_data); gfs2_dinode_out(&dip->i_di, bh->b_data);
brelse(bh); brelse(bh);
mark_inode_dirty(&dip->i_inode);
return error; return error;
} }
@@ -1683,7 +1689,7 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
struct gfs2_dirent *dent; struct gfs2_dirent *dent;
int error; 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) { if (!dent) {
gfs2_consist_inode(dip); gfs2_consist_inode(dip);
return -EIO; 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) 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 buffer_head *bh;
struct gfs2_leaf *leaf; struct gfs2_leaf *leaf;
uint32_t hsize, len; 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, static int leaf_dealloc(struct gfs2_inode *dip, uint32_t index, uint32_t len,
uint64_t leaf_no, void *data) 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_leaf *tmp_leaf;
struct gfs2_rgrp_list rlist; struct gfs2_rgrp_list rlist;
struct buffer_head *bh, *dibh; 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) 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; struct buffer_head *bh;
int error; int error;
+7 -7
View File
@@ -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) 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); int error = permission(inode, MAY_READ, NULL);
if (error) if (error)
return 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) 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) || if (S_ISREG(inode->i_mode) ||
(S_ISDIR(inode->i_mode) && !(inode->i_mode & S_ISVTX))) { (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) 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) || if (S_ISREG(inode->i_mode) ||
(S_ISDIR(inode->i_mode) && !(inode->i_mode & S_ISVTX))) { (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)) !capable(CAP_SYS_ADMIN))
return -EPERM; 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_ACCESS(er->er_name, er->er_name_len) ||
GFS2_ACL_IS_DEFAULT(er->er_name, er->er_name_len))) GFS2_ACL_IS_DEFAULT(er->er_name, er->er_name_len)))
return -EOPNOTSUPP; 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) 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); int error = permission(inode, MAY_READ, NULL);
if (error) if (error)
return 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) 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); int error = permission(inode, MAY_WRITE, NULL);
if (error) if (error)
return 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) 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); int error = permission(inode, MAY_WRITE, NULL);
if (error) if (error)
return error; return error;
+35 -35
View File
@@ -80,7 +80,7 @@ static int ea_foreach_i(struct gfs2_inode *ip, struct buffer_head *bh,
struct gfs2_ea_header *ea, *prev = NULL; struct gfs2_ea_header *ea, *prev = NULL;
int error = 0; 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; return -EIO;
for (ea = GFS2_EA_BH2FIRST(bh);; prev = ea, ea = GFS2_EA2NEXT(ea)) { 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; 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; error = -EIO;
goto out; goto out;
} }
eablk = (uint64_t *)(bh->b_data + sizeof(struct gfs2_meta_header)); 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++) { for (; eablk < end; eablk++) {
uint64_t bn; 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) struct gfs2_ea_header *prev, void *private)
{ {
int *leave = 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_rgrpd *rgd;
struct gfs2_holder rg_gh; struct gfs2_holder rg_gh;
struct buffer_head *dibh; struct buffer_head *dibh;
@@ -338,7 +338,7 @@ static int ea_remove_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
if (error) if (error)
goto out_alloc; 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) if (error)
goto out_quota; 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, static int ea_get_unstuffed(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
char *data) char *data)
{ {
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct buffer_head **bh; struct buffer_head **bh;
unsigned int amount = GFS2_EA_DATA_LEN(ea); unsigned int amount = GFS2_EA_DATA_LEN(ea);
unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize); 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) 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; struct gfs2_ea_header *ea;
uint64_t block; 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, static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
struct gfs2_ea_request *er) 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_data_len = cpu_to_be32(er->er_data_len);
ea->ea_name_len = er->er_name_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) if (error)
goto out_gunlock_q; 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 + blks + al->al_rgd->rd_ri.ri_length +
RES_DINODE + RES_STATFS + RES_QUOTA, 0); RES_DINODE + RES_STATFS + RES_QUOTA, 0);
if (error) 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); error = gfs2_meta_inode_buffer(ip, &dibh);
if (!error) { if (!error) {
if (er->er_flags & GFS2_ERF_MODE) { 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) == (ip->i_di.di_mode & S_IFMT) ==
(er->er_mode & S_IFMT)); (er->er_mode & S_IFMT));
ip->i_di.di_mode = er->er_mode; 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: out_end_trans:
gfs2_trans_end(ip->i_sbd); gfs2_trans_end(GFS2_SB(&ip->i_inode));
out_ipres: out_ipres:
gfs2_inplace_release(ip); 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 gfs2_ea_request *er) static int ea_init(struct gfs2_inode *ip, struct gfs2_ea_request *er)
{ {
unsigned int jbsize = ip->i_sbd->sd_jbsize; unsigned int jbsize = GFS2_SB(&ip->i_inode)->sd_jbsize;
unsigned int blks = 1; unsigned int blks = 1;
if (GFS2_EAREQ_SIZE_STUFFED(er) > jbsize) if (GFS2_EAREQ_SIZE_STUFFED(er) > jbsize)
@@ -830,7 +830,7 @@ static void ea_set_remove_stuffed(struct gfs2_inode *ip,
return; return;
} else if (GFS2_EA2NEXT(prev) != ea) { } else if (GFS2_EA2NEXT(prev) != ea) {
prev = GFS2_EA2NEXT(prev); prev = GFS2_EA2NEXT(prev);
gfs2_assert_withdraw(ip->i_sbd, GFS2_EA2NEXT(prev) == ea); gfs2_assert_withdraw(GFS2_SB(&ip->i_inode), GFS2_EA2NEXT(prev) == ea);
} }
len = GFS2_EA_REC_LEN(prev) + GFS2_EA_REC_LEN(ea); len = GFS2_EA_REC_LEN(prev) + GFS2_EA_REC_LEN(ea);
@@ -857,7 +857,7 @@ static int ea_set_simple_noalloc(struct gfs2_inode *ip, struct buffer_head *bh,
struct buffer_head *dibh; struct buffer_head *dibh;
int error; int error;
error = gfs2_trans_begin(ip->i_sbd, RES_DINODE + 2 * RES_EATTR, 0); error = gfs2_trans_begin(GFS2_SB(&ip->i_inode), RES_DINODE + 2 * RES_EATTR, 0);
if (error) if (error)
return error; return error;
@@ -876,7 +876,7 @@ static int ea_set_simple_noalloc(struct gfs2_inode *ip, struct buffer_head *bh,
goto out; goto out;
if (er->er_flags & GFS2_ERF_MODE) { 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 & S_IFMT) == (er->er_mode & S_IFMT));
ip->i_di.di_mode = er->er_mode; ip->i_di.di_mode = er->er_mode;
} }
@@ -885,7 +885,7 @@ static int ea_set_simple_noalloc(struct gfs2_inode *ip, struct buffer_head *bh,
gfs2_dinode_out(&ip->i_di, dibh->b_data); gfs2_dinode_out(&ip->i_di, dibh->b_data);
brelse(dibh); brelse(dibh);
out: out:
gfs2_trans_end(ip->i_sbd); gfs2_trans_end(GFS2_SB(&ip->i_inode));
return error; return error;
} }
@@ -921,7 +921,7 @@ static int ea_set_simple(struct gfs2_inode *ip, struct buffer_head *bh,
int stuffed; int stuffed;
int error; int error;
stuffed = ea_calc_size(ip->i_sbd, es->es_er, &size); stuffed = ea_calc_size(GFS2_SB(&ip->i_inode), es->es_er, &size);
if (ea->ea_type == GFS2_EATYPE_UNUSED) { if (ea->ea_type == GFS2_EATYPE_UNUSED) {
if (GFS2_EA_REC_LEN(ea) < size) if (GFS2_EA_REC_LEN(ea) < size)
@@ -947,7 +947,7 @@ static int ea_set_simple(struct gfs2_inode *ip, struct buffer_head *bh,
es->es_bh = bh; es->es_bh = bh;
es->es_ea = ea; es->es_ea = ea;
blks = 2 + DIV_ROUND_UP(es->es_er->er_data_len, blks = 2 + DIV_ROUND_UP(es->es_er->er_data_len,
ip->i_sbd->sd_jbsize); GFS2_SB(&ip->i_inode)->sd_jbsize);
error = ea_alloc_skeleton(ip, es->es_er, blks, error = ea_alloc_skeleton(ip, es->es_er, blks,
ea_set_simple_alloc, es); ea_set_simple_alloc, es);
@@ -961,7 +961,7 @@ static int ea_set_simple(struct gfs2_inode *ip, struct buffer_head *bh,
static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er, static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er,
void *private) void *private)
{ {
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct buffer_head *indbh, *newbh; struct buffer_head *indbh, *newbh;
uint64_t *eablk; uint64_t *eablk;
int error; int error;
@@ -1050,8 +1050,8 @@ static int ea_set_i(struct gfs2_inode *ip, struct gfs2_ea_request *er,
if (!(ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT)) if (!(ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT))
blks++; blks++;
if (GFS2_EAREQ_SIZE_STUFFED(er) > ip->i_sbd->sd_jbsize) if (GFS2_EAREQ_SIZE_STUFFED(er) > GFS2_SB(&ip->i_inode)->sd_jbsize)
blks += DIV_ROUND_UP(er->er_data_len, ip->i_sbd->sd_jbsize); blks += DIV_ROUND_UP(er->er_data_len, GFS2_SB(&ip->i_inode)->sd_jbsize);
return ea_alloc_skeleton(ip, er, blks, ea_set_block, el); return ea_alloc_skeleton(ip, er, blks, ea_set_block, el);
} }
@@ -1061,7 +1061,7 @@ static int ea_set_remove_unstuffed(struct gfs2_inode *ip,
{ {
if (el->el_prev && GFS2_EA2NEXT(el->el_prev) != el->el_ea) { if (el->el_prev && GFS2_EA2NEXT(el->el_prev) != el->el_ea) {
el->el_prev = GFS2_EA2NEXT(el->el_prev); el->el_prev = GFS2_EA2NEXT(el->el_prev);
gfs2_assert_withdraw(ip->i_sbd, gfs2_assert_withdraw(GFS2_SB(&ip->i_inode),
GFS2_EA2NEXT(el->el_prev) == el->el_ea); GFS2_EA2NEXT(el->el_prev) == el->el_ea);
} }
@@ -1119,7 +1119,7 @@ int gfs2_ea_set(struct gfs2_inode *ip, struct gfs2_ea_request *er)
er->er_data = NULL; er->er_data = NULL;
er->er_data_len = 0; er->er_data_len = 0;
} }
error = ea_check_size(ip->i_sbd, er); error = ea_check_size(GFS2_SB(&ip->i_inode), er);
if (error) if (error)
return error; return error;
@@ -1127,7 +1127,7 @@ int gfs2_ea_set(struct gfs2_inode *ip, struct gfs2_ea_request *er)
if (error) if (error)
return error; return error;
if (IS_IMMUTABLE(ip->i_vnode)) if (IS_IMMUTABLE(&ip->i_inode))
error = -EPERM; error = -EPERM;
else else
error = gfs2_ea_ops[er->er_type]->eo_set(ip, er); error = gfs2_ea_ops[er->er_type]->eo_set(ip, er);
@@ -1144,7 +1144,7 @@ static int ea_remove_stuffed(struct gfs2_inode *ip, struct gfs2_ea_location *el)
struct buffer_head *dibh; struct buffer_head *dibh;
int error; int error;
error = gfs2_trans_begin(ip->i_sbd, RES_DINODE + RES_EATTR, 0); error = gfs2_trans_begin(GFS2_SB(&ip->i_inode), RES_DINODE + RES_EATTR, 0);
if (error) if (error)
return error; return error;
@@ -1169,7 +1169,7 @@ static int ea_remove_stuffed(struct gfs2_inode *ip, struct gfs2_ea_location *el)
brelse(dibh); brelse(dibh);
} }
gfs2_trans_end(ip->i_sbd); gfs2_trans_end(GFS2_SB(&ip->i_inode));
return error; return error;
} }
@@ -1219,7 +1219,7 @@ int gfs2_ea_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er)
if (error) if (error)
return error; return error;
if (IS_IMMUTABLE(ip->i_vnode) || IS_APPEND(ip->i_vnode)) if (IS_IMMUTABLE(&ip->i_inode) || IS_APPEND(&ip->i_inode))
error = -EPERM; error = -EPERM;
else else
error = gfs2_ea_ops[er->er_type]->eo_remove(ip, er); error = gfs2_ea_ops[er->er_type]->eo_remove(ip, er);
@@ -1232,7 +1232,7 @@ int gfs2_ea_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er)
static int ea_acl_chmod_unstuffed(struct gfs2_inode *ip, static int ea_acl_chmod_unstuffed(struct gfs2_inode *ip,
struct gfs2_ea_header *ea, char *data) 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; struct buffer_head **bh;
unsigned int amount = GFS2_EA_DATA_LEN(ea); unsigned int amount = GFS2_EA_DATA_LEN(ea);
unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize); unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize);
@@ -1304,7 +1304,7 @@ int gfs2_ea_acl_chmod(struct gfs2_inode *ip, struct gfs2_ea_location *el,
int error; int error;
if (GFS2_EA_IS_STUFFED(el->el_ea)) { if (GFS2_EA_IS_STUFFED(el->el_ea)) {
error = gfs2_trans_begin(ip->i_sbd, RES_DINODE + RES_EATTR, 0); error = gfs2_trans_begin(GFS2_SB(&ip->i_inode), RES_DINODE + RES_EATTR, 0);
if (error) if (error)
return error; return error;
@@ -1320,22 +1320,22 @@ int gfs2_ea_acl_chmod(struct gfs2_inode *ip, struct gfs2_ea_location *el,
error = gfs2_meta_inode_buffer(ip, &dibh); error = gfs2_meta_inode_buffer(ip, &dibh);
if (!error) { if (!error) {
error = inode_setattr(ip->i_vnode, attr); error = inode_setattr(&ip->i_inode, attr);
gfs2_assert_warn(ip->i_sbd, !error); gfs2_assert_warn(GFS2_SB(&ip->i_inode), !error);
gfs2_inode_attr_out(ip); gfs2_inode_attr_out(ip);
gfs2_trans_add_bh(ip->i_gl, dibh, 1); gfs2_trans_add_bh(ip->i_gl, dibh, 1);
gfs2_dinode_out(&ip->i_di, dibh->b_data); gfs2_dinode_out(&ip->i_di, dibh->b_data);
brelse(dibh); brelse(dibh);
} }
gfs2_trans_end(ip->i_sbd); gfs2_trans_end(GFS2_SB(&ip->i_inode));
return error; return error;
} }
static int ea_dealloc_indirect(struct gfs2_inode *ip) static int ea_dealloc_indirect(struct gfs2_inode *ip)
{ {
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct gfs2_rgrp_list rlist; struct gfs2_rgrp_list rlist;
struct buffer_head *indbh, *dibh; struct buffer_head *indbh, *dibh;
uint64_t *eablk, *end; uint64_t *eablk, *end;
@@ -1456,7 +1456,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
static int ea_dealloc_block(struct gfs2_inode *ip) static int ea_dealloc_block(struct gfs2_inode *ip)
{ {
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct gfs2_alloc *al = &ip->i_alloc; struct gfs2_alloc *al = &ip->i_alloc;
struct gfs2_rgrpd *rgd; struct gfs2_rgrpd *rgd;
struct buffer_head *dibh; struct buffer_head *dibh;
@@ -1518,7 +1518,7 @@ int gfs2_ea_dealloc(struct gfs2_inode *ip)
if (error) if (error)
goto out_alloc; 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) if (error)
goto out_quota; goto out_quota;
+21 -81
View File
@@ -654,7 +654,7 @@ static void run_queue(struct gfs2_glock *gl)
* Gives caller exclusive access to manipulate a glock structure. * Gives caller exclusive access to manipulate a glock structure.
*/ */
void gfs2_glmutex_lock(struct gfs2_glock *gl) static void gfs2_glmutex_lock(struct gfs2_glock *gl)
{ {
struct gfs2_holder gh; struct gfs2_holder gh;
@@ -704,7 +704,7 @@ static int gfs2_glmutex_trylock(struct gfs2_glock *gl)
* *
*/ */
void gfs2_glmutex_unlock(struct gfs2_glock *gl) static void gfs2_glmutex_unlock(struct gfs2_glock *gl)
{ {
spin_lock(&gl->gl_spin); spin_lock(&gl->gl_spin);
clear_bit(GLF_LOCK, &gl->gl_flags); clear_bit(GLF_LOCK, &gl->gl_flags);
@@ -726,7 +726,7 @@ static void handle_callback(struct gfs2_glock *gl, unsigned int state)
{ {
struct gfs2_holder *gh, *new_gh = NULL; struct gfs2_holder *gh, *new_gh = NULL;
restart: restart:
spin_lock(&gl->gl_spin); spin_lock(&gl->gl_spin);
list_for_each_entry(gh, &gl->gl_waiters2, gh_list) { list_for_each_entry(gh, &gl->gl_waiters2, gh_list) {
@@ -752,13 +752,27 @@ static void handle_callback(struct gfs2_glock *gl, unsigned int state)
goto restart; goto restart;
} }
out: out:
spin_unlock(&gl->gl_spin); spin_unlock(&gl->gl_spin);
if (new_gh) if (new_gh)
gfs2_holder_put(new_gh); gfs2_holder_put(new_gh);
} }
void gfs2_glock_inode_squish(struct inode *inode)
{
struct gfs2_holder gh;
struct gfs2_glock *gl = GFS2_I(inode)->i_gl;
gfs2_holder_init(gl, LM_ST_UNLOCKED, 0, &gh);
set_bit(HIF_DEMOTE, &gh.gh_iflags);
spin_lock(&gl->gl_spin);
gfs2_assert(inode->i_sb->s_fs_info, list_empty(&gl->gl_holders));
list_add_tail(&gh.gh_list, &gl->gl_waiters2);
run_queue(gl);
spin_unlock(&gl->gl_spin);
gfs2_holder_uninit(&gh);
}
/** /**
* state_change - record that the glock is now in a different state * state_change - record that the glock is now in a different state
* @gl: the glock * @gl: the glock
@@ -1383,8 +1397,7 @@ int gfs2_glock_be_greedy(struct gfs2_glock *gl, unsigned int time)
struct greedy *gr; struct greedy *gr;
struct gfs2_holder *gh; struct gfs2_holder *gh;
if (!time || if (!time || gl->gl_sbd->sd_args.ar_localcaching ||
gl->gl_sbd->sd_args.ar_localcaching ||
test_and_set_bit(GLF_GREEDY, &gl->gl_flags)) test_and_set_bit(GLF_GREEDY, &gl->gl_flags))
return 1; return 1;
@@ -1784,43 +1797,6 @@ void gfs2_glock_cb(lm_fsdata_t *fsdata, unsigned int type, void *data)
} }
} }
/**
* gfs2_try_toss_inode - try to remove a particular inode struct from cache
* sdp: the filesystem
* inum: the inode number
*
*/
void gfs2_try_toss_inode(struct gfs2_sbd *sdp, struct gfs2_inum *inum)
{
struct gfs2_glock *gl;
struct gfs2_inode *ip;
int error;
error = gfs2_glock_get(sdp, inum->no_addr, &gfs2_inode_glops,
NO_CREATE, &gl);
if (error || !gl)
return;
if (!gfs2_glmutex_trylock(gl))
goto out;
ip = gl->gl_object;
if (!ip)
goto out_unlock;
if (atomic_read(&ip->i_count))
goto out_unlock;
gfs2_inode_destroy(ip, 1);
out_unlock:
gfs2_glmutex_unlock(gl);
out:
gfs2_glock_put(gl);
}
/** /**
* gfs2_iopen_go_callback - Try to kick the inode/vnode associated with an * gfs2_iopen_go_callback - Try to kick the inode/vnode associated with an
* iopen glock from memory * iopen glock from memory
@@ -1831,34 +1807,10 @@ void gfs2_try_toss_inode(struct gfs2_sbd *sdp, struct gfs2_inum *inum)
void gfs2_iopen_go_callback(struct gfs2_glock *io_gl, unsigned int state) void gfs2_iopen_go_callback(struct gfs2_glock *io_gl, unsigned int state)
{ {
struct gfs2_glock *i_gl;
if (state != LM_ST_UNLOCKED) if (state != LM_ST_UNLOCKED)
return; return;
/* FIXME: remove this? */
spin_lock(&io_gl->gl_spin);
i_gl = io_gl->gl_object;
if (i_gl) {
gfs2_glock_hold(i_gl);
spin_unlock(&io_gl->gl_spin);
} else {
spin_unlock(&io_gl->gl_spin);
return;
}
if (gfs2_glmutex_trylock(i_gl)) {
struct gfs2_inode *ip = i_gl->gl_object;
if (ip) {
gfs2_try_toss_vnode(ip);
gfs2_glmutex_unlock(i_gl);
gfs2_glock_schedule_for_reclaim(i_gl);
goto out;
}
gfs2_glmutex_unlock(i_gl);
}
out:
gfs2_glock_put(i_gl);
} }
/** /**
@@ -1935,11 +1887,6 @@ void gfs2_reclaim_glock(struct gfs2_sbd *sdp)
atomic_inc(&sdp->sd_reclaimed); atomic_inc(&sdp->sd_reclaimed);
if (gfs2_glmutex_trylock(gl)) { if (gfs2_glmutex_trylock(gl)) {
if (gl->gl_ops == &gfs2_inode_glops) {
struct gfs2_inode *ip = gl->gl_object;
if (ip && !atomic_read(&ip->i_count))
gfs2_inode_destroy(ip, 1);
}
if (queue_empty(gl, &gl->gl_holders) && if (queue_empty(gl, &gl->gl_holders) &&
gl->gl_state != LM_ST_UNLOCKED && gl->gl_state != LM_ST_UNLOCKED &&
demote_ok(gl)) demote_ok(gl))
@@ -2018,7 +1965,7 @@ static void scan_glock(struct gfs2_glock *gl)
if (gfs2_glmutex_trylock(gl)) { if (gfs2_glmutex_trylock(gl)) {
if (gl->gl_ops == &gfs2_inode_glops) { if (gl->gl_ops == &gfs2_inode_glops) {
struct gfs2_inode *ip = gl->gl_object; struct gfs2_inode *ip = gl->gl_object;
if (ip && !atomic_read(&ip->i_count)) if (ip)
goto out_schedule; goto out_schedule;
} }
if (queue_empty(gl, &gl->gl_holders) && if (queue_empty(gl, &gl->gl_holders) &&
@@ -2078,11 +2025,6 @@ static void clear_glock(struct gfs2_glock *gl)
} }
if (gfs2_glmutex_trylock(gl)) { if (gfs2_glmutex_trylock(gl)) {
if (gl->gl_ops == &gfs2_inode_glops) {
struct gfs2_inode *ip = gl->gl_object;
if (ip && !atomic_read(&ip->i_count))
gfs2_inode_destroy(ip, 1);
}
if (queue_empty(gl, &gl->gl_holders) && if (queue_empty(gl, &gl->gl_holders) &&
gl->gl_state != LM_ST_UNLOCKED) gl->gl_state != LM_ST_UNLOCKED)
handle_callback(gl, LM_ST_UNLOCKED); handle_callback(gl, LM_ST_UNLOCKED);
@@ -2199,13 +2141,11 @@ static int dump_inode(struct gfs2_inode *ip)
(unsigned long long)ip->i_num.no_formal_ino, (unsigned long long)ip->i_num.no_formal_ino,
(unsigned long long)ip->i_num.no_addr); (unsigned long long)ip->i_num.no_addr);
printk(KERN_INFO " type = %u\n", IF2DT(ip->i_di.di_mode)); printk(KERN_INFO " type = %u\n", IF2DT(ip->i_di.di_mode));
printk(KERN_INFO " i_count = %d\n", atomic_read(&ip->i_count));
printk(KERN_INFO " i_flags ="); printk(KERN_INFO " i_flags =");
for (x = 0; x < 32; x++) for (x = 0; x < 32; x++)
if (test_bit(x, &ip->i_flags)) if (test_bit(x, &ip->i_flags))
printk(" %u", x); printk(" %u", x);
printk(" \n"); printk(" \n");
printk(KERN_INFO " vnode = %s\n", (ip->i_vnode) ? "yes" : "no");
error = 0; error = 0;
+1 -4
View File
@@ -88,9 +88,6 @@ void gfs2_holder_uninit(struct gfs2_holder *gh);
void gfs2_glock_xmote_th(struct gfs2_glock *gl, unsigned int state, int flags); void gfs2_glock_xmote_th(struct gfs2_glock *gl, unsigned int state, int flags);
void gfs2_glock_drop_th(struct gfs2_glock *gl); void gfs2_glock_drop_th(struct gfs2_glock *gl);
void gfs2_glmutex_lock(struct gfs2_glock *gl);
void gfs2_glmutex_unlock(struct gfs2_glock *gl);
int gfs2_glock_nq(struct gfs2_holder *gh); int gfs2_glock_nq(struct gfs2_holder *gh);
int gfs2_glock_poll(struct gfs2_holder *gh); int gfs2_glock_poll(struct gfs2_holder *gh);
int gfs2_glock_wait(struct gfs2_holder *gh); int gfs2_glock_wait(struct gfs2_holder *gh);
@@ -110,6 +107,7 @@ void gfs2_glock_dq_uninit_m(unsigned int num_gh, struct gfs2_holder *ghs);
void gfs2_glock_prefetch_num(struct gfs2_sbd *sdp, uint64_t number, void gfs2_glock_prefetch_num(struct gfs2_sbd *sdp, uint64_t number,
struct gfs2_glock_operations *glops, struct gfs2_glock_operations *glops,
unsigned int state, int flags); unsigned int state, int flags);
void gfs2_glock_inode_squish(struct inode *inode);
/** /**
* gfs2_glock_nq_init - intialize a holder and enqueue it on a glock * gfs2_glock_nq_init - intialize a holder and enqueue it on a glock
@@ -143,7 +141,6 @@ void gfs2_lvb_unhold(struct gfs2_glock *gl);
void gfs2_glock_cb(lm_fsdata_t *fsdata, unsigned int type, void *data); void gfs2_glock_cb(lm_fsdata_t *fsdata, unsigned int type, void *data);
void gfs2_try_toss_inode(struct gfs2_sbd *sdp, struct gfs2_inum *inum);
void gfs2_iopen_go_callback(struct gfs2_glock *gl, unsigned int state); void gfs2_iopen_go_callback(struct gfs2_glock *gl, unsigned int state);
void gfs2_glock_schedule_for_reclaim(struct gfs2_glock *gl); void gfs2_glock_schedule_for_reclaim(struct gfs2_glock *gl);
+6 -3
View File
@@ -129,6 +129,7 @@ static void inode_go_xmote_bh(struct gfs2_glock *gl)
static void inode_go_drop_th(struct gfs2_glock *gl) static void inode_go_drop_th(struct gfs2_glock *gl)
{ {
printk(KERN_INFO "drop th %p\n", gl->gl_object);
gfs2_pte_inval(gl); gfs2_pte_inval(gl);
gfs2_glock_drop_th(gl); gfs2_glock_drop_th(gl);
} }
@@ -147,6 +148,7 @@ static void inode_go_sync(struct gfs2_glock *gl, int flags)
if (test_bit(GLF_DIRTY, &gl->gl_flags)) { if (test_bit(GLF_DIRTY, &gl->gl_flags)) {
if (meta && data) { if (meta && data) {
printk(KERN_INFO "sync all\n");
gfs2_page_sync(gl, flags | DIO_START); gfs2_page_sync(gl, flags | DIO_START);
gfs2_log_flush(gl->gl_sbd, gl); gfs2_log_flush(gl->gl_sbd, gl);
gfs2_meta_sync(gl, flags | DIO_START | DIO_WAIT); gfs2_meta_sync(gl, flags | DIO_START | DIO_WAIT);
@@ -224,6 +226,7 @@ static int inode_go_lock(struct gfs2_holder *gh)
return 0; return 0;
if (ip->i_vn != gl->gl_vn) { if (ip->i_vn != gl->gl_vn) {
printk(KERN_INFO "refresh inode %p\n", &ip->i_inode);
error = gfs2_inode_refresh(ip); error = gfs2_inode_refresh(ip);
if (error) if (error)
return error; return error;
@@ -288,7 +291,7 @@ static void inode_greedy(struct gfs2_glock *gl)
spin_unlock(&ip->i_spin); spin_unlock(&ip->i_spin);
gfs2_inode_put(ip); iput(&ip->i_inode);
} }
/** /**
@@ -361,14 +364,14 @@ static void trans_go_xmote_th(struct gfs2_glock *gl, unsigned int state,
static void trans_go_xmote_bh(struct gfs2_glock *gl) static void trans_go_xmote_bh(struct gfs2_glock *gl)
{ {
struct gfs2_sbd *sdp = gl->gl_sbd; struct gfs2_sbd *sdp = gl->gl_sbd;
struct gfs2_inode *ip = sdp->sd_jdesc->jd_inode->u.generic_ip; struct gfs2_inode *ip = GFS2_I(sdp->sd_jdesc->jd_inode);
struct gfs2_glock *j_gl = ip->i_gl; struct gfs2_glock *j_gl = ip->i_gl;
struct gfs2_log_header head; struct gfs2_log_header head;
int error; int error;
if (gl->gl_state != LM_ST_UNLOCKED && if (gl->gl_state != LM_ST_UNLOCKED &&
test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) { test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) {
gfs2_meta_cache_flush(sdp->sd_jdesc->jd_inode->u.generic_ip); gfs2_meta_cache_flush(GFS2_I(sdp->sd_jdesc->jd_inode));
j_gl->gl_ops->go_inval(j_gl, DIO_METADATA | DIO_DATA); j_gl->gl_ops->go_inval(j_gl, DIO_METADATA | DIO_DATA);
error = gfs2_find_jhead(sdp->sd_jdesc, &head); error = gfs2_find_jhead(sdp->sd_jdesc, &head);
+12 -36
View File
@@ -33,7 +33,6 @@ struct gfs2_inode;
struct gfs2_file; struct gfs2_file;
struct gfs2_revoke; struct gfs2_revoke;
struct gfs2_revoke_replay; struct gfs2_revoke_replay;
struct gfs2_unlinked;
struct gfs2_quota_data; struct gfs2_quota_data;
struct gfs2_log_buf; struct gfs2_log_buf;
struct gfs2_trans; struct gfs2_trans;
@@ -245,16 +244,12 @@ struct gfs2_inode {
struct inode i_inode; struct inode i_inode;
struct gfs2_inum i_num; struct gfs2_inum i_num;
atomic_t i_count;
unsigned long i_flags; /* GIF_... */ unsigned long i_flags; /* GIF_... */
uint64_t i_vn; uint64_t i_vn;
struct gfs2_dinode i_di; struct gfs2_dinode i_di; /* To be replaced by ref to block */
struct gfs2_glock *i_gl;
struct gfs2_sbd *i_sbd;
struct inode *i_vnode;
struct gfs2_glock *i_gl; /* Move into i_gh? */
struct gfs2_holder i_iopen_gh; struct gfs2_holder i_iopen_gh;
struct gfs2_holder i_gh; /* for prepare/commit_write only */ struct gfs2_holder i_gh; /* for prepare/commit_write only */
struct gfs2_alloc i_alloc; struct gfs2_alloc i_alloc;
@@ -262,18 +257,27 @@ struct gfs2_inode {
spinlock_t i_spin; spinlock_t i_spin;
struct rw_semaphore i_rw_mutex; struct rw_semaphore i_rw_mutex;
unsigned int i_greedy; unsigned int i_greedy;
unsigned long i_last_pfault; unsigned long i_last_pfault;
struct buffer_head *i_cache[GFS2_MAX_META_HEIGHT]; struct buffer_head *i_cache[GFS2_MAX_META_HEIGHT];
}; };
/*
* Since i_inode is the first element of struct gfs2_inode,
* this is effectively a cast.
*/
static inline struct gfs2_inode *GFS2_I(struct inode *inode) static inline struct gfs2_inode *GFS2_I(struct inode *inode)
{ {
return container_of(inode, struct gfs2_inode, i_inode); return container_of(inode, struct gfs2_inode, i_inode);
} }
/* To be removed? */
static inline struct gfs2_sbd *GFS2_SB(struct inode *inode)
{
return inode->i_sb->s_fs_info;
}
enum { enum {
GFF_DID_DIRECT_ALLOC = 0, GFF_DID_DIRECT_ALLOC = 0,
}; };
@@ -295,18 +299,6 @@ struct gfs2_revoke_replay {
unsigned int rr_where; unsigned int rr_where;
}; };
enum {
ULF_LOCKED = 0,
};
struct gfs2_unlinked {
struct list_head ul_list;
unsigned int ul_count;
struct gfs2_unlinked_tag ul_ut;
unsigned long ul_flags; /* ULF_... */
unsigned int ul_slot;
};
enum { enum {
QDF_USER = 0, QDF_USER = 0,
QDF_CHANGE = 1, QDF_CHANGE = 1,
@@ -436,7 +428,6 @@ struct gfs2_tune {
unsigned int gt_recoverd_secs; unsigned int gt_recoverd_secs;
unsigned int gt_logd_secs; unsigned int gt_logd_secs;
unsigned int gt_quotad_secs; unsigned int gt_quotad_secs;
unsigned int gt_inoded_secs;
unsigned int gt_quota_simul_sync; /* Max quotavals to sync at once */ unsigned int gt_quota_simul_sync; /* Max quotavals to sync at once */
unsigned int gt_quota_warn_period; /* Secs between quota warn msgs */ unsigned int gt_quota_warn_period; /* Secs between quota warn msgs */
@@ -495,7 +486,6 @@ struct gfs2_sbd {
uint32_t sd_hash_bsize; /* sizeof(exhash block) */ uint32_t sd_hash_bsize; /* sizeof(exhash block) */
uint32_t sd_hash_bsize_shift; uint32_t sd_hash_bsize_shift;
uint32_t sd_hash_ptrs; /* Number of pointers in a hash block */ uint32_t sd_hash_ptrs; /* Number of pointers in a hash block */
uint32_t sd_ut_per_block;
uint32_t sd_qc_per_block; uint32_t sd_qc_per_block;
uint32_t sd_max_dirres; /* Max blocks needed to add a directory entry */ uint32_t sd_max_dirres; /* Max blocks needed to add a directory entry */
uint32_t sd_max_height; /* Max height of a file's metadata tree */ uint32_t sd_max_height; /* Max height of a file's metadata tree */
@@ -527,7 +517,6 @@ struct gfs2_sbd {
struct inode *sd_statfs_inode; struct inode *sd_statfs_inode;
struct inode *sd_ir_inode; struct inode *sd_ir_inode;
struct inode *sd_sc_inode; struct inode *sd_sc_inode;
struct inode *sd_ut_inode;
struct inode *sd_qc_inode; struct inode *sd_qc_inode;
struct inode *sd_rindex; struct inode *sd_rindex;
struct inode *sd_quota_inode; struct inode *sd_quota_inode;
@@ -569,7 +558,6 @@ struct gfs2_sbd {
struct gfs2_holder sd_ir_gh; struct gfs2_holder sd_ir_gh;
struct gfs2_holder sd_sc_gh; struct gfs2_holder sd_sc_gh;
struct gfs2_holder sd_ut_gh;
struct gfs2_holder sd_qc_gh; struct gfs2_holder sd_qc_gh;
/* Daemon stuff */ /* Daemon stuff */
@@ -578,21 +566,9 @@ struct gfs2_sbd {
struct task_struct *sd_recoverd_process; struct task_struct *sd_recoverd_process;
struct task_struct *sd_logd_process; struct task_struct *sd_logd_process;
struct task_struct *sd_quotad_process; struct task_struct *sd_quotad_process;
struct task_struct *sd_inoded_process;
struct task_struct *sd_glockd_process[GFS2_GLOCKD_MAX]; struct task_struct *sd_glockd_process[GFS2_GLOCKD_MAX];
unsigned int sd_glockd_num; unsigned int sd_glockd_num;
/* Unlinked inode stuff */
struct list_head sd_unlinked_list;
atomic_t sd_unlinked_count;
spinlock_t sd_unlinked_spin;
struct mutex sd_unlinked_mutex;
unsigned int sd_unlinked_slots;
unsigned int sd_unlinked_chunks;
unsigned char **sd_unlinked_bitmap;
/* Quota stuff */ /* Quota stuff */
struct list_head sd_quota_list; struct list_head sd_quota_list;
+180 -637
View File
File diff suppressed because it is too large Load Diff
+9 -23
View File
@@ -27,32 +27,20 @@ static inline int gfs2_is_dir(struct gfs2_inode *ip)
void gfs2_inode_attr_in(struct gfs2_inode *ip); void gfs2_inode_attr_in(struct gfs2_inode *ip);
void gfs2_inode_attr_out(struct gfs2_inode *ip); void gfs2_inode_attr_out(struct gfs2_inode *ip);
struct inode *gfs2_ip2v_lookup(struct gfs2_inode *ip); struct inode *gfs2_inode_lookup(struct super_block *sb, struct gfs2_inum *inum, unsigned type);
struct inode *gfs2_ip2v(struct gfs2_inode *ip); struct inode *gfs2_ilookup(struct super_block *sb, struct gfs2_inum *inum);
struct inode *gfs2_iget(struct super_block *sb, struct gfs2_inum *inum);
void gfs2_inode_min_init(struct gfs2_inode *ip, unsigned int type);
int gfs2_inode_refresh(struct gfs2_inode *ip); int gfs2_inode_refresh(struct gfs2_inode *ip);
int gfs2_inode_get(struct gfs2_glock *i_gl, int gfs2_dinode_dealloc(struct gfs2_inode *inode);
const struct gfs2_inum *inum, int create,
struct gfs2_inode **ipp);
void gfs2_inode_hold(struct gfs2_inode *ip);
void gfs2_inode_put(struct gfs2_inode *ip);
void gfs2_inode_destroy(struct gfs2_inode *ip, int unlock);
int gfs2_inode_dealloc(struct gfs2_sbd *sdp, struct gfs2_unlinked *ul);
int gfs2_change_nlink(struct gfs2_inode *ip, int diff); int gfs2_change_nlink(struct gfs2_inode *ip, int diff);
struct inode *gfs2_lookupi(struct inode *dir, struct qstr *name, int is_root, struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
struct nameidata *nd); int is_root, struct nameidata *nd);
struct inode *gfs2_createi(struct gfs2_holder *ghs, struct qstr *name, struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name,
unsigned int mode); unsigned int mode);
int gfs2_unlinki(struct gfs2_inode *dip, struct qstr *name, int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name,
struct gfs2_inode *ip, struct gfs2_unlinked *ul); struct gfs2_inode *ip);
int gfs2_rmdiri(struct gfs2_inode *dip, struct qstr *name, int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
struct gfs2_inode *ip, struct gfs2_unlinked *ul);
int gfs2_unlink_ok(struct gfs2_inode *dip, struct qstr *name,
struct gfs2_inode *ip); struct gfs2_inode *ip);
int gfs2_ok_to_move(struct gfs2_inode *this, struct gfs2_inode *to); int gfs2_ok_to_move(struct gfs2_inode *this, struct gfs2_inode *to);
int gfs2_readlinki(struct gfs2_inode *ip, char **buf, unsigned int *len); int gfs2_readlinki(struct gfs2_inode *ip, char **buf, unsigned int *len);
@@ -60,8 +48,6 @@ int gfs2_readlinki(struct gfs2_inode *ip, char **buf, unsigned int *len);
int gfs2_glock_nq_atime(struct gfs2_holder *gh); int gfs2_glock_nq_atime(struct gfs2_holder *gh);
int gfs2_glock_nq_m_atime(unsigned int num_gh, struct gfs2_holder *ghs); int gfs2_glock_nq_m_atime(unsigned int num_gh, struct gfs2_holder *ghs);
void gfs2_try_toss_vnode(struct gfs2_inode *ip);
int gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr); int gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr);
int gfs2_repermission(struct inode *inode, int mask, struct nameidata *nd); int gfs2_repermission(struct inode *inode, int mask, struct nameidata *nd);
+3
View File
@@ -213,6 +213,9 @@ static uint64_t log_bmap(struct gfs2_sbd *sdp, unsigned int lbn)
int bdy; int bdy;
error = gfs2_block_map(sdp->sd_jdesc->jd_inode, lbn, &new, &dbn, &bdy); error = gfs2_block_map(sdp->sd_jdesc->jd_inode, lbn, &new, &dbn, &bdy);
if (!(!error && dbn)) {
printk(KERN_INFO "error=%d, dbn=%llu lbn=%u", error, dbn, lbn);
}
gfs2_assert_withdraw(sdp, !error && dbn); gfs2_assert_withdraw(sdp, !error && dbn);
return dbn; return dbn;
+13 -17
View File
@@ -184,8 +184,7 @@ static void buf_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
static void buf_lo_before_scan(struct gfs2_jdesc *jd, static void buf_lo_before_scan(struct gfs2_jdesc *jd,
struct gfs2_log_header *head, int pass) struct gfs2_log_header *head, int pass)
{ {
struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
struct gfs2_sbd *sdp = ip->i_sbd;
if (pass != 0) if (pass != 0)
return; return;
@@ -198,8 +197,8 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
struct gfs2_log_descriptor *ld, __be64 *ptr, struct gfs2_log_descriptor *ld, __be64 *ptr,
int pass) int pass)
{ {
struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
struct gfs2_glock *gl = ip->i_gl; struct gfs2_glock *gl = ip->i_gl;
unsigned int blks = be32_to_cpu(ld->ld_data1); unsigned int blks = be32_to_cpu(ld->ld_data1);
struct buffer_head *bh_log, *bh_ip; struct buffer_head *bh_log, *bh_ip;
@@ -245,8 +244,8 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
{ {
struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
if (error) { if (error) {
gfs2_meta_sync(ip->i_gl, gfs2_meta_sync(ip->i_gl,
@@ -332,8 +331,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp)
static void revoke_lo_before_scan(struct gfs2_jdesc *jd, static void revoke_lo_before_scan(struct gfs2_jdesc *jd,
struct gfs2_log_header *head, int pass) struct gfs2_log_header *head, int pass)
{ {
struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
struct gfs2_sbd *sdp = ip->i_sbd;
if (pass != 0) if (pass != 0)
return; return;
@@ -346,8 +344,7 @@ static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
struct gfs2_log_descriptor *ld, __be64 *ptr, struct gfs2_log_descriptor *ld, __be64 *ptr,
int pass) int pass)
{ {
struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
struct gfs2_sbd *sdp = ip->i_sbd;
unsigned int blks = be32_to_cpu(ld->ld_length); unsigned int blks = be32_to_cpu(ld->ld_length);
unsigned int revokes = be32_to_cpu(ld->ld_data1); unsigned int revokes = be32_to_cpu(ld->ld_data1);
struct buffer_head *bh; struct buffer_head *bh;
@@ -393,8 +390,7 @@ static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
static void revoke_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) static void revoke_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
{ {
struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
struct gfs2_sbd *sdp = ip->i_sbd;
if (error) { if (error) {
gfs2_revoke_clean(sdp); gfs2_revoke_clean(sdp);
@@ -465,7 +461,7 @@ static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
struct gfs2_bufdata *bd = container_of(le, struct gfs2_bufdata, bd_le); struct gfs2_bufdata *bd = container_of(le, struct gfs2_bufdata, bd_le);
struct gfs2_trans *tr = current->journal_info; struct gfs2_trans *tr = current->journal_info;
struct address_space *mapping = bd->bd_bh->b_page->mapping; struct address_space *mapping = bd->bd_bh->b_page->mapping;
struct gfs2_inode *ip = mapping->host->u.generic_ip; struct gfs2_inode *ip = GFS2_I(mapping->host);
tr->tr_touched = 1; tr->tr_touched = 1;
if (!list_empty(&bd->bd_list_tr) && if (!list_empty(&bd->bd_list_tr) &&
@@ -665,8 +661,8 @@ static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
struct gfs2_log_descriptor *ld, struct gfs2_log_descriptor *ld,
__be64 *ptr, int pass) __be64 *ptr, int pass)
{ {
struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
struct gfs2_glock *gl = ip->i_gl; struct gfs2_glock *gl = ip->i_gl;
unsigned int blks = be32_to_cpu(ld->ld_data1); unsigned int blks = be32_to_cpu(ld->ld_data1);
struct buffer_head *bh_log, *bh_ip; struct buffer_head *bh_log, *bh_ip;
@@ -716,8 +712,8 @@ static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
static void databuf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) static void databuf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
{ {
struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
if (error) { if (error) {
gfs2_meta_sync(ip->i_gl, gfs2_meta_sync(ip->i_gl,
-2
View File
@@ -29,8 +29,6 @@ static void gfs2_init_inode_once(void *foo, kmem_cache_t *cachep, unsigned long
if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
SLAB_CTOR_CONSTRUCTOR) { SLAB_CTOR_CONSTRUCTOR) {
inode_init_once(&ip->i_inode); inode_init_once(&ip->i_inode);
atomic_set(&ip->i_count, 0);
ip->i_vnode = &ip->i_inode;
spin_lock_init(&ip->i_spin); spin_lock_init(&ip->i_spin);
init_rwsem(&ip->i_rw_mutex); init_rwsem(&ip->i_rw_mutex);
memset(ip->i_cache, 0, sizeof(ip->i_cache)); memset(ip->i_cache, 0, sizeof(ip->i_cache));
+4 -8
View File
@@ -91,9 +91,6 @@ static void stuck_releasepage(struct buffer_head *bh)
fs_warn(sdp, "ip = %llu %llu\n", fs_warn(sdp, "ip = %llu %llu\n",
(unsigned long long)ip->i_num.no_formal_ino, (unsigned long long)ip->i_num.no_formal_ino,
(unsigned long long)ip->i_num.no_addr); (unsigned long long)ip->i_num.no_addr);
fs_warn(sdp, "ip->i_count = %d, ip->i_vnode = %s\n",
atomic_read(&ip->i_count),
(ip->i_vnode) ? "!NULL" : "NULL");
for (x = 0; x < GFS2_MAX_META_HEIGHT; x++) for (x = 0; x < GFS2_MAX_META_HEIGHT; x++)
fs_warn(sdp, "ip->i_cache[%u] = %s\n", fs_warn(sdp, "ip->i_cache[%u] = %s\n",
@@ -567,7 +564,6 @@ void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh,
bd = kmem_cache_alloc(gfs2_bufdata_cachep, GFP_NOFS | __GFP_NOFAIL), bd = kmem_cache_alloc(gfs2_bufdata_cachep, GFP_NOFS | __GFP_NOFAIL),
memset(bd, 0, sizeof(struct gfs2_bufdata)); memset(bd, 0, sizeof(struct gfs2_bufdata));
bd->bd_bh = bh; bd->bd_bh = bh;
bd->bd_gl = gl; bd->bd_gl = gl;
@@ -664,7 +660,7 @@ void gfs2_unpin(struct gfs2_sbd *sdp, struct buffer_head *bh,
void gfs2_meta_wipe(struct gfs2_inode *ip, uint64_t bstart, uint32_t blen) void gfs2_meta_wipe(struct gfs2_inode *ip, uint64_t bstart, uint32_t blen)
{ {
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct inode *aspace = ip->i_gl->gl_aspace; struct inode *aspace = ip->i_gl->gl_aspace;
struct buffer_head *bh; struct buffer_head *bh;
@@ -770,7 +766,7 @@ int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, uint64_t num,
if (new) if (new)
meta_prep_new(bh); meta_prep_new(bh);
else { else {
error = gfs2_meta_reread(ip->i_sbd, bh, error = gfs2_meta_reread(GFS2_SB(&ip->i_inode), bh,
DIO_START | DIO_WAIT); DIO_START | DIO_WAIT);
if (error) { if (error) {
brelse(bh); brelse(bh);
@@ -797,7 +793,7 @@ int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, uint64_t num,
} }
if (new) { if (new) {
if (gfs2_assert_warn(ip->i_sbd, height)) { if (gfs2_assert_warn(GFS2_SB(&ip->i_inode), height)) {
brelse(bh); brelse(bh);
return -EIO; return -EIO;
} }
@@ -805,7 +801,7 @@ int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, uint64_t num,
gfs2_metatype_set(bh, GFS2_METATYPE_IN, GFS2_FORMAT_IN); gfs2_metatype_set(bh, GFS2_METATYPE_IN, GFS2_FORMAT_IN);
gfs2_buffer_clear_tail(bh, sizeof(struct gfs2_meta_header)); gfs2_buffer_clear_tail(bh, sizeof(struct gfs2_meta_header));
} else if (gfs2_metatype_check(ip->i_sbd, bh, } else if (gfs2_metatype_check(GFS2_SB(&ip->i_inode), bh,
(height) ? GFS2_METATYPE_IN : GFS2_METATYPE_DI)) { (height) ? GFS2_METATYPE_IN : GFS2_METATYPE_DI)) {
brelse(bh); brelse(bh);
return -EIO; return -EIO;
-17
View File
@@ -293,23 +293,6 @@ void gfs2_statfs_change_out(struct gfs2_statfs_change *sc, char *buf)
str->sc_dinodes = cpu_to_be64(sc->sc_dinodes); str->sc_dinodes = cpu_to_be64(sc->sc_dinodes);
} }
void gfs2_unlinked_tag_in(struct gfs2_unlinked_tag *ut, char *buf)
{
struct gfs2_unlinked_tag *str = (struct gfs2_unlinked_tag *)buf;
gfs2_inum_in(&ut->ut_inum, buf);
ut->ut_flags = be32_to_cpu(str->ut_flags);
}
void gfs2_unlinked_tag_out(struct gfs2_unlinked_tag *ut, char *buf)
{
struct gfs2_unlinked_tag *str = (struct gfs2_unlinked_tag *)buf;
gfs2_inum_out(&ut->ut_inum, buf);
str->ut_flags = cpu_to_be32(ut->ut_flags);
str->__pad = 0;
}
void gfs2_quota_change_in(struct gfs2_quota_change *qc, char *buf) void gfs2_quota_change_in(struct gfs2_quota_change *qc, char *buf)
{ {
struct gfs2_quota_change *str = (struct gfs2_quota_change *)buf; struct gfs2_quota_change *str = (struct gfs2_quota_change *)buf;
+15 -16
View File
@@ -81,7 +81,6 @@ int gfs2_get_block(struct inode *inode, sector_t lblock,
static int get_block_noalloc(struct inode *inode, sector_t lblock, static int get_block_noalloc(struct inode *inode, sector_t lblock,
struct buffer_head *bh_result, int create) struct buffer_head *bh_result, int create)
{ {
struct gfs2_inode *ip = inode->u.generic_ip;
int new = 0; int new = 0;
uint64_t dblock; uint64_t dblock;
int error; int error;
@@ -93,7 +92,7 @@ static int get_block_noalloc(struct inode *inode, sector_t lblock,
if (dblock) if (dblock)
map_bh(bh_result, inode->i_sb, dblock); map_bh(bh_result, inode->i_sb, dblock);
else if (gfs2_assert_withdraw(ip->i_sbd, !create)) else if (gfs2_assert_withdraw(GFS2_SB(inode), !create))
error = -EIO; error = -EIO;
if (boundary) if (boundary)
set_buffer_boundary(bh_result); set_buffer_boundary(bh_result);
@@ -114,8 +113,8 @@ static int get_block_noalloc(struct inode *inode, sector_t lblock,
static int gfs2_writepage(struct page *page, struct writeback_control *wbc) static int gfs2_writepage(struct page *page, struct writeback_control *wbc)
{ {
struct inode *inode = page->mapping->host; struct inode *inode = page->mapping->host;
struct gfs2_inode *ip = page->mapping->host->u.generic_ip; struct gfs2_inode *ip = GFS2_I(page->mapping->host);
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(page->mapping->host);
loff_t i_size = i_size_read(inode); loff_t i_size = i_size_read(inode);
pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT; pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT;
unsigned offset; unsigned offset;
@@ -216,8 +215,8 @@ static int stuffed_readpage(struct gfs2_inode *ip, struct page *page)
static int gfs2_readpage(struct file *file, struct page *page) static int gfs2_readpage(struct file *file, struct page *page)
{ {
struct gfs2_inode *ip = page->mapping->host->u.generic_ip; struct gfs2_inode *ip = GFS2_I(page->mapping->host);
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(page->mapping->host);
struct gfs2_holder gh; struct gfs2_holder gh;
int error; int error;
@@ -271,8 +270,8 @@ static int gfs2_readpages(struct file *file, struct address_space *mapping,
struct list_head *pages, unsigned nr_pages) struct list_head *pages, unsigned nr_pages)
{ {
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
struct gfs2_inode *ip = inode->u.generic_ip; struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(inode);
struct gfs2_holder gh; struct gfs2_holder gh;
unsigned page_idx; unsigned page_idx;
int ret; int ret;
@@ -345,8 +344,8 @@ out_unlock:
static int gfs2_prepare_write(struct file *file, struct page *page, static int gfs2_prepare_write(struct file *file, struct page *page,
unsigned from, unsigned to) unsigned from, unsigned to)
{ {
struct gfs2_inode *ip = page->mapping->host->u.generic_ip; struct gfs2_inode *ip = GFS2_I(page->mapping->host);
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(page->mapping->host);
unsigned int data_blocks, ind_blocks, rblocks; unsigned int data_blocks, ind_blocks, rblocks;
int alloc_required; int alloc_required;
int error = 0; int error = 0;
@@ -440,8 +439,8 @@ static int gfs2_commit_write(struct file *file, struct page *page,
unsigned from, unsigned to) unsigned from, unsigned to)
{ {
struct inode *inode = page->mapping->host; struct inode *inode = page->mapping->host;
struct gfs2_inode *ip = inode->u.generic_ip; struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(inode);
int error = -EOPNOTSUPP; int error = -EOPNOTSUPP;
struct buffer_head *dibh; struct buffer_head *dibh;
struct gfs2_alloc *al = &ip->i_alloc;; struct gfs2_alloc *al = &ip->i_alloc;;
@@ -520,7 +519,7 @@ fail_nounlock:
static sector_t gfs2_bmap(struct address_space *mapping, sector_t lblock) static sector_t gfs2_bmap(struct address_space *mapping, sector_t lblock)
{ {
struct gfs2_inode *ip = mapping->host->u.generic_ip; struct gfs2_inode *ip = GFS2_I(mapping->host);
struct gfs2_holder i_gh; struct gfs2_holder i_gh;
sector_t dblock = 0; sector_t dblock = 0;
int error; int error;
@@ -594,7 +593,7 @@ static ssize_t gfs2_direct_IO_write(struct kiocb *iocb, const struct iovec *iov,
{ {
struct file *file = iocb->ki_filp; struct file *file = iocb->ki_filp;
struct inode *inode = file->f_mapping->host; struct inode *inode = file->f_mapping->host;
struct gfs2_inode *ip = inode->u.generic_ip; struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_holder gh; struct gfs2_holder gh;
int rv; int rv;
@@ -641,8 +640,8 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb,
{ {
struct file *file = iocb->ki_filp; struct file *file = iocb->ki_filp;
struct inode *inode = file->f_mapping->host; struct inode *inode = file->f_mapping->host;
struct gfs2_inode *ip = inode->u.generic_ip; struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = GFS2_SB(inode);
if (rw == WRITE) if (rw == WRITE)
return gfs2_direct_IO_write(iocb, iov, offset, nr_segs); return gfs2_direct_IO_write(iocb, iov, offset, nr_segs);

Some files were not shown because too many files have changed in this diff Show More