Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 29726
b: refs/heads/master
c: 43d23f9
h: refs/heads/master
v: v3
  • Loading branch information
Mingming Cao authored and Linus Torvalds committed Jun 25, 2006
1 parent 249d452 commit 183eeff
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 89 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: 1c2bf374a4b8c2e1a3e6ff3a64fb67272a8cd2e2
refs/heads/master: 43d23f9039fc810ecd621f1e4f9d578eadce058a
29 changes: 13 additions & 16 deletions trunk/fs/ext3/balloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ goal_in_my_reservation(struct ext3_reserve_window *rsv, ext3_grpblk_t grp_goal,
{
ext3_fsblk_t group_first_block, group_last_block;

group_first_block = le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block) +
group * EXT3_BLOCKS_PER_GROUP(sb);
group_first_block = ext3_group_first_block_no(sb, group);
group_last_block = group_first_block + EXT3_BLOCKS_PER_GROUP(sb) - 1;

if ((rsv->_rsv_start > group_last_block) ||
Expand Down Expand Up @@ -664,9 +663,7 @@ ext3_try_to_allocate(struct super_block *sb, handle_t *handle, int group,

/* we do allocation within the reservation window if we have a window */
if (my_rsv) {
group_first_block =
le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block) +
group * EXT3_BLOCKS_PER_GROUP(sb);
group_first_block = ext3_group_first_block_no(sb, group);
if (my_rsv->_rsv_start >= group_first_block)
start = my_rsv->_rsv_start - group_first_block;
else
Expand Down Expand Up @@ -900,8 +897,7 @@ static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv,
int ret;
spinlock_t *rsv_lock = &EXT3_SB(sb)->s_rsv_window_lock;

group_first_block = le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block) +
group * EXT3_BLOCKS_PER_GROUP(sb);
group_first_block = ext3_group_first_block_no(sb, group);
group_end_block = group_first_block + EXT3_BLOCKS_PER_GROUP(sb) - 1;

if (grp_goal < 0)
Expand Down Expand Up @@ -1104,8 +1100,7 @@ ext3_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle,
* first block is a filesystem wide block number
* first block is the block number of the first block in this group
*/
group_first_block = le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block) +
group * EXT3_BLOCKS_PER_GROUP(sb);
group_first_block = ext3_group_first_block_no(sb, group);

/*
* Basically we will allocate a new block from inode's reservation
Expand Down Expand Up @@ -1371,8 +1366,7 @@ ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode,
if (fatal)
goto out;

ret_block = grp_alloc_blk + group_no * EXT3_BLOCKS_PER_GROUP(sb)
+ le32_to_cpu(es->s_first_data_block);
ret_block = grp_alloc_blk + ext3_group_first_block_no(sb, group_no);

if (in_range(le32_to_cpu(gdp->bg_block_bitmap), ret_block, num) ||
in_range(le32_to_cpu(gdp->bg_inode_bitmap), ret_block, num) ||
Expand Down Expand Up @@ -1478,15 +1472,16 @@ ext3_fsblk_t ext3_new_block(handle_t *handle, struct inode *inode,
return ext3_new_blocks(handle, inode, goal, &count, errp);
}

unsigned long ext3_count_free_blocks(struct super_block *sb)
ext3_fsblk_t ext3_count_free_blocks(struct super_block *sb)
{
unsigned long desc_count;
ext3_fsblk_t desc_count;
struct ext3_group_desc *gdp;
int i;
unsigned long ngroups = EXT3_SB(sb)->s_groups_count;
#ifdef EXT3FS_DEBUG
struct ext3_super_block *es;
unsigned long bitmap_count, x;
ext3_fsblk_t bitmap_count;
unsigned long x;
struct buffer_head *bitmap_bh = NULL;

es = EXT3_SB(sb)->s_es;
Expand All @@ -1511,8 +1506,10 @@ unsigned long ext3_count_free_blocks(struct super_block *sb)
bitmap_count += x;
}
brelse(bitmap_bh);
printk("ext3_count_free_blocks: stored = %u, computed = %lu, %lu\n",
le32_to_cpu(es->s_free_blocks_count), desc_count, bitmap_count);
printk("ext3_count_free_blocks: stored = "E3FSBLK
", computed = "E3FSBLK", "E3FSBLK"\n",
le32_to_cpu(es->s_free_blocks_count),
desc_count, bitmap_count);
return bitmap_count;
#else
desc_count = 0;
Expand Down
55 changes: 28 additions & 27 deletions trunk/fs/ext3/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,13 +407,13 @@ static Indirect *ext3_get_branch(struct inode *inode, int depth, int *offsets,
*
* Caller must make sure that @ind is valid and will stay that way.
*/
static unsigned long ext3_find_near(struct inode *inode, Indirect *ind)
static ext3_fsblk_t ext3_find_near(struct inode *inode, Indirect *ind)
{
struct ext3_inode_info *ei = EXT3_I(inode);
__le32 *start = ind->bh ? (__le32*) ind->bh->b_data : ei->i_data;
__le32 *p;
unsigned long bg_start;
unsigned long colour;
ext3_fsblk_t bg_start;
ext3_grpblk_t colour;

/* Try to find previous block */
for (p = ind->p - 1; p >= start; p--) {
Expand All @@ -429,8 +429,7 @@ static unsigned long ext3_find_near(struct inode *inode, Indirect *ind)
* It is going to be referred to from the inode itself? OK, just put it
* into the same cylinder group then.
*/
bg_start = (ei->i_block_group * EXT3_BLOCKS_PER_GROUP(inode->i_sb)) +
le32_to_cpu(EXT3_SB(inode->i_sb)->s_es->s_first_data_block);
bg_start = ext3_group_first_block_no(inode->i_sb, ei->i_block_group);
colour = (current->pid % 16) *
(EXT3_BLOCKS_PER_GROUP(inode->i_sb) / 16);
return bg_start + colour;
Expand All @@ -448,7 +447,7 @@ static unsigned long ext3_find_near(struct inode *inode, Indirect *ind)
* stores it in *@goal and returns zero.
*/

static unsigned long ext3_find_goal(struct inode *inode, long block,
static ext3_fsblk_t ext3_find_goal(struct inode *inode, long block,
Indirect chain[4], Indirect *partial)
{
struct ext3_block_alloc_info *block_i;
Expand Down Expand Up @@ -516,13 +515,13 @@ static int ext3_blks_to_allocate(Indirect *branch, int k, unsigned long blks,
* direct blocks
*/
static int ext3_alloc_blocks(handle_t *handle, struct inode *inode,
unsigned long goal, int indirect_blks, int blks,
unsigned long long new_blocks[4], int *err)
ext3_fsblk_t goal, int indirect_blks, int blks,
ext3_fsblk_t new_blocks[4], int *err)
{
int target, i;
unsigned long count = 0;
int index = 0;
unsigned long current_block = 0;
ext3_fsblk_t current_block = 0;
int ret = 0;

/*
Expand Down Expand Up @@ -592,16 +591,16 @@ static int ext3_alloc_blocks(handle_t *handle, struct inode *inode,
* as described above and return 0.
*/
static int ext3_alloc_branch(handle_t *handle, struct inode *inode,
int indirect_blks, int *blks, unsigned long goal,
int indirect_blks, int *blks, ext3_fsblk_t goal,
int *offsets, Indirect *branch)
{
int blocksize = inode->i_sb->s_blocksize;
int i, n = 0;
int err = 0;
struct buffer_head *bh;
int num;
unsigned long long new_blocks[4];
unsigned long long current_block;
ext3_fsblk_t new_blocks[4];
ext3_fsblk_t current_block;

num = ext3_alloc_blocks(handle, inode, goal, indirect_blks,
*blks, new_blocks, &err);
Expand Down Expand Up @@ -688,7 +687,7 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode,
int i;
int err = 0;
struct ext3_block_alloc_info *block_i;
unsigned long current_block;
ext3_fsblk_t current_block;

block_i = EXT3_I(inode)->i_block_alloc_info;
/*
Expand Down Expand Up @@ -795,13 +794,13 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
int offsets[4];
Indirect chain[4];
Indirect *partial;
unsigned long goal;
ext3_fsblk_t goal;
int indirect_blks;
int blocks_to_boundary = 0;
int depth;
struct ext3_inode_info *ei = EXT3_I(inode);
int count = 0;
unsigned long first_block = 0;
ext3_fsblk_t first_block = 0;


J_ASSERT(handle != NULL || create == 0);
Expand All @@ -819,7 +818,7 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
count++;
/*map more blocks*/
while (count < maxblocks && count <= blocks_to_boundary) {
unsigned long blk;
ext3_fsblk_t blk;

if (!verify_chain(chain, partial)) {
/*
Expand Down Expand Up @@ -1759,7 +1758,7 @@ void ext3_set_aops(struct inode *inode)
static int ext3_block_truncate_page(handle_t *handle, struct page *page,
struct address_space *mapping, loff_t from)
{
unsigned long index = from >> PAGE_CACHE_SHIFT;
ext3_fsblk_t index = from >> PAGE_CACHE_SHIFT;
unsigned offset = from & (PAGE_CACHE_SIZE-1);
unsigned blocksize, iblock, length, pos;
struct inode *inode = mapping->host;
Expand Down Expand Up @@ -1960,7 +1959,7 @@ static Indirect *ext3_find_shared(struct inode *inode, int depth,
* than `count' because there can be holes in there.
*/
static void ext3_clear_blocks(handle_t *handle, struct inode *inode,
struct buffer_head *bh, unsigned long block_to_free,
struct buffer_head *bh, ext3_fsblk_t block_to_free,
unsigned long count, __le32 *first, __le32 *last)
{
__le32 *p;
Expand Down Expand Up @@ -2022,12 +2021,12 @@ static void ext3_free_data(handle_t *handle, struct inode *inode,
struct buffer_head *this_bh,
__le32 *first, __le32 *last)
{
unsigned long block_to_free = 0; /* Starting block # of a run */
ext3_fsblk_t block_to_free = 0; /* Starting block # of a run */
unsigned long count = 0; /* Number of blocks in the run */
__le32 *block_to_free_p = NULL; /* Pointer into inode/ind
corresponding to
block_to_free */
unsigned long nr; /* Current block # */
ext3_fsblk_t nr; /* Current block # */
__le32 *p; /* Pointer into inode/ind
for current block */
int err;
Expand Down Expand Up @@ -2089,7 +2088,7 @@ static void ext3_free_branches(handle_t *handle, struct inode *inode,
struct buffer_head *parent_bh,
__le32 *first, __le32 *last, int depth)
{
unsigned long nr;
ext3_fsblk_t nr;
__le32 *p;

if (is_handle_aborted(handle))
Expand All @@ -2113,7 +2112,7 @@ static void ext3_free_branches(handle_t *handle, struct inode *inode,
*/
if (!bh) {
ext3_error(inode->i_sb, "ext3_free_branches",
"Read failure, inode=%ld, block=%ld",
"Read failure, inode=%ld, block="E3FSBLK,
inode->i_ino, nr);
continue;
}
Expand Down Expand Up @@ -2394,11 +2393,12 @@ void ext3_truncate(struct inode *inode)
ext3_journal_stop(handle);
}

static unsigned long ext3_get_inode_block(struct super_block *sb,
static ext3_fsblk_t ext3_get_inode_block(struct super_block *sb,
unsigned long ino, struct ext3_iloc *iloc)
{
unsigned long desc, group_desc, block_group;
unsigned long offset, block;
unsigned long offset;
ext3_fsblk_t block;
struct buffer_head *bh;
struct ext3_group_desc * gdp;

Expand Down Expand Up @@ -2448,7 +2448,7 @@ static unsigned long ext3_get_inode_block(struct super_block *sb,
static int __ext3_get_inode_loc(struct inode *inode,
struct ext3_iloc *iloc, int in_mem)
{
unsigned long block;
ext3_fsblk_t block;
struct buffer_head *bh;

block = ext3_get_inode_block(inode->i_sb, inode->i_ino, iloc);
Expand All @@ -2459,7 +2459,8 @@ static int __ext3_get_inode_loc(struct inode *inode,
if (!bh) {
ext3_error (inode->i_sb, "ext3_get_inode_loc",
"unable to read inode block - "
"inode=%lu, block=%lu", inode->i_ino, block);
"inode=%lu, block="E3FSBLK,
inode->i_ino, block);
return -EIO;
}
if (!buffer_uptodate(bh)) {
Expand Down Expand Up @@ -2540,7 +2541,7 @@ static int __ext3_get_inode_loc(struct inode *inode,
if (!buffer_uptodate(bh)) {
ext3_error(inode->i_sb, "ext3_get_inode_loc",
"unable to read inode block - "
"inode=%lu, block=%lu",
"inode=%lu, block="E3FSBLK,
inode->i_ino, block);
brelse(bh);
return -EIO;
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/ext3/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
return 0;
}
case EXT3_IOC_GROUP_EXTEND: {
unsigned long n_blocks_count;
ext3_fsblk_t n_blocks_count;
struct super_block *sb = inode->i_sb;
int err;

Expand Down
Loading

0 comments on commit 183eeff

Please sign in to comment.