Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 195763
b: refs/heads/master
c: abf1b3c
h: refs/heads/master
i:
  195761: 1f230e7
  195759: 9001ad3
v: v3
  • Loading branch information
Tao Ma committed Apr 27, 2010
1 parent da800c3 commit 85e79bd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 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: 74380c479ad83addeff8a172ab95f59557b5b0c3
refs/heads/master: abf1b3cb5b20fbad27ca9c7497235eeb4dd3f4fd
31 changes: 19 additions & 12 deletions trunk/fs/ocfs2/suballoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1982,10 +1982,10 @@ int ocfs2_claim_metadata(handle_t *handle,
}

static void ocfs2_init_inode_ac_group(struct inode *dir,
struct buffer_head *parent_fe_bh,
struct buffer_head *parent_di_bh,
struct ocfs2_alloc_context *ac)
{
struct ocfs2_dinode *fe = (struct ocfs2_dinode *)parent_fe_bh->b_data;
struct ocfs2_dinode *di = (struct ocfs2_dinode *)parent_di_bh->b_data;
/*
* Try to allocate inodes from some specific group.
*
Expand All @@ -1999,10 +1999,14 @@ static void ocfs2_init_inode_ac_group(struct inode *dir,
if (OCFS2_I(dir)->ip_last_used_group &&
OCFS2_I(dir)->ip_last_used_slot == ac->ac_alloc_slot)
ac->ac_last_group = OCFS2_I(dir)->ip_last_used_group;
else if (le16_to_cpu(fe->i_suballoc_slot) == ac->ac_alloc_slot)
ac->ac_last_group = ocfs2_which_suballoc_group(
le64_to_cpu(fe->i_blkno),
le16_to_cpu(fe->i_suballoc_bit));
else if (le16_to_cpu(di->i_suballoc_slot) == ac->ac_alloc_slot) {
if (di->i_suballoc_loc)
ac->ac_last_group = le64_to_cpu(di->i_suballoc_loc);
else
ac->ac_last_group = ocfs2_which_suballoc_group(
le64_to_cpu(di->i_blkno),
le16_to_cpu(di->i_suballoc_bit));
}
}

static inline void ocfs2_save_inode_ac_group(struct inode *dir,
Expand Down Expand Up @@ -2620,7 +2624,7 @@ static int ocfs2_test_suballoc_bit(struct ocfs2_super *osb,
struct buffer_head *alloc_bh, u64 blkno,
u16 bit, int *res)
{
struct ocfs2_dinode *alloc_fe;
struct ocfs2_dinode *alloc_di;
struct ocfs2_group_desc *group;
struct buffer_head *group_bh = NULL;
u64 bg_blkno;
Expand All @@ -2629,17 +2633,20 @@ static int ocfs2_test_suballoc_bit(struct ocfs2_super *osb,
mlog_entry("blkno: %llu bit: %u\n", (unsigned long long)blkno,
(unsigned int)bit);

alloc_fe = (struct ocfs2_dinode *)alloc_bh->b_data;
if ((bit + 1) > ocfs2_bits_per_group(&alloc_fe->id2.i_chain)) {
alloc_di = (struct ocfs2_dinode *)alloc_bh->b_data;
if ((bit + 1) > ocfs2_bits_per_group(&alloc_di->id2.i_chain)) {
mlog(ML_ERROR, "suballoc bit %u out of range of %u\n",
(unsigned int)bit,
ocfs2_bits_per_group(&alloc_fe->id2.i_chain));
ocfs2_bits_per_group(&alloc_di->id2.i_chain));
status = -EINVAL;
goto bail;
}

bg_blkno = ocfs2_which_suballoc_group(blkno, bit);
status = ocfs2_read_group_descriptor(suballoc, alloc_fe, bg_blkno,
if (alloc_di->i_suballoc_loc)
bg_blkno = le64_to_cpu(alloc_di->i_suballoc_loc);
else
bg_blkno = ocfs2_which_suballoc_group(blkno, bit);
status = ocfs2_read_group_descriptor(suballoc, alloc_di, bg_blkno,
&group_bh);
if (status < 0) {
mlog(ML_ERROR, "read group %llu failed %d\n",
Expand Down

0 comments on commit 85e79bd

Please sign in to comment.