GFS2: Move glock superblock pointer to field gl_name
What uniquely identifies a glock in the glock hash table is not gl_name, but gl_name and its superblock pointer. This patch makes the gl_name field correspond to a unique glock identifier. That will allow us to simplify hashing with a future patch, since the hash algorithm can then take the gl_name and hash its components in one operation. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Acked-by: Steven Whitehouse <swhiteho@redhat.com>
This commit is contained in:
@@ -32,13 +32,15 @@ struct workqueue_struct *gfs2_freeze_wq;
|
||||
|
||||
static void gfs2_ail_error(struct gfs2_glock *gl, const struct buffer_head *bh)
|
||||
{
|
||||
fs_err(gl->gl_sbd, "AIL buffer %p: blocknr %llu state 0x%08lx mapping %p page state 0x%lx\n",
|
||||
fs_err(gl->gl_name.ln_sbd,
|
||||
"AIL buffer %p: blocknr %llu state 0x%08lx mapping %p page "
|
||||
"state 0x%lx\n",
|
||||
bh, (unsigned long long)bh->b_blocknr, bh->b_state,
|
||||
bh->b_page->mapping, bh->b_page->flags);
|
||||
fs_err(gl->gl_sbd, "AIL glock %u:%llu mapping %p\n",
|
||||
fs_err(gl->gl_name.ln_sbd, "AIL glock %u:%llu mapping %p\n",
|
||||
gl->gl_name.ln_type, gl->gl_name.ln_number,
|
||||
gfs2_glock2aspace(gl));
|
||||
gfs2_lm_withdraw(gl->gl_sbd, "AIL error\n");
|
||||
gfs2_lm_withdraw(gl->gl_name.ln_sbd, "AIL error\n");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,7 +54,7 @@ static void gfs2_ail_error(struct gfs2_glock *gl, const struct buffer_head *bh)
|
||||
static void __gfs2_ail_flush(struct gfs2_glock *gl, bool fsync,
|
||||
unsigned int nr_revokes)
|
||||
{
|
||||
struct gfs2_sbd *sdp = gl->gl_sbd;
|
||||
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
|
||||
struct list_head *head = &gl->gl_ail_list;
|
||||
struct gfs2_bufdata *bd, *tmp;
|
||||
struct buffer_head *bh;
|
||||
@@ -80,7 +82,7 @@ static void __gfs2_ail_flush(struct gfs2_glock *gl, bool fsync,
|
||||
|
||||
static void gfs2_ail_empty_gl(struct gfs2_glock *gl)
|
||||
{
|
||||
struct gfs2_sbd *sdp = gl->gl_sbd;
|
||||
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
|
||||
struct gfs2_trans tr;
|
||||
|
||||
memset(&tr, 0, sizeof(tr));
|
||||
@@ -109,7 +111,7 @@ static void gfs2_ail_empty_gl(struct gfs2_glock *gl)
|
||||
|
||||
void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync)
|
||||
{
|
||||
struct gfs2_sbd *sdp = gl->gl_sbd;
|
||||
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
|
||||
unsigned int revokes = atomic_read(&gl->gl_ail_count);
|
||||
unsigned int max_revokes = (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_log_descriptor)) / sizeof(u64);
|
||||
int ret;
|
||||
@@ -139,7 +141,7 @@ void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync)
|
||||
|
||||
static void rgrp_go_sync(struct gfs2_glock *gl)
|
||||
{
|
||||
struct gfs2_sbd *sdp = gl->gl_sbd;
|
||||
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
|
||||
struct address_space *mapping = &sdp->sd_aspace;
|
||||
struct gfs2_rgrpd *rgd;
|
||||
int error;
|
||||
@@ -179,7 +181,7 @@ static void rgrp_go_sync(struct gfs2_glock *gl)
|
||||
|
||||
static void rgrp_go_inval(struct gfs2_glock *gl, int flags)
|
||||
{
|
||||
struct gfs2_sbd *sdp = gl->gl_sbd;
|
||||
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
|
||||
struct address_space *mapping = &sdp->sd_aspace;
|
||||
struct gfs2_rgrpd *rgd = gl->gl_object;
|
||||
|
||||
@@ -218,7 +220,7 @@ static void inode_go_sync(struct gfs2_glock *gl)
|
||||
|
||||
GLOCK_BUG_ON(gl, gl->gl_state != LM_ST_EXCLUSIVE);
|
||||
|
||||
gfs2_log_flush(gl->gl_sbd, gl, NORMAL_FLUSH);
|
||||
gfs2_log_flush(gl->gl_name.ln_sbd, gl, NORMAL_FLUSH);
|
||||
filemap_fdatawrite(metamapping);
|
||||
if (ip) {
|
||||
struct address_space *mapping = ip->i_inode.i_mapping;
|
||||
@@ -252,7 +254,7 @@ static void inode_go_inval(struct gfs2_glock *gl, int flags)
|
||||
{
|
||||
struct gfs2_inode *ip = gl->gl_object;
|
||||
|
||||
gfs2_assert_withdraw(gl->gl_sbd, !atomic_read(&gl->gl_ail_count));
|
||||
gfs2_assert_withdraw(gl->gl_name.ln_sbd, !atomic_read(&gl->gl_ail_count));
|
||||
|
||||
if (flags & DIO_METADATA) {
|
||||
struct address_space *mapping = gfs2_glock2aspace(gl);
|
||||
@@ -264,9 +266,9 @@ static void inode_go_inval(struct gfs2_glock *gl, int flags)
|
||||
}
|
||||
}
|
||||
|
||||
if (ip == GFS2_I(gl->gl_sbd->sd_rindex)) {
|
||||
gfs2_log_flush(gl->gl_sbd, NULL, NORMAL_FLUSH);
|
||||
gl->gl_sbd->sd_rindex_uptodate = 0;
|
||||
if (ip == GFS2_I(gl->gl_name.ln_sbd->sd_rindex)) {
|
||||
gfs2_log_flush(gl->gl_name.ln_sbd, NULL, NORMAL_FLUSH);
|
||||
gl->gl_name.ln_sbd->sd_rindex_uptodate = 0;
|
||||
}
|
||||
if (ip && S_ISREG(ip->i_inode.i_mode))
|
||||
truncate_inode_pages(ip->i_inode.i_mapping, 0);
|
||||
@@ -281,7 +283,7 @@ static void inode_go_inval(struct gfs2_glock *gl, int flags)
|
||||
|
||||
static int inode_go_demote_ok(const struct gfs2_glock *gl)
|
||||
{
|
||||
struct gfs2_sbd *sdp = gl->gl_sbd;
|
||||
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
|
||||
struct gfs2_holder *gh;
|
||||
|
||||
if (sdp->sd_jindex == gl->gl_object || sdp->sd_rindex == gl->gl_object)
|
||||
@@ -416,7 +418,7 @@ int gfs2_inode_refresh(struct gfs2_inode *ip)
|
||||
static int inode_go_lock(struct gfs2_holder *gh)
|
||||
{
|
||||
struct gfs2_glock *gl = gh->gh_gl;
|
||||
struct gfs2_sbd *sdp = gl->gl_sbd;
|
||||
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
|
||||
struct gfs2_inode *ip = gl->gl_object;
|
||||
int error = 0;
|
||||
|
||||
@@ -477,7 +479,7 @@ static void inode_go_dump(struct seq_file *seq, const struct gfs2_glock *gl)
|
||||
static void freeze_go_sync(struct gfs2_glock *gl)
|
||||
{
|
||||
int error = 0;
|
||||
struct gfs2_sbd *sdp = gl->gl_sbd;
|
||||
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
|
||||
|
||||
if (gl->gl_state == LM_ST_SHARED &&
|
||||
test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) {
|
||||
@@ -500,7 +502,7 @@ static void freeze_go_sync(struct gfs2_glock *gl)
|
||||
|
||||
static int freeze_go_xmote_bh(struct gfs2_glock *gl, struct gfs2_holder *gh)
|
||||
{
|
||||
struct gfs2_sbd *sdp = gl->gl_sbd;
|
||||
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
|
||||
struct gfs2_inode *ip = GFS2_I(sdp->sd_jdesc->jd_inode);
|
||||
struct gfs2_glock *j_gl = ip->i_gl;
|
||||
struct gfs2_log_header_host head;
|
||||
@@ -545,7 +547,7 @@ static int freeze_go_demote_ok(const struct gfs2_glock *gl)
|
||||
static void iopen_go_callback(struct gfs2_glock *gl, bool remote)
|
||||
{
|
||||
struct gfs2_inode *ip = (struct gfs2_inode *)gl->gl_object;
|
||||
struct gfs2_sbd *sdp = gl->gl_sbd;
|
||||
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
|
||||
|
||||
if (!remote || (sdp->sd_vfs->s_flags & MS_RDONLY))
|
||||
return;
|
||||
|
Reference in New Issue
Block a user