Commit feaa7bba authored by Steven Whitehouse's avatar Steven Whitehouse

[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's avatarSteven Whitehouse <swhiteho@redhat.com>
parent 22da645f
......@@ -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/
......
......@@ -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;
......
......@@ -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 @@ static struct buffer_head *gfs2_block_pointers(struct inode *inode, u64 lblock,
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;
......
......@@ -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;
}
......@@ -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__ */
This diff is collapsed.
......@@ -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;
......
This diff is collapsed.
......@@ -654,7 +654,7 @@ static void run_queue(struct gfs2_glock *gl)
* 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;
......@@ -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);
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;
restart:
restart:
spin_lock(&gl->gl_spin);
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;
}
out:
out:
spin_unlock(&gl->gl_spin);
if (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
* @gl: the glock
......@@ -1383,8 +1397,7 @@ int gfs2_glock_be_greedy(struct gfs2_glock *gl, unsigned int time)
struct greedy *gr;
struct gfs2_holder *gh;
if (!time ||
gl->gl_sbd->sd_args.ar_localcaching ||
if (!time || gl->gl_sbd->sd_args.ar_localcaching ||
test_and_set_bit(GLF_GREEDY, &gl->gl_flags))
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
* 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)
{
struct gfs2_glock *i_gl;
if (state != LM_ST_UNLOCKED)
return;
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);
/* FIXME: remove this? */
}
/**
......@@ -1935,11 +1887,6 @@ void gfs2_reclaim_glock(struct gfs2_sbd *sdp)
atomic_inc(&sdp->sd_reclaimed);
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) &&
gl->gl_state != LM_ST_UNLOCKED &&
demote_ok(gl))
......@@ -2018,7 +1965,7 @@ static void scan_glock(struct gfs2_glock *gl)
if (gfs2_glmutex_trylock(gl)) {
if (gl->gl_ops == &gfs2_inode_glops) {
struct gfs2_inode *ip = gl->gl_object;
if (ip && !atomic_read(&ip->i_count))
if (ip)
goto out_schedule;
}
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 (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) &&
gl->gl_state != 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_addr);
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 =");
for (x = 0; x < 32; x++)
if (test_bit(x, &ip->i_flags))
printk(" %u", x);
printk(" \n");
printk(KERN_INFO " vnode = %s\n", (ip->i_vnode) ? "yes" : "no");
error = 0;
......
......@@ -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_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_poll(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,
struct gfs2_glock_operations *glops,
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
......@@ -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_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_glock_schedule_for_reclaim(struct gfs2_glock *gl);
......
......@@ -129,6 +129,7 @@ static void inode_go_xmote_bh(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_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 (meta && data) {
printk(KERN_INFO "sync all\n");
gfs2_page_sync(gl, flags | DIO_START);
gfs2_log_flush(gl->gl_sbd, gl);
gfs2_meta_sync(gl, flags | DIO_START | DIO_WAIT);
......@@ -224,6 +226,7 @@ static int inode_go_lock(struct gfs2_holder *gh)
return 0;
if (ip->i_vn != gl->gl_vn) {
printk(KERN_INFO "refresh inode %p\n", &ip->i_inode);
error = gfs2_inode_refresh(ip);
if (error)
return error;
......@@ -288,7 +291,7 @@ static void inode_greedy(struct gfs2_glock *gl)
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)
{
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_log_header head;
int error;
if (gl->gl_state != LM_ST_UNLOCKED &&
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);
error = gfs2_find_jhead(sdp->sd_jdesc, &head);
......
......@@ -33,7 +33,6 @@ struct gfs2_inode;
struct gfs2_file;
struct gfs2_revoke;
struct gfs2_revoke_replay;
struct gfs2_unlinked;
struct gfs2_quota_data;
struct gfs2_log_buf;
struct gfs2_trans;
......@@ -245,16 +244,12 @@ struct gfs2_inode {
struct inode i_inode;
struct gfs2_inum i_num;
atomic_t i_count;
unsigned long i_flags; /* GIF_... */
uint64_t i_vn;
struct gfs2_dinode i_di;
struct gfs2_glock *i_gl;
struct gfs2_sbd *i_sbd;
struct inode *i_vnode;
struct gfs2_dinode i_di; /* To be replaced by ref to block */
struct gfs2_glock *i_gl; /* Move into i_gh? */
struct gfs2_holder i_iopen_gh;
struct gfs2_holder i_gh; /* for prepare/commit_write only */
struct gfs2_alloc i_alloc;
......@@ -262,18 +257,27 @@ struct gfs2_inode {
spinlock_t i_spin;
struct rw_semaphore i_rw_mutex;
unsigned int i_greedy;
unsigned long i_last_pfault;
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)
{
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 {
GFF_DID_DIRECT_ALLOC = 0,
};
......@@ -295,18 +299,6 @@ struct gfs2_revoke_replay {
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 {
QDF_USER = 0,
QDF_CHANGE = 1,
......@@ -436,7 +428,6 @@ struct gfs2_tune {
unsigned int gt_recoverd_secs;
unsigned int gt_logd_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_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_shift;
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_max_dirres; /* Max blocks needed to add a directory entry */
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_ir_inode;
struct inode *sd_sc_inode;
struct inode *sd_ut_inode;
struct inode *sd_qc_inode;
struct inode *sd_rindex;
struct inode *sd_quota_inode;
......@@ -569,7 +558,6 @@ struct gfs2_sbd {
struct gfs2_holder sd_ir_gh;
struct gfs2_holder sd_sc_gh;
struct gfs2_holder sd_ut_gh;
struct gfs2_holder sd_qc_gh;
/* Daemon stuff */
......@@ -578,21 +566,9 @@ struct gfs2_sbd {
struct task_struct *sd_recoverd_process;
struct task_struct *sd_logd_process;
struct task_struct *sd_quotad_process;
struct task_struct *sd_inoded_process;
struct task_struct *sd_glockd_process[GFS2_GLOCKD_MAX];
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 */
struct list_head sd_quota_list;
......
This diff is collapsed.
......@@ -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_out(struct gfs2_inode *ip);
struct inode *gfs2_ip2v_lookup(struct gfs2_inode *ip);
struct inode *gfs2_ip2v(struct gfs2_inode *ip);
struct inode *gfs2_iget(struct super_block *sb, struct gfs2_inum *inum);
struct inode *gfs2_inode_lookup(struct super_block *sb,