Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 33639
b: refs/heads/master
c: c37336b
h: refs/heads/master
i:
  33637: b33814f
  33635: 5d2cb5b
  33631: d309816
v: v3
  • Loading branch information
Evgeniy Dushistov authored and Linus Torvalds committed Aug 27, 2006
1 parent bed6afe commit 4125925
Show file tree
Hide file tree
Showing 2 changed files with 22 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: 08fb306fe63d98eb86e3b16f4cc21816fa47f18e
refs/heads/master: c37336b078ba9d2ff38c535b194996a7ad6e69f8
35 changes: 21 additions & 14 deletions trunk/fs/ufs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,20 @@ static void ufs_clear_frag(struct inode *inode, struct buffer_head *bh)

static struct buffer_head *
ufs_clear_frags(struct inode *inode, sector_t beg,
unsigned int n)
unsigned int n, sector_t want)
{
struct buffer_head *res, *bh;
struct buffer_head *res = NULL, *bh;
sector_t end = beg + n;

res = sb_getblk(inode->i_sb, beg);
ufs_clear_frag(inode, res);
for (++beg; beg < end; ++beg) {
for (; beg < end; ++beg) {
bh = sb_getblk(inode->i_sb, beg);
ufs_clear_frag(inode, bh);
brelse(bh);
if (want != beg)
brelse(bh);
else
res = bh;
}
BUG_ON(!res);
return res;
}

Expand Down Expand Up @@ -265,7 +267,9 @@ ufs_inode_getfrag(struct inode *inode, unsigned int fragment,
lastfrag = ufsi->i_lastfrag;

}
goal = fs32_to_cpu(sb, ufsi->i_u1.i_data[lastblock]) + uspi->s_fpb;
tmp = fs32_to_cpu(sb, ufsi->i_u1.i_data[lastblock]);
if (tmp)
goal = tmp + uspi->s_fpb;
tmp = ufs_new_fragments (inode, p, fragment - blockoff,
goal, required + blockoff,
err, locked_page);
Expand All @@ -277,13 +281,15 @@ ufs_inode_getfrag(struct inode *inode, unsigned int fragment,
tmp = ufs_new_fragments(inode, p, fragment - (blockoff - lastblockoff),
fs32_to_cpu(sb, *p), required + (blockoff - lastblockoff),
err, locked_page);
}
} else /* (lastblock > block) */ {
/*
* We will allocate new block before last allocated block
*/
else /* (lastblock > block) */ {
if (lastblock && (tmp = fs32_to_cpu(sb, ufsi->i_u1.i_data[lastblock-1])))
goal = tmp + uspi->s_fpb;
if (block) {
tmp = fs32_to_cpu(sb, ufsi->i_u1.i_data[block-1]);
if (tmp)
goal = tmp + uspi->s_fpb;
}
tmp = ufs_new_fragments(inode, p, fragment - blockoff,
goal, uspi->s_fpb, err, locked_page);
}
Expand All @@ -296,7 +302,7 @@ ufs_inode_getfrag(struct inode *inode, unsigned int fragment,
}

if (!phys) {
result = ufs_clear_frags(inode, tmp + blockoff, required);
result = ufs_clear_frags(inode, tmp, required, tmp + blockoff);
} else {
*phys = tmp + blockoff;
result = NULL;
Expand Down Expand Up @@ -383,7 +389,7 @@ ufs_inode_getblock(struct inode *inode, struct buffer_head *bh,
}
}

if (block && (tmp = fs32_to_cpu(sb, ((__fs32*)bh->b_data)[block-1]) + uspi->s_fpb))
if (block && (tmp = fs32_to_cpu(sb, ((__fs32*)bh->b_data)[block-1])))
goal = tmp + uspi->s_fpb;
else
goal = bh->b_blocknr + uspi->s_fpb;
Expand All @@ -397,7 +403,8 @@ ufs_inode_getblock(struct inode *inode, struct buffer_head *bh,


if (!phys) {
result = ufs_clear_frags(inode, tmp + blockoff, uspi->s_fpb);
result = ufs_clear_frags(inode, tmp, uspi->s_fpb,
tmp + blockoff);
} else {
*phys = tmp + blockoff;
*new = 1;
Expand Down

0 comments on commit 4125925

Please sign in to comment.