Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 292393
b: refs/heads/master
c: 6aad1c3
h: refs/heads/master
i:
  292391: 3510a84
v: v3
  • Loading branch information
Bob Peterson authored and Steven Whitehouse committed Mar 5, 2012
1 parent 6ae0a13 commit d5cd12a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a08fd280b58836c910a4af10eee2066e358d16db
refs/heads/master: 6aad1c3d3eba3db38b3a1200e2b02ff3af501c5a
1 change: 0 additions & 1 deletion trunk/fs/gfs2/incore.h
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,6 @@ struct gfs2_sbd {

int sd_rindex_uptodate;
spinlock_t sd_rindex_spin;
struct mutex sd_rindex_mutex;
struct rb_root sd_rindex_tree;
unsigned int sd_rgrps;
unsigned int sd_max_rg_data;
Expand Down
1 change: 0 additions & 1 deletion trunk/fs/gfs2/ops_fstype.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)
spin_lock_init(&sdp->sd_statfs_spin);

spin_lock_init(&sdp->sd_rindex_spin);
mutex_init(&sdp->sd_rindex_mutex);
sdp->sd_rindex_tree.rb_node = NULL;

INIT_LIST_HEAD(&sdp->sd_jindex_list);
Expand Down
22 changes: 10 additions & 12 deletions trunk/fs/gfs2/rgrp.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,6 @@ u64 gfs2_ri_total(struct gfs2_sbd *sdp)
struct file_ra_state ra_state;
int error, rgrps;

mutex_lock(&sdp->sd_rindex_mutex);
file_ra_state_init(&ra_state, inode->i_mapping);
for (rgrps = 0;; rgrps++) {
loff_t pos = rgrps * sizeof(struct gfs2_rindex);
Expand All @@ -553,11 +552,10 @@ u64 gfs2_ri_total(struct gfs2_sbd *sdp)
break;
total_data += be32_to_cpu(((struct gfs2_rindex *)buf)->ri_data);
}
mutex_unlock(&sdp->sd_rindex_mutex);
return total_data;
}

static void rgd_insert(struct gfs2_rgrpd *rgd)
static int rgd_insert(struct gfs2_rgrpd *rgd)
{
struct gfs2_sbd *sdp = rgd->rd_sbd;
struct rb_node **newn = &sdp->sd_rindex_tree.rb_node, *parent = NULL;
Expand All @@ -573,11 +571,13 @@ static void rgd_insert(struct gfs2_rgrpd *rgd)
else if (rgd->rd_addr > cur->rd_addr)
newn = &((*newn)->rb_right);
else
return;
return -EEXIST;
}

rb_link_node(&rgd->rd_node, parent, newn);
rb_insert_color(&rgd->rd_node, &sdp->sd_rindex_tree);
sdp->sd_rgrps++;
return 0;
}

/**
Expand Down Expand Up @@ -631,10 +631,12 @@ static int read_rindex_entry(struct gfs2_inode *ip,
if (rgd->rd_data > sdp->sd_max_rg_data)
sdp->sd_max_rg_data = rgd->rd_data;
spin_lock(&sdp->sd_rindex_spin);
rgd_insert(rgd);
sdp->sd_rgrps++;
error = rgd_insert(rgd);
spin_unlock(&sdp->sd_rindex_spin);
return error;
if (!error)
return 0;

error = 0; /* someone else read in the rgrp; free it and ignore it */

fail:
kfree(rgd->rd_bits);
Expand Down Expand Up @@ -695,22 +697,18 @@ int gfs2_rindex_update(struct gfs2_sbd *sdp)

/* Read new copy from disk if we don't have the latest */
if (!sdp->sd_rindex_uptodate) {
mutex_lock(&sdp->sd_rindex_mutex);
if (!gfs2_glock_is_locked_by_me(gl)) {
error = gfs2_glock_nq_init(gl, LM_ST_SHARED, 0, &ri_gh);
if (error)
goto out_unlock;
return error;
unlock_required = 1;
}
if (!sdp->sd_rindex_uptodate)
error = gfs2_ri_update(ip);
if (unlock_required)
gfs2_glock_dq_uninit(&ri_gh);
out_unlock:
mutex_unlock(&sdp->sd_rindex_mutex);
}


return error;
}

Expand Down

0 comments on commit d5cd12a

Please sign in to comment.