Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 323270
b: refs/heads/master
c: 8d8b752
h: refs/heads/master
v: v3
  • Loading branch information
Bob Peterson authored and Steven Whitehouse committed Sep 24, 2012
1 parent 7fa2839 commit 92a7157
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 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: 5d50d5324612d28c47b9361e5424f13a19c888cd
refs/heads/master: 8d8b752a0f55282498b918f6a28f87ee2bcf19c3
16 changes: 11 additions & 5 deletions trunk/fs/gfs2/rgrp.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ int gfs2_rs_alloc(struct gfs2_inode *ip)
static void dump_rs(struct seq_file *seq, struct gfs2_blkreserv *rs)
{
gfs2_print_dbg(seq, " r: %llu s:%llu b:%u f:%u\n",
rs->rs_rbm.rgd->rd_addr, gfs2_rbm_to_block(&rs->rs_rbm),
rs->rs_rbm.rgd->rd_addr, gfs2_rbm_to_block(&rs->rs_rbm),
rs->rs_rbm.offset, rs->rs_free);
}

Expand Down Expand Up @@ -1493,16 +1493,18 @@ static int gfs2_rbm_from_block(struct gfs2_rbm *rbm, u64 block)

if (WARN_ON_ONCE(rblock > UINT_MAX))
return -EINVAL;
if (block >= rbm->rgd->rd_data0 + rbm->rgd->rd_data)
return -E2BIG;

for (x = 0; x < rbm->rgd->rd_length; x++) {
rbm->bi = rbm->rgd->rd_bits + x;
if (goal < (rbm->bi->bi_start + rbm->bi->bi_len) * GFS2_NBBY) {
rbm->offset = goal - (rbm->bi->bi_start * GFS2_NBBY);
return 0;
break;
}
}

return -E2BIG;
return 0;
}

/**
Expand Down Expand Up @@ -1579,7 +1581,6 @@ static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state,
WARN_ON(!buffer_uptodate(bh));
if (state != GFS2_BLKST_UNLINKED && rbm->bi->bi_clone)
buffer = rbm->bi->bi_clone + rbm->bi->bi_offset;
find_next:
initial_offset = rbm->offset;
offset = gfs2_bitfit(buffer, rbm->bi->bi_len, rbm->offset, state);
if (offset == BFITNOENT)
Expand All @@ -1594,7 +1595,7 @@ static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state,
return 0;
if (ret > 0) {
n += (rbm->bi - initial_bi);
goto find_next;
goto next_iter;
}
if (ret == -E2BIG) {
index = 0;
Expand All @@ -1619,6 +1620,7 @@ static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state,
if ((index == 0) && nowrap)
break;
n++;
next_iter:
if (n >= iters)
break;
}
Expand Down Expand Up @@ -2028,6 +2030,10 @@ int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *nblocks,
else
goal = rbm.rgd->rd_last_alloc + rbm.rgd->rd_data0;

if ((goal < rbm.rgd->rd_data0) ||
(goal >= rbm.rgd->rd_data0 + rbm.rgd->rd_data))
rbm.rgd = gfs2_blk2rgrpd(sdp, goal, 1);

gfs2_rbm_from_block(&rbm, goal);
error = gfs2_rbm_find(&rbm, GFS2_BLKST_FREE, ip, false);

Expand Down

0 comments on commit 92a7157

Please sign in to comment.