diff options
author | Mingming Cao <cmm@us.ibm.com> | 2006-10-11 01:20:53 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-11 11:14:15 -0700 |
commit | 617ba13b31fbf505cc21799826639ef24ed94af0 (patch) | |
tree | 2a41e8c993f7c1eed115ad24047d546ba56cbdf5 /fs/ext4/inode.c | |
parent | ac27a0ec112a089f1a5102bc8dffc79c8c815571 (diff) |
[PATCH] ext4: rename ext4 symbols to avoid duplication of ext3 symbols
Mingming Cao originally did this work, and Shaggy reproduced it using some
scripts from her.
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 1020 |
1 files changed, 510 insertions, 510 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 03ba5bcab18..7275d60dcc5 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -1,5 +1,5 @@ /* - * linux/fs/ext3/inode.c + * linux/fs/ext4/inode.c * * Copyright (C) 1992, 1993, 1994, 1995 * Remy Card (card@masi.ibp.fr) @@ -19,13 +19,13 @@ * 64-bit file support on 64-bit platforms by Jakub Jelinek * (jj@sunsite.ms.mff.cuni.cz) * - * Assorted race fixes, rewrite of ext3_get_block() by Al Viro, 2000 + * Assorted race fixes, rewrite of ext4_get_block() by Al Viro, 2000 */ #include <linux/module.h> #include <linux/fs.h> #include <linux/time.h> -#include <linux/ext3_jbd.h> +#include <linux/ext4_jbd.h> #include <linux/jbd.h> #include <linux/smp_lock.h> #include <linux/highuid.h> @@ -40,21 +40,21 @@ #include "xattr.h" #include "acl.h" -static int ext3_writepage_trans_blocks(struct inode *inode); +static int ext4_writepage_trans_blocks(struct inode *inode); /* * Test whether an inode is a fast symlink. */ -static int ext3_inode_is_fast_symlink(struct inode *inode) +static int ext4_inode_is_fast_symlink(struct inode *inode) { - int ea_blocks = EXT3_I(inode)->i_file_acl ? + int ea_blocks = EXT4_I(inode)->i_file_acl ? (inode->i_sb->s_blocksize >> 9) : 0; return (S_ISLNK(inode->i_mode) && inode->i_blocks - ea_blocks == 0); } /* - * The ext3 forget function must perform a revoke if we are freeing data + * The ext4 forget function must perform a revoke if we are freeing data * which has been journaled. Metadata (eg. indirect blocks) must be * revoked in all cases. * @@ -62,8 +62,8 @@ static int ext3_inode_is_fast_symlink(struct inode *inode) * but there may still be a record of it in the journal, and that record * still needs to be revoked. */ -int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode, - struct buffer_head *bh, ext3_fsblk_t blocknr) +int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode, + struct buffer_head *bh, ext4_fsblk_t blocknr) { int err; @@ -81,11 +81,11 @@ int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode, * support it. Otherwise, only skip the revoke on un-journaled * data blocks. */ - if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA || - (!is_metadata && !ext3_should_journal_data(inode))) { + if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA || + (!is_metadata && !ext4_should_journal_data(inode))) { if (bh) { BUFFER_TRACE(bh, "call journal_forget"); - return ext3_journal_forget(handle, bh); + return ext4_journal_forget(handle, bh); } return 0; } @@ -93,10 +93,10 @@ int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode, /* * data!=journal && (is_metadata || should_journal_data(inode)) */ - BUFFER_TRACE(bh, "call ext3_journal_revoke"); - err = ext3_journal_revoke(handle, blocknr, bh); + BUFFER_TRACE(bh, "call ext4_journal_revoke"); + err = ext4_journal_revoke(handle, blocknr, bh); if (err) - ext3_abort(inode->i_sb, __FUNCTION__, + ext4_abort(inode->i_sb, __FUNCTION__, "error %d when attempting revoke", err); BUFFER_TRACE(bh, "exit"); return err; @@ -115,7 +115,7 @@ static unsigned long blocks_for_truncate(struct inode *inode) /* Give ourselves just enough room to cope with inodes in which * i_blocks is corrupt: we've seen disk corruptions in the past * which resulted in random data in an inode which looked enough - * like a regular file for ext3 to try to delete it. Things + * like a regular file for ext4 to try to delete it. Things * will go a bit crazy if that happens, but at least we should * try not to panic the whole kernel. */ if (needed < 2) @@ -123,10 +123,10 @@ static unsigned long blocks_for_truncate(struct inode *inode) /* But we need to bound the transaction so we don't overflow the * journal. */ - if (needed > EXT3_MAX_TRANS_DATA) - needed = EXT3_MAX_TRANS_DATA; + if (needed > EXT4_MAX_TRANS_DATA) + needed = EXT4_MAX_TRANS_DATA; - return EXT3_DATA_TRANS_BLOCKS(inode->i_sb) + needed; + return EXT4_DATA_TRANS_BLOCKS(inode->i_sb) + needed; } /* @@ -143,11 +143,11 @@ static handle_t *start_transaction(struct inode *inode) { handle_t *result; - result = ext3_journal_start(inode, blocks_for_truncate(inode)); + result = ext4_journal_start(inode, blocks_for_truncate(inode)); if (!IS_ERR(result)) return result; - ext3_std_error(inode->i_sb, PTR_ERR(result)); + ext4_std_error(inode->i_sb, PTR_ERR(result)); return result; } @@ -159,9 +159,9 @@ static handle_t *start_transaction(struct inode *inode) */ static int try_to_extend_transaction(handle_t *handle, struct inode *inode) { - if (handle->h_buffer_credits > EXT3_RESERVE_TRANS_BLOCKS) + if (handle->h_buffer_credits > EXT4_RESERVE_TRANS_BLOCKS) return 0; - if (!ext3_journal_extend(handle, blocks_for_truncate(inode))) + if (!ext4_journal_extend(handle, blocks_for_truncate(inode))) return 0; return 1; } @@ -171,16 +171,16 @@ static int try_to_extend_transaction(handle_t *handle, struct inode *inode) * so before we call here everything must be consistently dirtied against * this transaction. */ -static int ext3_journal_test_restart(handle_t *handle, struct inode *inode) +static int ext4_journal_test_restart(handle_t *handle, struct inode *inode) { jbd_debug(2, "restarting handle %p\n", handle); - return ext3_journal_restart(handle, blocks_for_truncate(inode)); + return ext4_journal_restart(handle, blocks_for_truncate(inode)); } /* * Called at the last iput() if i_nlink is zero. */ -void ext3_delete_inode (struct inode * inode) +void ext4_delete_inode (struct inode * inode) { handle_t *handle; @@ -196,7 +196,7 @@ void ext3_delete_inode (struct inode * inode) * make sure that the in-core orphan linked list is properly * cleaned up. */ - ext3_orphan_del(NULL, inode); + ext4_orphan_del(NULL, inode); goto no_delete; } @@ -204,17 +204,17 @@ void ext3_delete_inode (struct inode * inode) handle->h_sync = 1; inode->i_size = 0; if (inode->i_blocks) - ext3_truncate(inode); + ext4_truncate(inode); /* - * Kill off the orphan record which ext3_truncate created. + * Kill off the orphan record which ext4_truncate created. * AKPM: I think this can be inside the above `if'. - * Note that ext3_orphan_del() has to be able to cope with the + * Note that ext4_orphan_del() has to be able to cope with the * deletion of a non-existent orphan - this is because we don't - * know if ext3_truncate() actually created an orphan record. + * know if ext4_truncate() actually created an orphan record. * (Well, we could do this if we need to, but heck - it works) */ - ext3_orphan_del(handle, inode); - EXT3_I(inode)->i_dtime = get_seconds(); + ext4_orphan_del(handle, inode); + EXT4_I(inode)->i_dtime = get_seconds(); /* * One subtle ordering requirement: if anything has gone wrong @@ -223,12 +223,12 @@ void ext3_delete_inode (struct inode * inode) * having errors), but we can't free the inode if the mark_dirty * fails. */ - if (ext3_mark_inode_dirty(handle, inode)) + if (ext4_mark_inode_dirty(handle, inode)) /* If that failed, just do the required in-core inode clear. */ clear_inode(inode); else - ext3_free_inode(handle, inode); - ext3_journal_stop(handle); + ext4_free_inode(handle, inode); + ext4_journal_stop(handle); return; no_delete: clear_inode(inode); /* We must guarantee clearing of inode... */ @@ -254,14 +254,14 @@ static int verify_chain(Indirect *from, Indirect *to) } /** - * ext3_block_to_path - parse the block number into array of offsets + * ext4_block_to_path - parse the block number into array of offsets * @inode: inode in question (we are only interested in its superblock) * @i_block: block number to be parsed * @offsets: array to store the offsets in * @boundary: set this non-zero if the referred-to block is likely to be * followed (on disk) by an indirect block. * - * To store the locations of file's data ext3 uses a data structure common + * To store the locations of file's data ext4 uses a data structure common * for UNIX filesystems - tree of pointers anchored in the inode, with * data blocks at leaves and indirect blocks in intermediate nodes. * This function translates the block number into path in that tree - @@ -284,39 +284,39 @@ static int verify_chain(Indirect *from, Indirect *to) * get there at all. */ -static int ext3_block_to_path(struct inode *inode, +static int ext4_block_to_path(struct inode *inode, long i_block, int offsets[4], int *boundary) { - int ptrs = EXT3_ADDR_PER_BLOCK(inode->i_sb); - int ptrs_bits = EXT3_ADDR_PER_BLOCK_BITS(inode->i_sb); - const long direct_blocks = EXT3_NDIR_BLOCKS, + int ptrs = EXT4_ADDR_PER_BLOCK(inode->i_sb); + int ptrs_bits = EXT4_ADDR_PER_BLOCK_BITS(inode->i_sb); + const long direct_blocks = EXT4_NDIR_BLOCKS, indirect_blocks = ptrs, double_blocks = (1 << (ptrs_bits * 2)); int n = 0; int final = 0; if (i_block < 0) { - ext3_warning (inode->i_sb, "ext3_block_to_path", "block < 0"); + ext4_warning (inode->i_sb, "ext4_block_to_path", "block < 0"); } else if (i_block < direct_blocks) { offsets[n++] = i_block; final = direct_blocks; } else if ( (i_block -= direct_blocks) < indirect_blocks) { - offsets[n++] = EXT3_IND_BLOCK; + offsets[n++] = EXT4_IND_BLOCK; offsets[n++] = i_block; final = ptrs; } else if ((i_block -= indirect_blocks) < double_blocks) { - offsets[n++] = EXT3_DIND_BLOCK; + offsets[n++] = EXT4_DIND_BLOCK; offsets[n++] = i_block >> ptrs_bits; offsets[n++] = i_block & (ptrs - 1); final = ptrs; } else if (((i_block -= double_blocks) >> (ptrs_bits * 2)) < ptrs) { - offsets[n++] = EXT3_TIND_BLOCK; + offsets[n++] = EXT4_TIND_BLOCK; offsets[n++] = i_block >> (ptrs_bits * 2); offsets[n++] = (i_block >> ptrs_bits) & (ptrs - 1); offsets[n++] = i_block & (ptrs - 1); final = ptrs; } else { - ext3_warning(inode->i_sb, "ext3_block_to_path", "block > big"); + ext4_warning(inode->i_sb, "ext4_block_to_path", "block > big"); } if (boundary) *boundary = final - 1 - (i_block & (ptrs - 1)); @@ -324,7 +324,7 @@ static int ext3_block_to_path(struct inode *inode, } /** - * ext3_get_branch - read the chain of indirect blocks leading to data + * ext4_get_branch - read the chain of indirect blocks leading to data * @inode: inode in question * @depth: depth of the chain (1 - direct pointer, etc.) * @offsets: offsets of pointers in inode/indirect blocks @@ -352,7 +352,7 @@ static int ext3_block_to_path(struct inode *inode, * or when it reads all @depth-1 indirect blocks successfully and finds * the whole chain, all way to the data (returns %NULL, *err == 0). */ -static Indirect *ext3_get_branch(struct inode *inode, int depth, int *offsets, +static Indirect *ext4_get_branch(struct inode *inode, int depth, int *offsets, Indirect chain[4], int *err) { struct super_block *sb = inode->i_sb; @@ -361,7 +361,7 @@ static Indirect *ext3_get_branch(struct inode *inode, int depth, int *offsets, *err = 0; /* i_data is not going away, no lock needed */ - add_chain (chain, NULL, EXT3_I(inode)->i_data + *offsets); + add_chain (chain, NULL, EXT4_I(inode)->i_data + *offsets); if (!p->key) goto no_block; while (--depth) { @@ -389,7 +389,7 @@ no_block: } /** - * ext3_find_near - find a place for allocation with sufficient locality + * ext4_find_near - find a place for allocation with sufficient locality * @inode: owner * @ind: descriptor of indirect block. * @@ -408,13 +408,13 @@ no_block: * * Caller must make sure that @ind is valid and will stay that way. */ -static ext3_fsblk_t ext3_find_near(struct inode *inode, Indirect *ind) +static ext4_fsblk_t ext4_find_near(struct inode *inode, Indirect *ind) { - struct ext3_inode_info *ei = EXT3_I(inode); + struct ext4_inode_info *ei = EXT4_I(inode); __le32 *start = ind->bh ? (__le32*) ind->bh->b_data : ei->i_data; __le32 *p; - ext3_fsblk_t bg_start; - ext3_grpblk_t colour; + ext4_fsblk_t bg_start; + ext4_grpblk_t colour; /* Try to find previous block */ for (p = ind->p - 1; p >= start; p--) { @@ -430,14 +430,14 @@ static ext3_fsblk_t 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 = ext3_group_first_block_no(inode->i_sb, ei->i_block_group); + bg_start = ext4_group_first_block_no(inode->i_sb, ei->i_block_group); colour = (current->pid % 16) * - (EXT3_BLOCKS_PER_GROUP(inode->i_sb) / 16); + (EXT4_BLOCKS_PER_GROUP(inode->i_sb) / 16); return bg_start + colour; } /** - * ext3_find_goal - find a prefered place for allocation. + * ext4_find_goal - find a prefered place for allocation. * @inode: owner * @block: block we want * @chain: chain of indirect blocks @@ -448,12 +448,12 @@ static ext3_fsblk_t ext3_find_near(struct inode *inode, Indirect *ind) * stores it in *@goal and returns zero. */ -static ext3_fsblk_t ext3_find_goal(struct inode *inode, long block, +static ext4_fsblk_t ext4_find_goal(struct inode *inode, long block, Indirect chain[4], Indirect *partial) { - struct ext3_block_alloc_info *block_i; + struct ext4_block_alloc_info *block_i; - block_i = EXT3_I(inode)->i_block_alloc_info; + block_i = EXT4_I(inode)->i_block_alloc_info; /* * try the heuristic for sequential allocation, @@ -464,11 +464,11 @@ static ext3_fsblk_t ext3_find_goal(struct inode *inode, long block, return block_i->last_alloc_physical_block + 1; } - return ext3_find_near(inode, partial); + return ext4_find_near(inode, partial); } /** - * ext3_blks_to_allocate: Look up the block map and count the number + * ext4_blks_to_allocate: Look up the block map and count the number * of direct blocks need to be allocated for the given branch. * * @branch: chain of indirect blocks @@ -479,7 +479,7 @@ static ext3_fsblk_t ext3_find_goal(struct inode *inode, long block, * return the total number of blocks to be allocate, including the * direct and indirect blocks. */ -static int ext3_blks_to_allocate(Indirect *branch, int k, unsigned long blks, +static int ext4_blks_to_allocate(Indirect *branch, int k, unsigned long blks, int blocks_to_boundary) { unsigned long count = 0; @@ -506,7 +506,7 @@ static int ext3_blks_to_allocate(Indirect *branch, int k, unsigned long blks, } /** - * ext3_alloc_blocks: multiple allocate blocks needed for a branch + * ext4_alloc_blocks: multiple allocate blocks needed for a branch * @indirect_blks: the number of blocks need to allocate for indirect * blocks * @@ -515,14 +515,14 @@ static int ext3_blks_to_allocate(Indirect *branch, int k, unsigned long blks, * @blks: on return it will store the total number of allocated * direct blocks */ -static int ext3_alloc_blocks(handle_t *handle, struct inode *inode, - ext3_fsblk_t goal, int indirect_blks, int blks, - ext3_fsblk_t new_blocks[4], int *err) +static int ext4_alloc_blocks(handle_t *handle, struct inode *inode, + ext4_fsblk_t goal, int indirect_blks, int blks, + ext4_fsblk_t new_blocks[4], int *err) { int target, i; unsigned long count = 0; int index = 0; - ext3_fsblk_t current_block = 0; + ext4_fsblk_t current_block = 0; int ret = 0; /* @@ -538,7 +538,7 @@ static int ext3_alloc_blocks(handle_t *handle, struct inode *inode, while (1) { count = target; /* allocating blocks for indirect blocks and direct blocks */ - current_block = ext3_new_blocks(handle,inode,goal,&count,err); + current_block = ext4_new_blocks(handle,inode,goal,&count,err); if (*err) goto failed_out; @@ -562,12 +562,12 @@ static int ext3_alloc_blocks(handle_t *handle, struct inode *inode, return ret; failed_out: for (i = 0; i <index; i++) - ext3_free_blocks(handle, inode, new_blocks[i], 1); + ext4_free_blocks(handle, inode, new_blocks[i], 1); return ret; } /** - * ext3_alloc_branch - allocate and set up a chain of blocks. + * ext4_alloc_branch - allocate and set up a chain of blocks. * @inode: owner * @indirect_blks: number of allocated indirect blocks * @blks: number of allocated direct blocks @@ -578,21 +578,21 @@ failed_out: * links them into chain and (if we are synchronous) writes them to disk. * In other words, it prepares a branch that can be spliced onto the * inode. It stores the information about that chain in the branch[], in - * the same format as ext3_get_branch() would do. We are calling it after + * the same format as ext4_get_branch() would do. We are calling it after * we had read the existing part of chain and partial points to the last * triple of that (one with zero ->key). Upon the exit we have the same - * picture as after the successful ext3_get_block(), except that in one + * picture as after the successful ext4_get_block(), except that in one * place chain is disconnected - *branch->p is still zero (we did not * set the last link), but branch->key contains the number that should * be placed into *branch->p to fill that gap. * * If allocation fails we free all blocks we've allocated (and forget * their buffer_heads) and return the error value the from failed - * ext3_alloc_block() (normally -ENOSPC). Otherwise we set the chain + * ext4_alloc_block() (normally -ENOSPC). Otherwise we set the chain * as described above and return 0. */ -static int ext3_alloc_branch(handle_t *handle, struct inode *inode, - int indirect_blks, int *blks, ext3_fsblk_t goal, +static int ext4_alloc_branch(handle_t *handle, struct inode *inode, + int indirect_blks, int *blks, ext4_fsblk_t goal, int *offsets, Indirect *branch) { int blocksize = inode->i_sb->s_blocksize; @@ -600,10 +600,10 @@ static int ext3_alloc_branch(handle_t *handle, struct inode *inode, int err = 0; struct buffer_head *bh; int num; - ext3_fsblk_t new_blocks[4]; - ext3_fsblk_t current_block; + ext4_fsblk_t new_blocks[4]; + ext4_fsblk_t current_block; - num = ext3_alloc_blocks(handle, inode, goal, indirect_blks, + num = ext4_alloc_blocks(handle, inode, goal, indirect_blks, *blks, new_blocks, &err); if (err) return err; @@ -622,7 +622,7 @@ static int ext3_alloc_branch(handle_t *handle, struct inode *inode, branch[n].bh = bh; lock_buffer(bh); BUFFER_TRACE(bh, "call get_create_access"); - err = ext3_journal_get_create_access(handle, bh); + err = ext4_journal_get_create_access(handle, bh); if (err) { unlock_buffer(bh); brelse(bh); @@ -647,8 +647,8 @@ static int ext3_alloc_branch(handle_t *handle, struct inode *inode, set_buffer_uptodate(bh); unlock_buffer(bh); - BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata"); - err = ext3_journal_dirty_metadata(handle, bh); + BUFFER_TRACE(bh, "call ext4_journal_dirty_metadata"); + err = ext4_journal_dirty_metadata(handle, bh); if (err) goto failed; } @@ -658,22 +658,22 @@ failed: /* Allocation failed, free what we already allocated */ for (i = 1; i <= n ; i++) { BUFFER_TRACE(branch[i].bh, "call journal_forget"); - ext3_journal_forget(handle, branch[i].bh); + ext4_journal_forget(handle, branch[i].bh); } for (i = 0; i <indirect_blks; i++) - ext3_free_blocks(handle, inode, new_blocks[i], 1); + ext4_free_blocks(handle, inode, new_blocks[i], 1); - ext3_free_blocks(handle, inode, new_blocks[i], num); + ext4_free_blocks(handle, inode, new_blocks[i], num); return err; } /** - * ext3_splice_branch - splice the allocated branch onto inode. + * ext4_splice_branch - splice the allocated branch onto inode. * @inode: owner * @block: (logical) number of block we are adding * @chain: chain of indirect blocks (with a missing link - see - * ext3_alloc_branch) + * ext4_alloc_branch) * @where: location of missing link * @num: number of indirect blocks we are adding * @blks: number of direct blocks we are adding @@ -682,15 +682,15 @@ failed: * inode (->i_blocks, etc.). In case of success we end up with the full * chain to new block and return 0. */ -static int ext3_splice_branch(handle_t *handle, struct inode *inode, +static int ext4_splice_branch(handle_t *handle, struct inode *inode, long block, Indirect *where, int num, int blks) { int i; int err = 0; - struct ext3_block_alloc_info *block_i; - ext3_fsblk_t current_block; + struct ext4_block_alloc_info *block_i; + ext4_fsblk_t current_block; - block_i = EXT3_I(inode)->i_block_alloc_info; + block_i = EXT4_I(inode)->i_block_alloc_info; /* * If we're splicing into a [td]indirect block (as opposed to the * inode) then we need to get write access to the [td]indirect block @@ -698,7 +698,7 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode, */ if (where->bh) { BUFFER_TRACE(where->bh, "get_write_access"); - err = ext3_journal_get_write_access(handle, where->bh); + err = ext4_journal_get_write_access(handle, where->bh); if (err) goto err_out; } @@ -730,7 +730,7 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode, /* We are done with atomic stuff, now do the rest of housekeeping */ inode->i_ctime = CURRENT_TIME_SEC; - ext3_mark_inode_dirty(handle, inode); + ext4_mark_inode_dirty(handle, inode); /* had we spliced it onto indirect block? */ if (where->bh) { @@ -740,11 +740,11 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode, * onto an indirect block at the very end of the file (the * file is growing) then we *will* alter the inode to reflect * the new i_size. But that is not done here - it is done in - * generic_commit_write->__mark_inode_dirty->ext3_dirty_inode. + * generic_commit_write->__mark_inode_dirty->ext4_dirty_inode. */ jbd_debug(5, "splicing indirect only\n"); - BUFFER_TRACE(where->bh, "call ext3_journal_dirty_metadata"); - err = ext3_journal_dirty_metadata(handle, where->bh); + BUFFER_TRACE(where->bh, "call ext4_journal_dirty_metadata"); + err = ext4_journal_dirty_metadata(handle, where->bh); if (err) goto err_out; } else { @@ -759,10 +759,10 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode, err_out: for (i = 1; i <= num; i++) { BUFFER_TRACE(where[i].bh, "call journal_forget"); - ext3_journal_forget(handle, where[i].bh); - ext3_free_blocks(handle,inode,le32_to_cpu(where[i-1].key),1); + ext4_journal_forget(handle, where[i].bh); + ext4_free_blocks(handle,inode,le32_to_cpu(where[i-1].key),1); } - ext3_free_blocks(handle, inode, le32_to_cpu(where[num].key), blks); + ext4_free_blocks(handle, inode, le32_to_cpu(where[num].key), blks); return err; } @@ -786,7 +786,7 @@ err_out: * return = 0, if plain lookup failed. * return < 0, error case. */ -int ext3_get_blocks_handle(handle_t *handle, struct inode *inode, +int ext4_get_blocks_handle(handle_t *handle, struct inode *inode, sector_t iblock, unsigned long maxblocks, struct buffer_head *bh_result, int create, int extend_disksize) @@ -795,22 +795,22 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode, int offsets[4]; Indirect chain[4]; Indirect *partial; - ext3_fsblk_t goal; + ext4_fsblk_t goal; int indirect_blks; int blocks_to_boundary = 0; int depth; - struct ext3_inode_info *ei = EXT3_I(inode); + struct ext4_inode_info *ei = EXT4_I(inode); int count = 0; - ext3_fsblk_t first_block = 0; + ext4_fsblk_t first_block = 0; J_ASSERT(handle != NULL || create == 0); - depth = ext3_block_to_path(inode,iblock,offsets,&blocks_to_boundary); + depth = ext4_block_to_path(inode,iblock,offsets,&blocks_to_boundary); if (depth == 0) goto out; - partial = ext3_get_branch(inode, depth, offsets, chain, &err); + partial = ext4_get_branch(inode, depth, offsets, chain, &err); /* Simplest case - block found, no allocation needed */ if (!partial) { @@ -819,7 +819,7 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode, count++; /*map more blocks*/ while (count < maxblocks && count <= blocks_to_boundary) { - ext3_fsblk_t blk; + ext4_fsblk_t blk; if (!verify_chain(chain, partial)) { /* @@ -852,7 +852,7 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode, /* * If the indirect block is missing while we are reading - * the chain(ext3_get_branch() returns -EAGAIN err), or + * the chain(ext4_get_branch() returns -EAGAIN err), or * if the chain has been changed after we grab the semaphore, * (either because another process truncated this branch, or * another get_block allocated this branch) re-grab the chain to see if @@ -867,7 +867,7 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode, brelse(partial->bh); partial--; } - partial = ext3_get_branch(inode, depth, offsets, chain, &err); + partial = ext4_get_branch(inode, depth, offsets, chain, &err); if (!partial) { count++; mutex_unlock(&ei->truncate_mutex); @@ -883,9 +883,9 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode, * allocation info here if necessary */ if (S_ISREG(inode->i_mode) && (!ei->i_block_alloc_info)) - ext3_init_block_alloc_info(inode); + ext4_init_block_alloc_info(inode); - goal = ext3_find_goal(inode, iblock, chain, partial); + goal = ext4_find_goal(inode, iblock, chain, partial); /* the number of blocks need to allocate for [d,t]indirect blocks */ indirect_blks = (chain + depth) - partial - 1; @@ -894,28 +894,28 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode, * Next look up the indirect map to count the totoal number of * direct blocks to allocate for this branch. */ - count = ext3_blks_to_allocate(partial, indirect_blks, + count = ext4_blks_to_allocate(partial, indirect_blks, maxblocks, blocks_to_boundary); /* - * Block out ext3_truncate while we alter the tree + * Block out ext4_truncate while we alter the tree */ - err = ext3_alloc_branch(handle, inode, indirect_blks, &count, goal, + err = ext4_alloc_branch(handle, inode, indirect_blks, &count, goal, offsets + (partial - chain), partial); /* - * The ext3_splice_branch call will free and forget any buffers + * The ext4_splice_branch call will free and forget any buffers * on the new chain if there is a failure, but that risks using * up transaction credits, especially for bitmaps where the * credits cannot be returned. Can we handle this somehow? We * may need to return -EAGAIN upwards in the worst case. --sct */ if (!err) - err = ext3_splice_branch(handle, inode, iblock, + err = ext4_splice_branch(handle, inode, iblock, partial, indirect_blks, count); /* * i_disksize growing is protected by truncate_mutex. Don't forget to * protect it if you're about to implement concurrent - * ext3_get_block() -bzzz + * ext4_get_block() -bzzz */ if (!err && extend_disksize && inode->i_size > ei->i_disksize) ei->i_disksize = inode->i_size; @@ -942,9 +942,9 @@ out: return err; } -#define DIO_CREDITS (EXT3_RESERVE_TRANS_BLOCKS + 32) +#define DIO_CREDITS (EXT4_RESERVE_TRANS_BLOCKS + 32) -static int ext3_get_block(struct inode *inode, sector_t iblock, +static int ext4_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) { handle_t *handle = journal_current_handle(); @@ -962,29 +962,29 @@ static int ext3_get_block(struct inode *inode, sector_t iblock, * Huge direct-io writes can hold off commits for long * periods of time. Let this commit run. */ - ext3_journal_stop(handle); - handle = ext3_journal_start(inode, DIO_CREDITS); + ext4_journal_stop(handle); + handle = ext4_journal_start(inode, DIO_CREDITS); if (IS_ERR(handle)) ret = PTR_ERR(handle); goto get_block; } - if (handle->h_buffer_credits <= EXT3_RESERVE_TRANS_BLOCKS) { + if (handle->h_buffer_credits <= EXT4_RESERVE_TRANS_BLOCKS) { /* * Getting low on buffer credits... */ - ret = ext3_journal_extend(handle, DIO_CREDITS); + ret = ext4_journal_extend(handle, DIO_CREDITS); if (ret > 0) { /* * Couldn't extend the transaction. Start a new one. */ - ret = ext3_journal_restart(handle, DIO_CREDITS); + ret = ext4_journal_restart(handle, DIO_CREDITS); } } get_block: if (ret == 0) { - ret = ext3_get_blocks_handle(handle, inode, iblock, + ret = ext4_get_blocks_handle(handle, inode, iblock, max_blocks, bh_result, create, 0); if (ret > 0) { bh_result->b_size = (ret << inode->i_blkbits); @@ -997,7 +997,7 @@ get_block: /* * `handle' can be NULL if create is zero */ -struct buffer_head *ext3_getblk(handle_t *handle, struct inode *inode, +struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode, long block, int create, int *errp) { struct buffer_head dummy; @@ -1008,10 +1008,10 @@ struct buffer_head *ext3_getblk(handle_t *handle, struct inode *inode, dummy.b_state = 0; dummy.b_blocknr = -1000; buffer_trace_init(&dummy.b_history); - err = ext3_get_blocks_handle(handle, inode, block, 1, + err = ext4_get_blocks_handle(handle, inode, block, 1, &dummy, create, 1); /* - * ext3_get_blocks_handle() returns number of blocks + * ext4_get_blocks_handle() returns number of blocks * mapped. 0 in case of a HOLE. */ if (err > 0) { @@ -1035,19 +1035,19 @@ struct buffer_head *ext3_getblk(handle_t *handle, struct inode *inode, * Now that we do not always journal data, we should * keep in mind whether this should always journal the * new buffer as metadata. For now, regular file - * writes use ext3_get_block instead, so it's not a + * writes use ext4_get_block instead, so it's not a * problem. */ lock_buffer(bh); BUFFER_TRACE(bh, "call get_create_access"); - fatal = ext3_journal_get_create_access(handle, bh); + fatal = ext4_journal_get_create_access(handle, bh); if (!fatal && !buffer_uptodate(bh)) { memset(bh->b_data,0,inode->i_sb->s_blocksize); set_buffer_uptodate(bh); } unlock_buffer(bh); - BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata"); - err = ext3_journal_dirty_metadata(handle, bh); + BUFFER_TRACE(bh, "call ext4_journal_dirty_metadata"); + err = ext4_journal_dirty_metadata(handle, bh); if (!fatal) fatal = err; } else { @@ -1064,12 +1064,12 @@ err: return NULL; } -struct buffer_head *ext3_bread(handle_t *handle, struct inode *inode, +struct buffer_head *ext4_bread(handle_t *handle, struct inode *inode, int block, int create, int *err) { struct buffer_head * bh; - bh = ext3_getblk(handle, inode, block, create, err); + bh = ext4_getblk(handle, inode, block, create, err); if (!bh) return bh; if (buffer_uptodate(bh)) @@ -1118,17 +1118,17 @@ static int walk_page_buffers( handle_t *handle, /* * To preserve ordering, it is essential that the hole instantiation and * the data write be encapsulated in a single transaction. We cannot - * close off a transaction and start a new one between the ext3_get_block() + * close off a transaction and start a new one between the ext4_get_block() * and the commit_write(). So doing the journal_start at the start of * prepare_write() is the right place. * - * Also, this function can nest inside ext3_writepage() -> - * block_write_full_page(). In that case, we *know* that ext3_writepage() + * Also, this function can nest inside ext4_writepage() -> + * block_write_full_page(). In that case, we *know* that ext4_writepage() * has generated enough buffer credits to do the whole page. So we won't * block on the journal in that case, which is good, because the caller may * be PF_MEMALLOC. * - * By accident, ext3 can be reentered when a transaction is open via + * By accident, ext4 can be reentered when a transaction is open via * quota file writes. If we were to commit the transaction while thus * reentered, there can be a deadlock - we would be holding a quota * lock, and the commit would never complete if another thread had a @@ -1145,48 +1145,48 @@ static int do_journal_get_write_access(handle_t *handle, { if (!buffer_mapped(bh) || buffer_freed(bh)) return 0; - return ext3_journal_get_write_access(handle, bh); + return ext4_journal_get_write_access(handle, bh); } -static int ext3_prepare_write(struct file *file, struct page *page, +static int ext4_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to) { struct inode *inode = page->mapping->host; - int ret, needed_blocks = ext3_writepage_trans_blocks(inode); + int ret, needed_blocks = ext4_writepage_trans_blocks(inode); handle_t *handle; int retries = 0; retry: - handle = ext3_journal_start(inode, needed_blocks); + handle = ext4_journal_start(inode, needed_blocks); if (IS_ERR(handle)) { ret = PTR_ERR(handle); goto out; } - if (test_opt(inode->i_sb, NOBH) && ext3_should_writeback_data(inode)) - ret = nobh_prepare_write(page, from, to, ext3_get_block); + if (test_opt(inode->i_sb, NOBH) && ext4_should_writeback_data(inode)) + ret = nobh_prepare_write(page, from, to, ext4_get_block); else - ret = block_prepare_write(page, from, to, ext3_get_block); + ret = block_prepare_write(page, from, to, ext4_get_block); if (ret) goto prepare_write_failed; - if (ext3_should_journal_data(inode)) { + if (ext4_should_journal_data(inode)) { ret = walk_page_buffers(handle, page_buffers(page), from, to, NULL, do_journal_get_write_access); } prepare_write_failed: if (ret) - ext3_journal_stop(handle); - if (ret == -ENOSPC && ext3_should_retry_alloc(inode->i_sb, &retries)) + ext4_journal_stop(handle); + if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) goto retry; out: return ret; } -int ext3_journal_dirty_data(handle_t *handle, struct buffer_head *bh) +int ext4_journal_dirty_data(handle_t *handle, struct buffer_head *bh) { int err = journal_dirty_data(handle, bh); if (err) - ext3_journal_abort_handle(__FUNCTION__, __FUNCTION__, + ext4_journal_abort_handle(__FUNCTION__, __FUNCTION__, bh, handle,err); return err; } @@ -1197,25 +1197,25 @@ static int commit_write_fn(handle_t *handle, struct buffer_head *bh) if (!buffer_mapped(bh) || buffer_freed(bh)) return 0; set_buffer_uptodate(bh); - return ext3_journal_dirty_metadata(handle, bh); + return ext4_journal_dirty_metadata(handle, bh); } /* * We need to pick up the new inode size which generic_commit_write gave us * `file' can be NULL - eg, when called from page_symlink(). * - * ext3 never places buffers on inode->i_mapping->private_list. metadata + * ext4 never places buffers on inode->i_mapping->private_list. metadata * buffers are managed internally. */ -static int ext3_ordered_commit_write(struct file *file, struct page *page, +static int ext4_ordered_commit_write(struct file *file, struct page *page, unsigned from, unsigned to) { - handle_t *handle = ext3_journal_current_handle(); + handle_t *handle = ext4_journal_current_handle(); struct inode *inode = page->mapping->host; int ret = 0, ret2; ret = walk_page_buffers(handle, page_buffers(page), - from, to, NULL, ext3_journal_dirty_data); + from, to, NULL, ext4_journal_dirty_data); if (ret == 0) { /* @@ -1226,43 +1226,43 @@ static int ext3_ordered_commit_write(struct file *file, struct page *page, loff_t new_i_size; new_i_size = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to; - if (new_i_size > EXT3_I(inode)->i_disksize) - EXT3_I(inode)->i_disksize = new_i_size; + if (new_i_size > EXT4_I(inode)->i_disksize) + EXT4_I(inode)->i_disksize = new_i_size; ret = generic_commit_write(file, page, from, to); } - ret2 = ext3_journal_stop(handle); + ret2 = ext4_journal_stop(handle); if (!ret) ret = ret2; return ret; } -static int ext3_writeback_commit_write(struct file *file, struct page *page, +static int ext4_writeback_commit_write(struct file *file, struct page *page, unsigned from, unsigned to) { - handle_t *handle = ext3_journal_current_handle(); + handle_t *handle = ext4_journal_current_handle(); struct inode *inode = page->mapping->host; int ret = 0, ret2; loff_t new_i_size; new_i_size = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to; - if (new_i_size > EXT3_I(inode)->i_disksize) - EXT3_I(inode)->i_disksize = new_i_size; + if (new_i_size > EXT4_I(inode)->i_disksize) + EXT4_I(inode)->i_disksize = new_i_size; - if (test_opt(inode->i_sb, NOBH) && ext3_should_writeback_data(inode)) + if |