mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
gfs2: Move gfs2_dinode_dealloc
Move gfs2_dinode_dealloc() and its helper gfs2_final_release_pages() from super.c to inode.c. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
This commit is contained in:
parent
84a79ee68f
commit
bcd18105fb
@ -439,6 +439,74 @@ out:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void gfs2_final_release_pages(struct gfs2_inode *ip)
|
||||||
|
{
|
||||||
|
struct inode *inode = &ip->i_inode;
|
||||||
|
struct gfs2_glock *gl = ip->i_gl;
|
||||||
|
|
||||||
|
if (unlikely(!gl)) {
|
||||||
|
/* This can only happen during incomplete inode creation. */
|
||||||
|
BUG_ON(!test_bit(GIF_ALLOC_FAILED, &ip->i_flags));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
truncate_inode_pages(gfs2_glock2aspace(gl), 0);
|
||||||
|
truncate_inode_pages(&inode->i_data, 0);
|
||||||
|
|
||||||
|
if (atomic_read(&gl->gl_revokes) == 0) {
|
||||||
|
clear_bit(GLF_LFLUSH, &gl->gl_flags);
|
||||||
|
clear_bit(GLF_DIRTY, &gl->gl_flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int gfs2_dinode_dealloc(struct gfs2_inode *ip)
|
||||||
|
{
|
||||||
|
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
|
||||||
|
struct gfs2_rgrpd *rgd;
|
||||||
|
struct gfs2_holder gh;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
if (gfs2_get_inode_blocks(&ip->i_inode) != 1) {
|
||||||
|
gfs2_consist_inode(ip);
|
||||||
|
return -EIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
gfs2_rindex_update(sdp);
|
||||||
|
|
||||||
|
error = gfs2_quota_hold(ip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE);
|
||||||
|
if (error)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
rgd = gfs2_blk2rgrpd(sdp, ip->i_no_addr, 1);
|
||||||
|
if (!rgd) {
|
||||||
|
gfs2_consist_inode(ip);
|
||||||
|
error = -EIO;
|
||||||
|
goto out_qs;
|
||||||
|
}
|
||||||
|
|
||||||
|
error = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE,
|
||||||
|
LM_FLAG_NODE_SCOPE, &gh);
|
||||||
|
if (error)
|
||||||
|
goto out_qs;
|
||||||
|
|
||||||
|
error = gfs2_trans_begin(sdp, RES_RG_BIT + RES_STATFS + RES_QUOTA,
|
||||||
|
sdp->sd_jdesc->jd_blocks);
|
||||||
|
if (error)
|
||||||
|
goto out_rg_gunlock;
|
||||||
|
|
||||||
|
gfs2_free_di(rgd, ip);
|
||||||
|
|
||||||
|
gfs2_final_release_pages(ip);
|
||||||
|
|
||||||
|
gfs2_trans_end(sdp);
|
||||||
|
|
||||||
|
out_rg_gunlock:
|
||||||
|
gfs2_glock_dq_uninit(&gh);
|
||||||
|
out_qs:
|
||||||
|
gfs2_quota_unhold(ip);
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
static void gfs2_init_dir(struct buffer_head *dibh,
|
static void gfs2_init_dir(struct buffer_head *dibh,
|
||||||
const struct gfs2_inode *parent)
|
const struct gfs2_inode *parent)
|
||||||
{
|
{
|
||||||
|
@ -92,6 +92,7 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned type,
|
|||||||
struct inode *gfs2_lookup_by_inum(struct gfs2_sbd *sdp, u64 no_addr,
|
struct inode *gfs2_lookup_by_inum(struct gfs2_sbd *sdp, u64 no_addr,
|
||||||
u64 no_formal_ino,
|
u64 no_formal_ino,
|
||||||
unsigned int blktype);
|
unsigned int blktype);
|
||||||
|
int gfs2_dinode_dealloc(struct gfs2_inode *ip);
|
||||||
|
|
||||||
struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
|
struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
|
||||||
int is_root);
|
int is_root);
|
||||||
|
@ -1173,74 +1173,6 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gfs2_final_release_pages(struct gfs2_inode *ip)
|
|
||||||
{
|
|
||||||
struct inode *inode = &ip->i_inode;
|
|
||||||
struct gfs2_glock *gl = ip->i_gl;
|
|
||||||
|
|
||||||
if (unlikely(!gl)) {
|
|
||||||
/* This can only happen during incomplete inode creation. */
|
|
||||||
BUG_ON(!test_bit(GIF_ALLOC_FAILED, &ip->i_flags));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
truncate_inode_pages(gfs2_glock2aspace(gl), 0);
|
|
||||||
truncate_inode_pages(&inode->i_data, 0);
|
|
||||||
|
|
||||||
if (atomic_read(&gl->gl_revokes) == 0) {
|
|
||||||
clear_bit(GLF_LFLUSH, &gl->gl_flags);
|
|
||||||
clear_bit(GLF_DIRTY, &gl->gl_flags);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int gfs2_dinode_dealloc(struct gfs2_inode *ip)
|
|
||||||
{
|
|
||||||
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
|
|
||||||
struct gfs2_rgrpd *rgd;
|
|
||||||
struct gfs2_holder gh;
|
|
||||||
int error;
|
|
||||||
|
|
||||||
if (gfs2_get_inode_blocks(&ip->i_inode) != 1) {
|
|
||||||
gfs2_consist_inode(ip);
|
|
||||||
return -EIO;
|
|
||||||
}
|
|
||||||
|
|
||||||
gfs2_rindex_update(sdp);
|
|
||||||
|
|
||||||
error = gfs2_quota_hold(ip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE);
|
|
||||||
if (error)
|
|
||||||
return error;
|
|
||||||
|
|
||||||
rgd = gfs2_blk2rgrpd(sdp, ip->i_no_addr, 1);
|
|
||||||
if (!rgd) {
|
|
||||||
gfs2_consist_inode(ip);
|
|
||||||
error = -EIO;
|
|
||||||
goto out_qs;
|
|
||||||
}
|
|
||||||
|
|
||||||
error = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE,
|
|
||||||
LM_FLAG_NODE_SCOPE, &gh);
|
|
||||||
if (error)
|
|
||||||
goto out_qs;
|
|
||||||
|
|
||||||
error = gfs2_trans_begin(sdp, RES_RG_BIT + RES_STATFS + RES_QUOTA,
|
|
||||||
sdp->sd_jdesc->jd_blocks);
|
|
||||||
if (error)
|
|
||||||
goto out_rg_gunlock;
|
|
||||||
|
|
||||||
gfs2_free_di(rgd, ip);
|
|
||||||
|
|
||||||
gfs2_final_release_pages(ip);
|
|
||||||
|
|
||||||
gfs2_trans_end(sdp);
|
|
||||||
|
|
||||||
out_rg_gunlock:
|
|
||||||
gfs2_glock_dq_uninit(&gh);
|
|
||||||
out_qs:
|
|
||||||
gfs2_quota_unhold(ip);
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gfs2_glock_put_eventually
|
* gfs2_glock_put_eventually
|
||||||
* @gl: The glock to put
|
* @gl: The glock to put
|
||||||
|
Loading…
Reference in New Issue
Block a user