aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorYongqiang Yang <xiaoqiangnk@gmail.com>2011-10-29 09:23:38 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-10-29 09:23:38 -0400
commit81fdbb4a8d34242f0ed048395c4ddc910f1dffbe (patch)
tree1c7d4050d953d24388e1f0f35e48b8d08fa0bd64 /fs/ext4
parent5cb81dabcc28863e7d04e6fd9ede154bd8459c14 (diff)
ext4: move variables to their scope
Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/extents.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 29969622af8..05693804813 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -117,11 +117,9 @@ static ext4_fsblk_t ext4_ext_find_goal(struct inode *inode,
117 struct ext4_ext_path *path, 117 struct ext4_ext_path *path,
118 ext4_lblk_t block) 118 ext4_lblk_t block)
119{ 119{
120 int depth;
121
122 if (path) { 120 if (path) {
121 int depth = path->p_depth;
123 struct ext4_extent *ex; 122 struct ext4_extent *ex;
124 depth = path->p_depth;
125 123
126 /* 124 /*
127 * Try to predict block placement assuming that we are 125 * Try to predict block placement assuming that we are
@@ -247,7 +245,7 @@ static inline int ext4_ext_space_root_idx(struct inode *inode, int check)
247int ext4_ext_calc_metadata_amount(struct inode *inode, ext4_lblk_t lblock) 245int ext4_ext_calc_metadata_amount(struct inode *inode, ext4_lblk_t lblock)
248{ 246{
249 struct ext4_inode_info *ei = EXT4_I(inode); 247 struct ext4_inode_info *ei = EXT4_I(inode);
250 int idxs, num = 0; 248 int idxs;
251 249
252 idxs = ((inode->i_sb->s_blocksize - sizeof(struct ext4_extent_header)) 250 idxs = ((inode->i_sb->s_blocksize - sizeof(struct ext4_extent_header))
253 / sizeof(struct ext4_extent_idx)); 251 / sizeof(struct ext4_extent_idx));
@@ -262,6 +260,8 @@ int ext4_ext_calc_metadata_amount(struct inode *inode, ext4_lblk_t lblock)
262 */ 260 */
263 if (ei->i_da_metadata_calc_len && 261 if (ei->i_da_metadata_calc_len &&
264 ei->i_da_metadata_calc_last_lblock+1 == lblock) { 262 ei->i_da_metadata_calc_last_lblock+1 == lblock) {
263 int num = 0;
264
265 if ((ei->i_da_metadata_calc_len % idxs) == 0) 265 if ((ei->i_da_metadata_calc_len % idxs) == 0)
266 num++; 266 num++;
267 if ((ei->i_da_metadata_calc_len % (idxs*idxs)) == 0) 267 if ((ei->i_da_metadata_calc_len % (idxs*idxs)) == 0)
@@ -324,8 +324,6 @@ static int ext4_valid_extent_entries(struct inode *inode,
324 struct ext4_extent_header *eh, 324 struct ext4_extent_header *eh,
325 int depth) 325 int depth)
326{ 326{
327 struct ext4_extent *ext;
328 struct ext4_extent_idx *ext_idx;
329 unsigned short entries; 327 unsigned short entries;
330 if (eh->eh_entries == 0) 328 if (eh->eh_entries == 0)
331 return 1; 329 return 1;
@@ -334,7 +332,7 @@ static int ext4_valid_extent_entries(struct inode *inode,
334 332
335 if (depth == 0) { 333 if (depth == 0) {
336 /* leaf entries */ 334 /* leaf entries */
337 ext = EXT_FIRST_EXTENT(eh); 335 struct ext4_extent *ext = EXT_FIRST_EXTENT(eh);
338 while (entries) { 336 while (entries) {
339 if (!ext4_valid_extent(inode, ext)) 337 if (!ext4_valid_extent(inode, ext))
340 return 0; 338 return 0;
@@ -342,7 +340,7 @@ static int ext4_valid_extent_entries(struct inode *inode,
342 entries--; 340 entries--;
343 } 341 }
344 } else { 342 } else {
345 ext_idx = EXT_FIRST_INDEX(eh); 343 struct ext4_extent_idx *ext_idx = EXT_FIRST_INDEX(eh);
346 while (entries) { 344 while (entries) {
347 if (!ext4_valid_extent_idx(inode, ext_idx)) 345 if (!ext4_valid_extent_idx(inode, ext_idx))
348 return 0; 346 return 0;
@@ -3722,13 +3720,12 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
3722 ext4_fsblk_t newblock = 0; 3720 ext4_fsblk_t newblock = 0;
3723 int free_on_err = 0, err = 0, depth, ret; 3721 int free_on_err = 0, err = 0, depth, ret;
3724 unsigned int allocated = 0, offset = 0; 3722 unsigned int allocated = 0, offset = 0;
3725 unsigned int allocated_clusters = 0, reserved_clusters = 0; 3723 unsigned int allocated_clusters = 0;
3726 unsigned int punched_out = 0; 3724 unsigned int punched_out = 0;
3727 unsigned int result = 0; 3725 unsigned int result = 0;
3728 struct ext4_allocation_request ar; 3726 struct ext4_allocation_request ar;
3729 ext4_io_end_t *io = EXT4_I(inode)->cur_aio_dio; 3727 ext4_io_end_t *io = EXT4_I(inode)->cur_aio_dio;
3730 ext4_lblk_t cluster_offset; 3728 ext4_lblk_t cluster_offset;
3731 struct ext4_map_blocks punch_map;
3732 3729
3733 ext_debug("blocks %u/%u requested for inode %lu\n", 3730 ext_debug("blocks %u/%u requested for inode %lu\n",
3734 map->m_lblk, map->m_len, inode->i_ino); 3731 map->m_lblk, map->m_len, inode->i_ino);
@@ -3804,6 +3801,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
3804 3801
3805 /* if found extent covers block, simply return it */ 3802 /* if found extent covers block, simply return it */
3806 if (in_range(map->m_lblk, ee_block, ee_len)) { 3803 if (in_range(map->m_lblk, ee_block, ee_len)) {
3804 struct ext4_map_blocks punch_map;
3807 ext4_fsblk_t partial_cluster = 0; 3805 ext4_fsblk_t partial_cluster = 0;
3808 3806
3809 newblock = map->m_lblk - ee_block + ee_start; 3807 newblock = map->m_lblk - ee_block + ee_start;
@@ -4084,8 +4082,9 @@ got_allocated_blocks:
4084 * block allocation which had been deferred till now. 4082 * block allocation which had been deferred till now.
4085 */ 4083 */
4086 if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) { 4084 if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) {
4085 unsigned int reserved_clusters;
4087 /* 4086 /*
4088 * Check how many clusters we had reserved this allocted range. 4087 * Check how many clusters we had reserved this allocated range
4089 */ 4088 */
4090 reserved_clusters = get_reserved_cluster_alloc(inode, 4089 reserved_clusters = get_reserved_cluster_alloc(inode,
4091 map->m_lblk, allocated); 4090 map->m_lblk, allocated);