mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
gfs2: Eliminate gl_vm
The gfs2_glock structure has a gl_vm member, introduced in commit7005c3e4ae
("GFS2: Use range based functions for rgrp sync/invalidation"), which stores the location of resource groups within their address space. This structure is in a union with iopen glock specific fields. It was introduced because at unmount time, the resource group objects were destroyed before flushing out any pending resource group glock work, and flushing out such work could require flushing / truncating the address space. Since commitb3422cacdd
("gfs2: Rework how rgrp buffer_heads are managed"), any pending resource group glock work is flushed out before destroying the resource group objects. So the resource group objects will now always exist in rgrp_go_sync and rgrp_go_inval, and we now simply compute the gl_vm values where needed instead of caching them. This also eliminates the union. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
This commit is contained in:
parent
2ffed5290b
commit
23cfb0c3d8
@ -178,6 +178,9 @@ static int rgrp_go_sync(struct gfs2_glock *gl)
|
||||
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
|
||||
struct address_space *mapping = &sdp->sd_aspace;
|
||||
struct gfs2_rgrpd *rgd = gfs2_glock2rgrp(gl);
|
||||
const unsigned bsize = sdp->sd_sb.sb_bsize;
|
||||
loff_t start = (rgd->rd_addr * bsize) & PAGE_MASK;
|
||||
loff_t end = PAGE_ALIGN((rgd->rd_addr + rgd->rd_length) * bsize) - 1;
|
||||
int error;
|
||||
|
||||
if (!test_and_clear_bit(GLF_DIRTY, &gl->gl_flags))
|
||||
@ -186,18 +189,13 @@ static int rgrp_go_sync(struct gfs2_glock *gl)
|
||||
|
||||
gfs2_log_flush(sdp, gl, GFS2_LOG_HEAD_FLUSH_NORMAL |
|
||||
GFS2_LFC_RGRP_GO_SYNC);
|
||||
filemap_fdatawrite_range(mapping, gl->gl_vm.start, gl->gl_vm.end);
|
||||
error = filemap_fdatawait_range(mapping, gl->gl_vm.start, gl->gl_vm.end);
|
||||
filemap_fdatawrite_range(mapping, start, end);
|
||||
error = filemap_fdatawait_range(mapping, start, end);
|
||||
WARN_ON_ONCE(error);
|
||||
mapping_set_error(mapping, error);
|
||||
if (!error)
|
||||
error = gfs2_ail_empty_gl(gl);
|
||||
|
||||
spin_lock(&gl->gl_lockref.lock);
|
||||
rgd = gl->gl_object;
|
||||
if (rgd)
|
||||
gfs2_free_clones(rgd);
|
||||
spin_unlock(&gl->gl_lockref.lock);
|
||||
gfs2_free_clones(rgd);
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -216,15 +214,14 @@ static void rgrp_go_inval(struct gfs2_glock *gl, int flags)
|
||||
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
|
||||
struct address_space *mapping = &sdp->sd_aspace;
|
||||
struct gfs2_rgrpd *rgd = gfs2_glock2rgrp(gl);
|
||||
const unsigned bsize = sdp->sd_sb.sb_bsize;
|
||||
loff_t start = (rgd->rd_addr * bsize) & PAGE_MASK;
|
||||
loff_t end = PAGE_ALIGN((rgd->rd_addr + rgd->rd_length) * bsize) - 1;
|
||||
|
||||
if (rgd)
|
||||
gfs2_rgrp_brelse(rgd);
|
||||
|
||||
gfs2_rgrp_brelse(rgd);
|
||||
WARN_ON_ONCE(!(flags & DIO_METADATA));
|
||||
truncate_inode_pages_range(mapping, gl->gl_vm.start, gl->gl_vm.end);
|
||||
|
||||
if (rgd)
|
||||
rgd->rd_flags &= ~GFS2_RDF_UPTODATE;
|
||||
truncate_inode_pages_range(mapping, start, end);
|
||||
rgd->rd_flags &= ~GFS2_RDF_UPTODATE;
|
||||
}
|
||||
|
||||
static void gfs2_rgrp_go_dump(struct seq_file *seq, struct gfs2_glock *gl,
|
||||
|
@ -377,17 +377,10 @@ struct gfs2_glock {
|
||||
atomic_t gl_ail_count;
|
||||
atomic_t gl_revokes;
|
||||
struct delayed_work gl_work;
|
||||
union {
|
||||
/* For iopen glocks only */
|
||||
struct {
|
||||
struct delayed_work gl_delete;
|
||||
u64 gl_no_formal_ino;
|
||||
};
|
||||
/* For rgrp glocks only */
|
||||
struct {
|
||||
loff_t start;
|
||||
loff_t end;
|
||||
} gl_vm;
|
||||
/* For iopen glocks only */
|
||||
struct {
|
||||
struct delayed_work gl_delete;
|
||||
u64 gl_no_formal_ino;
|
||||
};
|
||||
struct rcu_head gl_rcu;
|
||||
struct rhash_head gl_node;
|
||||
|
@ -878,7 +878,6 @@ static int rgd_insert(struct gfs2_rgrpd *rgd)
|
||||
static int read_rindex_entry(struct gfs2_inode *ip)
|
||||
{
|
||||
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
|
||||
const unsigned bsize = sdp->sd_sb.sb_bsize;
|
||||
loff_t pos = sdp->sd_rgrps * sizeof(struct gfs2_rindex);
|
||||
struct gfs2_rindex buf;
|
||||
int error;
|
||||
@ -924,9 +923,6 @@ static int read_rindex_entry(struct gfs2_inode *ip)
|
||||
spin_unlock(&sdp->sd_rindex_spin);
|
||||
if (!error) {
|
||||
glock_set_object(rgd->rd_gl, rgd);
|
||||
rgd->rd_gl->gl_vm.start = (rgd->rd_addr * bsize) & PAGE_MASK;
|
||||
rgd->rd_gl->gl_vm.end = PAGE_ALIGN((rgd->rd_addr +
|
||||
rgd->rd_length) * bsize) - 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user