aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ext4/acl.h6
-rw-r--r--fs/ext4/balloc.c70
-rw-r--r--fs/ext4/bitmap.c6
-rw-r--r--fs/ext4/dir.c52
-rw-r--r--fs/ext4/ext4.h68
-rw-r--r--fs/ext4/ext4_sb.h8
-rw-r--r--fs/ext4/extents.c6
-rw-r--r--fs/ext4/file.c2
-rw-r--r--fs/ext4/fsync.c2
-rw-r--r--fs/ext4/hash.c8
-rw-r--r--fs/ext4/ialloc.c50
-rw-r--r--fs/ext4/inode.c96
-rw-r--r--fs/ext4/ioctl.c4
-rw-r--r--fs/ext4/namei.c302
-rw-r--r--fs/ext4/resize.c6
-rw-r--r--fs/ext4/super.c6
-rw-r--r--fs/ext4/symlink.c4
-rw-r--r--fs/ext4/xattr.h4
18 files changed, 350 insertions, 350 deletions
diff --git a/fs/ext4/acl.h b/fs/ext4/acl.h
index cd2b855a07d6..4c9948f69f8b 100644
--- a/fs/ext4/acl.h
+++ b/fs/ext4/acl.h
@@ -58,9 +58,9 @@ static inline int ext4_acl_count(size_t size)
58#define EXT4_ACL_NOT_CACHED ((void *)-1) 58#define EXT4_ACL_NOT_CACHED ((void *)-1)
59 59
60/* acl.c */ 60/* acl.c */
61extern int ext4_permission (struct inode *, int); 61extern int ext4_permission(struct inode *, int);
62extern int ext4_acl_chmod (struct inode *); 62extern int ext4_acl_chmod(struct inode *);
63extern int ext4_init_acl (handle_t *, struct inode *, struct inode *); 63extern int ext4_init_acl(handle_t *, struct inode *, struct inode *);
64 64
65#else /* CONFIG_EXT4DEV_FS_POSIX_ACL */ 65#else /* CONFIG_EXT4DEV_FS_POSIX_ACL */
66#include <linux/sched.h> 66#include <linux/sched.h>
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index 7aac2025ba9c..58005c01abb8 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -132,7 +132,7 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
132 */ 132 */
133 group_blocks = ext4_blocks_count(sbi->s_es) - 133 group_blocks = ext4_blocks_count(sbi->s_es) -
134 le32_to_cpu(sbi->s_es->s_first_data_block) - 134 le32_to_cpu(sbi->s_es->s_first_data_block) -
135 (EXT4_BLOCKS_PER_GROUP(sb) * (sbi->s_groups_count -1)); 135 (EXT4_BLOCKS_PER_GROUP(sb) * (sbi->s_groups_count - 1));
136 } else { 136 } else {
137 group_blocks = EXT4_BLOCKS_PER_GROUP(sb); 137 group_blocks = EXT4_BLOCKS_PER_GROUP(sb);
138 } 138 }
@@ -200,20 +200,20 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
200 * @bh: pointer to the buffer head to store the block 200 * @bh: pointer to the buffer head to store the block
201 * group descriptor 201 * group descriptor
202 */ 202 */
203struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb, 203struct ext4_group_desc * ext4_get_group_desc(struct super_block *sb,
204 ext4_group_t block_group, 204 ext4_group_t block_group,
205 struct buffer_head ** bh) 205 struct buffer_head **bh)
206{ 206{
207 unsigned long group_desc; 207 unsigned long group_desc;
208 unsigned long offset; 208 unsigned long offset;
209 struct ext4_group_desc * desc; 209 struct ext4_group_desc *desc;
210 struct ext4_sb_info *sbi = EXT4_SB(sb); 210 struct ext4_sb_info *sbi = EXT4_SB(sb);
211 211
212 if (block_group >= sbi->s_groups_count) { 212 if (block_group >= sbi->s_groups_count) {
213 ext4_error (sb, "ext4_get_group_desc", 213 ext4_error(sb, "ext4_get_group_desc",
214 "block_group >= groups_count - " 214 "block_group >= groups_count - "
215 "block_group = %lu, groups_count = %lu", 215 "block_group = %lu, groups_count = %lu",
216 block_group, sbi->s_groups_count); 216 block_group, sbi->s_groups_count);
217 217
218 return NULL; 218 return NULL;
219 } 219 }
@@ -222,10 +222,10 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
222 group_desc = block_group >> EXT4_DESC_PER_BLOCK_BITS(sb); 222 group_desc = block_group >> EXT4_DESC_PER_BLOCK_BITS(sb);
223 offset = block_group & (EXT4_DESC_PER_BLOCK(sb) - 1); 223 offset = block_group & (EXT4_DESC_PER_BLOCK(sb) - 1);
224 if (!sbi->s_group_desc[group_desc]) { 224 if (!sbi->s_group_desc[group_desc]) {
225 ext4_error (sb, "ext4_get_group_desc", 225 ext4_error(sb, "ext4_get_group_desc",
226 "Group descriptor not loaded - " 226 "Group descriptor not loaded - "
227 "block_group = %lu, group_desc = %lu, desc = %lu", 227 "block_group = %lu, group_desc = %lu, desc = %lu",
228 block_group, group_desc, offset); 228 block_group, group_desc, offset);
229 return NULL; 229 return NULL;
230 } 230 }
231 231
@@ -302,8 +302,8 @@ err_out:
302struct buffer_head * 302struct buffer_head *
303ext4_read_block_bitmap(struct super_block *sb, ext4_group_t block_group) 303ext4_read_block_bitmap(struct super_block *sb, ext4_group_t block_group)
304{ 304{
305 struct ext4_group_desc * desc; 305 struct ext4_group_desc *desc;
306 struct buffer_head * bh = NULL; 306 struct buffer_head *bh = NULL;
307 ext4_fsblk_t bitmap_blk; 307 ext4_fsblk_t bitmap_blk;
308 308
309 desc = ext4_get_group_desc(sb, block_group, NULL); 309 desc = ext4_get_group_desc(sb, block_group, NULL);
@@ -506,8 +506,8 @@ void ext4_rsv_window_add(struct super_block *sb,
506 struct rb_node *node = &rsv->rsv_node; 506 struct rb_node *node = &rsv->rsv_node;
507 ext4_fsblk_t start = rsv->rsv_start; 507 ext4_fsblk_t start = rsv->rsv_start;
508 508
509 struct rb_node ** p = &root->rb_node; 509 struct rb_node **p = &root->rb_node;
510 struct rb_node * parent = NULL; 510 struct rb_node *parent = NULL;
511 struct ext4_reserve_window_node *this; 511 struct ext4_reserve_window_node *this;
512 512
513 while (*p) 513 while (*p)
@@ -661,8 +661,8 @@ void ext4_free_blocks_sb(handle_t *handle, struct super_block *sb,
661 ext4_grpblk_t bit; 661 ext4_grpblk_t bit;
662 unsigned long i; 662 unsigned long i;
663 unsigned long overflow; 663 unsigned long overflow;
664 struct ext4_group_desc * desc; 664 struct ext4_group_desc *desc;
665 struct ext4_super_block * es; 665 struct ext4_super_block *es;
666 struct ext4_sb_info *sbi; 666 struct ext4_sb_info *sbi;
667 int err = 0, ret; 667 int err = 0, ret;
668 ext4_grpblk_t group_freed; 668 ext4_grpblk_t group_freed;
@@ -673,13 +673,13 @@ void ext4_free_blocks_sb(handle_t *handle, struct super_block *sb,
673 if (block < le32_to_cpu(es->s_first_data_block) || 673 if (block < le32_to_cpu(es->s_first_data_block) ||
674 block + count < block || 674 block + count < block ||
675 block + count > ext4_blocks_count(es)) { 675 block + count > ext4_blocks_count(es)) {
676 ext4_error (sb, "ext4_free_blocks", 676 ext4_error(sb, "ext4_free_blocks",
677 "Freeing blocks not in datazone - " 677 "Freeing blocks not in datazone - "
678 "block = %llu, count = %lu", block, count); 678 "block = %llu, count = %lu", block, count);
679 goto error_return; 679 goto error_return;
680 } 680 }
681 681
682 ext4_debug ("freeing block(s) %llu-%llu\n", block, block + count - 1); 682 ext4_debug("freeing block(s) %llu-%llu\n", block, block + count - 1);
683 683
684do_more: 684do_more:
685 overflow = 0; 685 overflow = 0;
@@ -696,7 +696,7 @@ do_more:
696 bitmap_bh = ext4_read_block_bitmap(sb, block_group); 696 bitmap_bh = ext4_read_block_bitmap(sb, block_group);
697 if (!bitmap_bh) 697 if (!bitmap_bh)
698 goto error_return; 698 goto error_return;
699 desc = ext4_get_group_desc (sb, block_group, &gd_bh); 699 desc = ext4_get_group_desc(sb, block_group, &gd_bh);
700 if (!desc) 700 if (!desc)
701 goto error_return; 701 goto error_return;
702 702
@@ -705,10 +705,10 @@ do_more:
705 in_range(block, ext4_inode_table(sb, desc), sbi->s_itb_per_group) || 705 in_range(block, ext4_inode_table(sb, desc), sbi->s_itb_per_group) ||
706 in_range(block + count - 1, ext4_inode_table(sb, desc), 706 in_range(block + count - 1, ext4_inode_table(sb, desc),
707 sbi->s_itb_per_group)) { 707 sbi->s_itb_per_group)) {
708 ext4_error (sb, "ext4_free_blocks", 708 ext4_error(sb, "ext4_free_blocks",
709 "Freeing blocks in system zones - " 709 "Freeing blocks in system zones - "
710 "Block = %llu, count = %lu", 710 "Block = %llu, count = %lu",
711 block, count); 711 block, count);
712 goto error_return; 712 goto error_return;
713 } 713 }
714 714
@@ -850,7 +850,7 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode,
850 ext4_fsblk_t block, unsigned long count, 850 ext4_fsblk_t block, unsigned long count,
851 int metadata) 851 int metadata)
852{ 852{
853 struct super_block * sb; 853 struct super_block *sb;
854 unsigned long dquot_freed_blocks; 854 unsigned long dquot_freed_blocks;
855 855
856 /* this isn't the right place to decide whether block is metadata 856 /* this isn't the right place to decide whether block is metadata
@@ -1019,7 +1019,7 @@ claim_block(spinlock_t *lock, ext4_grpblk_t block, struct buffer_head *bh)
1019 if (ext4_set_bit_atomic(lock, block, bh->b_data)) 1019 if (ext4_set_bit_atomic(lock, block, bh->b_data))
1020 return 0; 1020 return 0;
1021 jbd_lock_bh_state(bh); 1021 jbd_lock_bh_state(bh);
1022 if (jh->b_committed_data && ext4_test_bit(block,jh->b_committed_data)) { 1022 if (jh->b_committed_data && ext4_test_bit(block, jh->b_committed_data)) {
1023 ext4_clear_bit_atomic(lock, block, bh->b_data); 1023 ext4_clear_bit_atomic(lock, block, bh->b_data);
1024 ret = 0; 1024 ret = 0;
1025 } else { 1025 } else {
@@ -1170,7 +1170,7 @@ fail_access:
1170static int find_next_reservable_window( 1170static int find_next_reservable_window(
1171 struct ext4_reserve_window_node *search_head, 1171 struct ext4_reserve_window_node *search_head,
1172 struct ext4_reserve_window_node *my_rsv, 1172 struct ext4_reserve_window_node *my_rsv,
1173 struct super_block * sb, 1173 struct super_block *sb,
1174 ext4_fsblk_t start_block, 1174 ext4_fsblk_t start_block,
1175 ext4_fsblk_t last_block) 1175 ext4_fsblk_t last_block)
1176{ 1176{
@@ -1204,7 +1204,7 @@ static int find_next_reservable_window(
1204 1204
1205 prev = rsv; 1205 prev = rsv;
1206 next = rb_next(&rsv->rsv_node); 1206 next = rb_next(&rsv->rsv_node);
1207 rsv = rb_entry(next,struct ext4_reserve_window_node,rsv_node); 1207 rsv = rb_entry(next, struct ext4_reserve_window_node, rsv_node);
1208 1208
1209 /* 1209 /*
1210 * Reached the last reservation, we can just append to the 1210 * Reached the last reservation, we can just append to the
@@ -1342,7 +1342,7 @@ static int alloc_new_reservation(struct ext4_reserve_window_node *my_rsv,
1342 size = size * 2; 1342 size = size * 2;
1343 if (size > EXT4_MAX_RESERVE_BLOCKS) 1343 if (size > EXT4_MAX_RESERVE_BLOCKS)
1344 size = EXT4_MAX_RESERVE_BLOCKS; 1344 size = EXT4_MAX_RESERVE_BLOCKS;
1345 my_rsv->rsv_goal_size= size; 1345 my_rsv->rsv_goal_size = size;
1346 } 1346 }
1347 } 1347 }
1348 1348
@@ -1491,7 +1491,7 @@ static ext4_grpblk_t
1491ext4_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle, 1491ext4_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle,
1492 ext4_group_t group, struct buffer_head *bitmap_bh, 1492 ext4_group_t group, struct buffer_head *bitmap_bh,
1493 ext4_grpblk_t grp_goal, 1493 ext4_grpblk_t grp_goal,
1494 struct ext4_reserve_window_node * my_rsv, 1494 struct ext4_reserve_window_node *my_rsv,
1495 unsigned long *count, int *errp) 1495 unsigned long *count, int *errp)
1496{ 1496{
1497 ext4_fsblk_t group_first_block, group_last_block; 1497 ext4_fsblk_t group_first_block, group_last_block;
@@ -1519,7 +1519,7 @@ ext4_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle,
1519 * or the file is not a regular file 1519 * or the file is not a regular file
1520 * or last attempt to allocate a block with reservation turned on failed 1520 * or last attempt to allocate a block with reservation turned on failed
1521 */ 1521 */
1522 if (my_rsv == NULL ) { 1522 if (my_rsv == NULL) {
1523 ret = ext4_try_to_allocate(sb, handle, group, bitmap_bh, 1523 ret = ext4_try_to_allocate(sb, handle, group, bitmap_bh,
1524 grp_goal, count, NULL); 1524 grp_goal, count, NULL);
1525 goto out; 1525 goto out;
@@ -2184,7 +2184,7 @@ unsigned long ext4_bg_num_gdb(struct super_block *sb, ext4_group_t group)
2184 2184
2185 if (!EXT4_HAS_INCOMPAT_FEATURE(sb,EXT4_FEATURE_INCOMPAT_META_BG) || 2185 if (!EXT4_HAS_INCOMPAT_FEATURE(sb,EXT4_FEATURE_INCOMPAT_META_BG) ||
2186 metagroup < first_meta_bg) 2186 metagroup < first_meta_bg)
2187 return ext4_bg_num_gdb_nometa(sb,group); 2187 return ext4_bg_num_gdb_nometa(sb, group);
2188 2188
2189 return ext4_bg_num_gdb_meta(sb,group); 2189 return ext4_bg_num_gdb_meta(sb,group);
2190 2190
diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c
index d37ea6750454..0a7a6663c190 100644
--- a/fs/ext4/bitmap.c
+++ b/fs/ext4/bitmap.c
@@ -15,17 +15,17 @@
15 15
16static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0}; 16static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
17 17
18unsigned long ext4_count_free (struct buffer_head * map, unsigned int numchars) 18unsigned long ext4_count_free(struct buffer_head *map, unsigned int numchars)
19{ 19{
20 unsigned int i; 20 unsigned int i;
21 unsigned long sum = 0; 21 unsigned long sum = 0;
22 22
23 if (!map) 23 if (!map)
24 return (0); 24 return 0;
25 for (i = 0; i < numchars; i++) 25 for (i = 0; i < numchars; i++)
26 sum += nibblemap[map->b_data[i] & 0xf] + 26 sum += nibblemap[map->b_data[i] & 0xf] +
27 nibblemap[(map->b_data[i] >> 4) & 0xf]; 27 nibblemap[(map->b_data[i] >> 4) & 0xf];
28 return (sum); 28 return sum;
29} 29}
30 30
31#endif /* EXT4FS_DEBUG */ 31#endif /* EXT4FS_DEBUG */
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index ac873dbf0dd0..d40da316921d 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -33,10 +33,10 @@ static unsigned char ext4_filetype_table[] = {
33}; 33};
34 34
35static int ext4_readdir(struct file *, void *, filldir_t); 35static int ext4_readdir(struct file *, void *, filldir_t);
36static int ext4_dx_readdir(struct file * filp, 36static int ext4_dx_readdir(struct file *filp,
37 void * dirent, filldir_t filldir); 37 void *dirent, filldir_t filldir);
38static int ext4_release_dir (struct inode * inode, 38static int ext4_release_dir(struct inode *inode,
39 struct file * filp); 39 struct file *filp);
40 40
41const struct file_operations ext4_dir_operations = { 41const struct file_operations ext4_dir_operations = {
42 .llseek = generic_file_llseek, 42 .llseek = generic_file_llseek,
@@ -61,12 +61,12 @@ static unsigned char get_dtype(struct super_block *sb, int filetype)
61} 61}
62 62
63 63
64int ext4_check_dir_entry (const char * function, struct inode * dir, 64int ext4_check_dir_entry(const char *function, struct inode *dir,
65 struct ext4_dir_entry_2 * de, 65 struct ext4_dir_entry_2 *de,
66 struct buffer_head * bh, 66 struct buffer_head *bh,
67 unsigned long offset) 67 unsigned long offset)
68{ 68{
69 const char * error_msg = NULL; 69 const char *error_msg = NULL;
70 const int rlen = ext4_rec_len_from_disk(de->rec_len); 70 const int rlen = ext4_rec_len_from_disk(de->rec_len);
71 71
72 if (rlen < EXT4_DIR_REC_LEN(1)) 72 if (rlen < EXT4_DIR_REC_LEN(1))
@@ -82,7 +82,7 @@ int ext4_check_dir_entry (const char * function, struct inode * dir,
82 error_msg = "inode out of bounds"; 82 error_msg = "inode out of bounds";
83 83
84 if (error_msg != NULL) 84 if (error_msg != NULL)
85 ext4_error (dir->i_sb, function, 85 ext4_error(dir->i_sb, function,
86 "bad entry in directory #%lu: %s - " 86 "bad entry in directory #%lu: %s - "
87 "offset=%lu, inode=%lu, rec_len=%d, name_len=%d", 87 "offset=%lu, inode=%lu, rec_len=%d, name_len=%d",
88 dir->i_ino, error_msg, offset, 88 dir->i_ino, error_msg, offset,
@@ -91,8 +91,8 @@ int ext4_check_dir_entry (const char * function, struct inode * dir,
91 return error_msg == NULL ? 1 : 0; 91 return error_msg == NULL ? 1 : 0;
92} 92}
93 93
94static int ext4_readdir(struct file * filp, 94static int ext4_readdir(struct file *filp,
95 void * dirent, filldir_t filldir) 95 void *dirent, filldir_t filldir)
96{ 96{
97 int error = 0; 97 int error = 0;
98 unsigned long offset; 98 unsigned long offset;
@@ -148,7 +148,7 @@ static int ext4_readdir(struct file * filp,
148 * of recovering data when there's a bad sector 148 * of recovering data when there's a bad sector
149 */ 149 */
150 if (!bh) { 150 if (!bh) {
151 ext4_error (sb, "ext4_readdir", 151 ext4_error(sb, "ext4_readdir",
152 "directory #%lu contains a hole at offset %lu", 152 "directory #%lu contains a hole at offset %lu",
153 inode->i_ino, (unsigned long)filp->f_pos); 153 inode->i_ino, (unsigned long)filp->f_pos);
154 /* corrupt size? Maybe no more blocks to read */ 154 /* corrupt size? Maybe no more blocks to read */
@@ -187,14 +187,14 @@ revalidate:
187 while (!error && filp->f_pos < inode->i_size 187 while (!error && filp->f_pos < inode->i_size
188 && offset < sb->s_blocksize) { 188 && offset < sb->s_blocksize) {
189 de = (struct ext4_dir_entry_2 *) (bh->b_data + offset); 189 de = (struct ext4_dir_entry_2 *) (bh->b_data + offset);
190 if (!ext4_check_dir_entry ("ext4_readdir", inode, de, 190 if (!ext4_check_dir_entry("ext4_readdir", inode, de,
191 bh, offset)) { 191 bh, offset)) {
192 /* 192 /*
193 * On error, skip the f_pos to the next block 193 * On error, skip the f_pos to the next block
194 */ 194 */
195 filp->f_pos = (filp->f_pos | 195 filp->f_pos = (filp->f_pos |
196 (sb->s_blocksize - 1)) + 1; 196 (sb->s_blocksize - 1)) + 1;
197 brelse (bh); 197 brelse(bh);
198 ret = stored; 198 ret = stored;
199 goto out; 199 goto out;
200 } 200 }
@@ -218,12 +218,12 @@ revalidate:
218 break; 218 break;
219 if (version != filp->f_version) 219 if (version != filp->f_version)
220 goto revalidate; 220 goto revalidate;
221 stored ++; 221 stored++;
222 } 222 }
223 filp->f_pos += ext4_rec_len_from_disk(de->rec_len); 223 filp->f_pos += ext4_rec_len_from_disk(de->rec_len);
224 } 224 }
225 offset = 0; 225 offset = 0;
226 brelse (bh); 226 brelse(bh);
227 } 227 }
228out: 228out:
229 return ret; 229 return ret;
@@ -290,9 +290,9 @@ static void free_rb_tree_fname(struct rb_root *root)
290 parent = rb_parent(n); 290 parent = rb_parent(n);
291 fname = rb_entry(n, struct fname, rb_hash); 291 fname = rb_entry(n, struct fname, rb_hash);
292 while (fname) { 292 while (fname) {
293 struct fname * old = fname; 293 struct fname *old = fname;
294 fname = fname->next; 294 fname = fname->next;
295 kfree (old); 295 kfree(old);
296 } 296 }
297 if (!parent) 297 if (!parent)
298 root->rb_node = NULL; 298 root->rb_node = NULL;
@@ -331,7 +331,7 @@ int ext4_htree_store_dirent(struct file *dir_file, __u32 hash,
331 struct ext4_dir_entry_2 *dirent) 331 struct ext4_dir_entry_2 *dirent)
332{ 332{
333 struct rb_node **p, *parent = NULL; 333 struct rb_node **p, *parent = NULL;
334 struct fname * fname, *new_fn; 334 struct fname *fname, *new_fn;
335 struct dir_private_info *info; 335 struct dir_private_info *info;
336 int len; 336 int len;
337 337
@@ -388,13 +388,13 @@ int ext4_htree_store_dirent(struct file *dir_file, __u32 hash,
388 * for all entres on the fname linked list. (Normally there is only 388 * for all entres on the fname linked list. (Normally there is only
389 * one entry on the linked list, unless there are 62 bit hash collisions.) 389 * one entry on the linked list, unless there are 62 bit hash collisions.)
390 */ 390 */
391static int call_filldir(struct file * filp, void * dirent, 391static int call_filldir(struct file *filp, void *dirent,
392 filldir_t filldir, struct fname *fname) 392 filldir_t filldir, struct fname *fname)
393{ 393{
394 struct dir_private_info *info = filp->private_data; 394 struct dir_private_info *info = filp->private_data;
395 loff_t curr_pos; 395 loff_t curr_pos;
396 struct inode *inode = filp->f_path.dentry->d_inode; 396 struct inode *inode = filp->f_path.dentry->d_inode;
397 struct super_block * sb; 397 struct super_block *sb;
398 int error; 398 int error;
399 399
400 sb = inode->i_sb; 400 sb = inode->i_sb;
@@ -420,8 +420,8 @@ static int call_filldir(struct file * filp, void * dirent,
420 return 0; 420 return 0;
421} 421}
422 422
423static int ext4_dx_readdir(struct file * filp, 423static int ext4_dx_readdir(struct file *filp,
424 void * dirent, filldir_t filldir) 424 void *dirent, filldir_t filldir)
425{ 425{
426 struct dir_private_info *info = filp->private_data; 426 struct dir_private_info *info = filp->private_data;
427 struct inode *inode = filp->f_path.dentry->d_inode; 427 struct inode *inode = filp->f_path.dentry->d_inode;
@@ -512,7 +512,7 @@ finished:
512 return 0; 512 return 0;
513} 513}
514 514
515static int ext4_release_dir (struct inode * inode, struct file * filp) 515static int ext4_release_dir(struct inode *inode, struct file *filp)
516{ 516{
517 if (filp->private_data) 517 if (filp->private_data)
518 ext4_htree_free_dir_info(filp->private_data); 518 ext4_htree_free_dir_info(filp->private_data);
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 295003241d3d..8c701318844d 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -44,9 +44,9 @@
44#ifdef EXT4FS_DEBUG 44#ifdef EXT4FS_DEBUG
45#define ext4_debug(f, a...) \ 45#define ext4_debug(f, a...) \
46 do { \ 46 do { \
47 printk (KERN_DEBUG "EXT4-fs DEBUG (%s, %d): %s:", \ 47 printk(KERN_DEBUG "EXT4-fs DEBUG (%s, %d): %s:", \
48 __FILE__, __LINE__, __func__); \ 48 __FILE__, __LINE__, __func__); \
49 printk (KERN_DEBUG f, ## a); \ 49 printk(KERN_DEBUG f, ## a); \
50 } while (0) 50 } while (0)
51#else 51#else
52#define ext4_debug(f, a...) do {} while (0) 52#define ext4_debug(f, a...) do {} while (0)
@@ -128,7 +128,7 @@ struct ext4_allocation_request {
128#else 128#else
129# define EXT4_BLOCK_SIZE(s) (EXT4_MIN_BLOCK_SIZE << (s)->s_log_block_size) 129# define EXT4_BLOCK_SIZE(s) (EXT4_MIN_BLOCK_SIZE << (s)->s_log_block_size)
130#endif 130#endif
131#define EXT4_ADDR_PER_BLOCK(s) (EXT4_BLOCK_SIZE(s) / sizeof (__u32)) 131#define EXT4_ADDR_PER_BLOCK(s) (EXT4_BLOCK_SIZE(s) / sizeof(__u32))
132#ifdef __KERNEL__ 132#ifdef __KERNEL__
133# define EXT4_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits) 133# define EXT4_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
134#else 134#else
@@ -292,7 +292,7 @@ struct ext4_new_group_data {
292#define EXT4_IOC_GETVERSION _IOR('f', 3, long) 292#define EXT4_IOC_GETVERSION _IOR('f', 3, long)
293#define EXT4_IOC_SETVERSION _IOW('f', 4, long) 293#define EXT4_IOC_SETVERSION _IOW('f', 4, long)
294#define EXT4_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long) 294#define EXT4_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long)
295#define EXT4_IOC_GROUP_ADD _IOW('f', 8,struct ext4_new_group_input) 295#define EXT4_IOC_GROUP_ADD _IOW('f', 8, struct ext4_new_group_input)
296#define EXT4_IOC_GETVERSION_OLD FS_IOC_GETVERSION 296#define EXT4_IOC_GETVERSION_OLD FS_IOC_GETVERSION
297#define EXT4_IOC_SETVERSION_OLD FS_IOC_SETVERSION 297#define EXT4_IOC_SETVERSION_OLD FS_IOC_SETVERSION
298#ifdef CONFIG_JBD2_DEBUG 298#ifdef CONFIG_JBD2_DEBUG
@@ -667,7 +667,7 @@ struct ext4_super_block {
667}; 667};
668 668
669#ifdef __KERNEL__ 669#ifdef __KERNEL__
670static inline struct ext4_sb_info * EXT4_SB(struct super_block *sb) 670static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb)
671{ 671{
672 return sb->s_fs_info; 672 return sb->s_fs_info;
673} 673}
@@ -725,11 +725,11 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
725 */ 725 */
726 726
727#define EXT4_HAS_COMPAT_FEATURE(sb,mask) \ 727#define EXT4_HAS_COMPAT_FEATURE(sb,mask) \
728 ( EXT4_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) ) 728 (EXT4_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask))
729#define EXT4_HAS_RO_COMPAT_FEATURE(sb,mask) \ 729#define EXT4_HAS_RO_COMPAT_FEATURE(sb,mask) \
730 ( EXT4_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) ) 730 (EXT4_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask))
731#define EXT4_HAS_INCOMPAT_FEATURE(sb,mask) \ 731#define EXT4_HAS_INCOMPAT_FEATURE(sb,mask) \
732 ( EXT4_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) ) 732 (EXT4_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask))
733#define EXT4_SET_COMPAT_FEATURE(sb,mask) \ 733#define EXT4_SET_COMPAT_FEATURE(sb,mask) \
734 EXT4_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask) 734 EXT4_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask)
735#define EXT4_SET_RO_COMPAT_FEATURE(sb,mask) \ 735#define EXT4_SET_RO_COMPAT_FEATURE(sb,mask) \
@@ -985,13 +985,13 @@ extern ext4_fsblk_t ext4_old_new_blocks(handle_t *handle, struct inode *inode,
985 ext4_fsblk_t goal, unsigned long *count, int *errp); 985 ext4_fsblk_t goal, unsigned long *count, int *errp);
986extern ext4_fsblk_t ext4_has_free_blocks(struct ext4_sb_info *sbi, 986extern ext4_fsblk_t ext4_has_free_blocks(struct ext4_sb_info *sbi,
987 ext4_fsblk_t nblocks); 987 ext4_fsblk_t nblocks);
988extern void ext4_free_blocks (handle_t *handle, struct inode *inode, 988extern void ext4_free_blocks(handle_t *handle, struct inode *inode,
989 ext4_fsblk_t block, unsigned long count, int metadata); 989 ext4_fsblk_t block, unsigned long count, int metadata);
990extern void ext4_free_blocks_sb (handle_t *handle, struct super_block *sb, 990extern void ext4_free_blocks_sb(handle_t *handle, struct super_block *sb,
991 ext4_fsblk_t block, unsigned long count, 991 ext4_fsblk_t block, unsigned long count,
992 unsigned long *pdquot_freed_blocks); 992 unsigned long *pdquot_freed_blocks);
993extern ext4_fsblk_t ext4_count_free_blocks (struct super_block *); 993extern ext4_fsblk_t ext4_count_free_blocks(struct super_block *);
994extern void ext4_check_blocks_bitmap (struct super_block *); 994extern void ext4_check_blocks_bitmap(struct super_block *);
995extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb, 995extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
996 ext4_group_t block_group, 996 ext4_group_t block_group,
997 struct buffer_head ** bh); 997 struct buffer_head ** bh);
@@ -1009,20 +1009,20 @@ extern int ext4_htree_store_dirent(struct file *dir_file, __u32 hash,
1009extern void ext4_htree_free_dir_info(struct dir_private_info *p); 1009extern void ext4_htree_free_dir_info(struct dir_private_info *p);
1010 1010
1011/* fsync.c */ 1011/* fsync.c */
1012extern int ext4_sync_file (struct file *, struct dentry *, int); 1012extern int ext4_sync_file(struct file *, struct dentry *, int);
1013 1013
1014/* hash.c */ 1014/* hash.c */
1015extern int ext4fs_dirhash(const char *name, int len, struct 1015extern int ext4fs_dirhash(const char *name, int len, struct
1016 dx_hash_info *hinfo); 1016 dx_hash_info *hinfo);
1017 1017
1018/* ialloc.c */ 1018/* ialloc.c */
1019extern struct inode * ext4_new_inode (handle_t *, struct inode *, int); 1019extern struct inode * ext4_new_inode(handle_t *, struct inode *, int);
1020extern void ext4_free_inode (handle_t *, struct inode *); 1020extern void ext4_free_inode(handle_t *, struct inode *);
1021extern struct inode * ext4_orphan_get (struct super_block *, unsigned long); 1021extern struct inode * ext4_orphan_get(struct super_block *, unsigned long);
1022extern unsigned long ext4_count_free_inodes (struct super_block *); 1022extern unsigned long ext4_count_free_inodes(struct super_block *);
1023extern unsigned long ext4_count_dirs (struct super_block *); 1023extern unsigned long ext4_count_dirs(struct super_block *);
1024extern void ext4_check_inodes_bitmap (struct super_block *); 1024extern void ext4_check_inodes_bitmap(struct super_block *);
1025extern unsigned long ext4_count_free (struct buffer_head *, unsigned); 1025extern unsigned long ext4_count_free(struct buffer_head *, unsigned);
1026 1026
1027/* mballoc.c */ 1027/* mballoc.c */
1028extern long ext4_mb_stats; 1028extern long ext4_mb_stats;
@@ -1056,18 +1056,18 @@ int ext4_get_blocks_handle(handle_t *handle, struct inode *inode,
1056 int create, int extend_disksize); 1056 int create, int extend_disksize);
1057 1057
1058extern struct inode *ext4_iget(struct super_block *, unsigned long); 1058extern struct inode *ext4_iget(struct super_block *, unsigned long);
1059extern int ext4_write_inode (struct inode *, int); 1059extern int ext4_write_inode(struct inode *, int);
1060extern int ext4_setattr (struct dentry *, struct iattr *); 1060extern int ext4_setattr(struct dentry *, struct iattr *);
1061extern int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry, 1061extern int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry,
1062 struct kstat *stat); 1062 struct kstat *stat);
1063extern void ext4_delete_inode (struct inode *); 1063extern void ext4_delete_inode(struct inode *);
1064extern int ext4_sync_inode (handle_t *, struct inode *); 1064extern int ext4_sync_inode(handle_t *, struct inode *);
1065extern void ext4_discard_reservation (struct inode *); 1065extern void ext4_discard_reservation(struct inode *);
1066extern void ext4_dirty_inode(struct inode *); 1066extern void ext4_dirty_inode(struct inode *);
1067extern int ext4_change_inode_journal_flag(struct inode *, int); 1067extern int ext4_change_inode_journal_flag(struct inode *, int);
1068extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *); 1068extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *);
1069extern int ext4_can_truncate(struct inode *inode); 1069extern int ext4_can_truncate(struct inode *inode);
1070extern void ext4_truncate (struct inode *); 1070extern void ext4_truncate(struct inode *);
1071extern void ext4_set_inode_flags(struct inode *); 1071extern void ext4_set_inode_flags(struct inode *);
1072extern void ext4_get_inode_flags(struct ext4_inode_info *); 1072extern void ext4_get_inode_flags(struct ext4_inode_info *);
1073extern void ext4_set_aops(struct inode *inode); 1073extern void ext4_set_aops(struct inode *inode);
@@ -1080,7 +1080,7 @@ extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct page *page);
1080 1080
1081/* ioctl.c */ 1081/* ioctl.c */
1082extern long ext4_ioctl(struct file *, unsigned int, unsigned long); 1082extern long ext4_ioctl(struct file *, unsigned int, unsigned long);
1083extern long ext4_compat_ioctl (struct file *, unsigned int, unsigned long); 1083extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long);
1084 1084
1085/* migrate.c */ 1085/* migrate.c */
1086extern int ext4_ext_migrate(struct inode *, struct file *, unsigned int, 1086extern int ext4_ext_migrate(struct inode *, struct file *, unsigned int,
@@ -1099,14 +1099,14 @@ extern int ext4_group_extend(struct super_block *sb,
1099 ext4_fsblk_t n_blocks_count); 1099 ext4_fsblk_t n_blocks_count);
1100 1100
1101/* super.c */ 1101/* super.c */
1102extern void ext4_error (struct super_block *, const char *, const char *, ...) 1102extern void ext4_error(struct super_block *, const char *, const char *, ...)
1103 __attribute__ ((format (printf, 3, 4))); 1103 __attribute__ ((format (printf, 3, 4)));
1104extern void __ext4_std_error (struct super_block *, const char *, int); 1104extern void __ext4_std_error(struct super_block *, const char *, int);
1105extern void ext4_abort (struct super_block *, const char *, const char *, ...) 1105extern void ext4_abort(struct super_block *, const char *, const char *, ...)
1106 __attribute__ ((format (printf, 3, 4))); 1106 __attribute__ ((format (printf, 3, 4)));
1107extern void ext4_warning (struct super_block *, const char *, const char *, ...) 1107extern void ext4_warning(struct super_block *, const char *, const char *, ...)
1108 __attribute__ ((format (printf, 3, 4))); 1108 __attribute__ ((format (printf, 3, 4)));
1109extern void ext4_update_dynamic_rev (struct super_block *sb); 1109extern void ext4_update_dynamic_rev(struct super_block *sb);
1110extern int ext4_update_compat_feature(handle_t *handle, struct super_block *sb, 1110extern int ext4_update_compat_feature(handle_t *handle, struct super_block *sb,
1111 __u32 compat); 1111 __u32 compat);
1112extern int ext4_update_rocompat_feature(handle_t *handle, 1112extern int ext4_update_rocompat_feature(handle_t *handle,
@@ -1179,7 +1179,7 @@ static inline void ext4_isize_set(struct ext4_inode *raw_inode, loff_t i_size)
1179 1179
1180static inline 1180static inline
1181struct ext4_group_info *ext4_get_group_info(struct super_block *sb, 1181struct ext4_group_info *ext4_get_group_info(struct super_block *sb,
1182 ext4_group_t group) 1182 ext4_group_t group)
1183{ 1183{
1184 struct ext4_group_info ***grp_info; 1184 struct ext4_group_info ***grp_info;
1185 long indexv, indexh; 1185 long indexv, indexh;
diff --git a/fs/ext4/ext4_sb.h b/fs/ext4/ext4_sb.h
index 6300226d5531..69810a252539 100644
--- a/fs/ext4/ext4_sb.h
+++ b/fs/ext4/ext4_sb.h
@@ -40,8 +40,8 @@ struct ext4_sb_info {
40 unsigned long s_blocks_last; /* Last seen block count */ 40 unsigned long s_blocks_last; /* Last seen block count */
41 loff_t s_bitmap_maxbytes; /* max bytes for bitmap files */ 41 loff_t s_bitmap_maxbytes; /* max bytes for bitmap files */
42 struct buffer_head * s_sbh; /* Buffer containing the super block */ 42 struct buffer_head * s_sbh; /* Buffer containing the super block */
43 struct ext4_super_block * s_es; /* Pointer to the super block in the buffer */ 43 struct ext4_super_block *s_es; /* Pointer to the super block in the buffer */
44 struct buffer_head ** s_group_desc; 44 struct buffer_head **s_group_desc;
45 unsigned long s_mount_opt; 45 unsigned long s_mount_opt;
46 ext4_fsblk_t s_sb_block; 46 ext4_fsblk_t s_sb_block;
47 uid_t s_resuid; 47 uid_t s_resuid;
@@ -67,8 +67,8 @@ struct ext4_sb_info {
67 struct ext4_reserve_window_node s_rsv_window_head; 67 struct ext4_reserve_window_node s_rsv_window_head;
68 68
69 /* Journaling */ 69 /* Journaling */
70 struct inode * s_journal_inode; 70 struct inode *s_journal_inode;
71 struct journal_s * s_journal; 71 struct journal_s *s_journal;
72 struct list_head s_orphan; 72 struct list_head s_orphan;
73 unsigned long s_commit_interval; 73 unsigned long s_commit_interval;
74 struct block_device *journal_bdev; 74 struct block_device *journal_bdev;
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index a8db7fdf9cb7..797f0602a68f 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -383,8 +383,8 @@ static void ext4_ext_show_leaf(struct inode *inode, struct ext4_ext_path *path)
383 ext_debug("\n"); 383 ext_debug("\n");
384} 384}
385#else 385#else
386#define ext4_ext_show_path(inode,path) 386#define ext4_ext_show_path(inode, path)
387#define ext4_ext_show_leaf(inode,path) 387#define ext4_ext_show_leaf(inode, path)
388#endif 388#endif
389 389
390void ext4_ext_drop_refs(struct ext4_ext_path *path) 390void ext4_ext_drop_refs(struct ext4_ext_path *path)
@@ -1476,7 +1476,7 @@ int ext4_ext_insert_extent(handle_t *handle, struct inode *inode,
1476 struct ext4_ext_path *path, 1476 struct ext4_ext_path *path,
1477 struct ext4_extent *newext) 1477 struct ext4_extent *newext)
1478{ 1478{
1479 struct ext4_extent_header * eh; 1479 struct ext4_extent_header *eh;
1480 struct ext4_extent *ex, *fex; 1480 struct ext4_extent *ex, *fex;
1481 struct ext4_extent *nearex; /* nearest extent */ 1481 struct ext4_extent *nearex; /* nearest extent */
1482 struct ext4_ext_path *npath = NULL; 1482 struct ext4_ext_path *npath = NULL;
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 430eb7978db4..11b289f42b7d 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -31,7 +31,7 @@
31 * from ext4_file_open: open gets called at every open, but release 31 * from ext4_file_open: open gets called at every open, but release
32 * gets called only when /all/ the files are closed. 32 * gets called only when /all/ the files are closed.
33 */ 33 */
34static int ext4_release_file (struct inode * inode, struct file * filp) 34static int ext4_release_file(struct inode *inode, struct file *filp)
35{ 35{
36 /* if we are the last writer on the inode, drop the block reservation */ 36 /* if we are the last writer on the inode, drop the block reservation */
37 if ((filp->f_mode & FMODE_WRITE) && 37 if ((filp->f_mode & FMODE_WRITE) &&
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index a45c3737ad31..c37d1e86f51a 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -43,7 +43,7 @@
43 * inode to disk. 43 * inode to disk.
44 */ 44 */
45 45
46int ext4_sync_file(struct file * file, struct dentry *dentry, int datasync) 46int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync)
47{ 47{
48 struct inode *inode = dentry->d_inode; 48 struct inode *inode = dentry->d_inode;
49 journal_t *journal = EXT4_SB(inode->i_sb)->s_journal; 49 journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
diff --git a/fs/ext4/hash.c b/fs/ext4/hash.c
index 1d6329dbe390..556ca8eba3db 100644
--- a/fs/ext4/hash.c
+++ b/fs/ext4/hash.c
@@ -27,7 +27,7 @@ static void TEA_transform(__u32 buf[4], __u32 const in[])
27 sum += DELTA; 27 sum += DELTA;
28 b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b); 28 b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b);
29 b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d); 29 b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d);
30 } while(--n); 30 } while (--n);
31 31
32 buf[0] += b0; 32 buf[0] += b0;
33 buf[1] += b1; 33 buf[1] += b1;
@@ -35,7 +35,7 @@ static void TEA_transform(__u32 buf[4], __u32 const in[])
35 35
36 36
37/* The old legacy hash */ 37/* The old legacy hash */
38static __u32 dx_hack_hash (const char *name, int len) 38static __u32 dx_hack_hash(const char *name, int len)
39{ 39{
40 __u32 hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9; 40 __u32 hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9;
41 while (len--) { 41 while (len--) {
@@ -59,7 +59,7 @@ static void str2hashbuf(const char *msg, int len, __u32 *buf, int num)
59 val = pad; 59 val = pad;
60 if (len > num*4) 60 if (len > num*4)
61 len = num * 4; 61 len = num * 4;
62 for (i=0; i < len; i++) { 62 for (i = 0; i < len; i++) {
63 if ((i % 4) == 0) 63 if ((i % 4) == 0)
64 val = pad; 64 val = pad;
65 val = msg[i] + (val << 8); 65 val = msg[i] + (val << 8);
@@ -104,7 +104,7 @@ int ext4fs_dirhash(const char *name, int len, struct dx_hash_info *hinfo)
104 104
105 /* Check to see if the seed is all zero's */ 105 /* Check to see if the seed is all zero's */
106 if (hinfo->seed) { 106 if (hinfo->seed) {
107 for (i=0; i < 4; i++) { 107 for (i = 0; i < 4; i++) {
108 if (hinfo->seed[i]) 108 if (hinfo->seed[i])
109 break; 109 break;
110 } 110 }
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 45c66a03f182..5e66a2feef09 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -154,17 +154,17 @@ ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
154 * though), and then we'd have two inodes sharing the 154 * though), and then we'd have two inodes sharing the
155 * same inode number and space on the harddisk. 155 * same inode number and space on the harddisk.
156 */ 156 */
157void ext4_free_inode (handle_t *handle, struct inode * inode) 157void ext4_free_inode(handle_t *handle, struct inode *inode)
158{ 158{
159 struct super_block * sb = inode->i_sb; 159 struct super_block *sb = inode->i_sb;
160 int is_directory; 160 int is_directory;
161 unsigned long ino; 161 unsigned long ino;
162 struct buffer_head *bitmap_bh = NULL; 162 struct buffer_head *bitmap_bh = NULL;
163 struct buffer_head *bh2; 163 struct buffer_head *bh2;
164 ext4_group_t block_group; 164 ext4_group_t block_group;
165 unsigned long bit; 165 unsigned long bit;
166 struct ext4_group_desc * gdp; 166 struct ext4_group_desc *gdp;
167 struct ext4_super_block * es; 167 struct ext4_super_block *es;
168 struct ext4_sb_info *sbi; 168 struct ext4_sb_info *sbi;
169 int fatal = 0, err; 169 int fatal = 0, err;
170 ext4_group_t flex_group; 170 ext4_group_t flex_group;
@@ -187,7 +187,7 @@ void ext4_free_inode (handle_t *handle, struct inode * inode)
187 sbi = EXT4_SB(sb); 187 sbi = EXT4_SB(sb);
188 188
189 ino = inode->i_ino; 189 ino = inode->i_ino;
190 ext4_debug ("freeing inode %lu\n", ino); 190 ext4_debug("freeing inode %lu\n", ino);
191 191
192 /* 192 /*
193 * Note: we must free any quota before locking the superblock, 193 * Note: we must free any quota before locking the superblock,
@@ -201,12 +201,12 @@ void ext4_free_inode (handle_t *handle, struct inode * inode)
201 is_directory = S_ISDIR(inode->i_mode); 201 is_directory = S_ISDIR(inode->i_mode);
202 202
203 /* Do this BEFORE marking the inode not in use or returning an error */ 203 /* Do this BEFORE marking the inode not in use or returning an error */
204 clear_inode (inode); 204 clear_inode(inode);
205 205
206 es = EXT4_SB(sb)->s_es; 206 es = EXT4_SB(sb)->s_es;
207 if (ino < EXT4_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) { 207 if (ino < EXT4_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) {
208 ext4_error (sb, "ext4_free_inode", 208 ext4_error(sb, "ext4_free_inode",
209 "reserved or nonexistent inode %lu", ino); 209 "reserved or nonexistent inode %lu", ino);
210 goto error_return; 210 goto error_return;
211 } 211 }
212 block_group = (ino - 1) / EXT4_INODES_PER_GROUP(sb); 212 block_group = (ino - 1) / EXT4_INODES_PER_GROUP(sb);
@@ -223,10 +223,10 @@ void ext4_free_inode (handle_t *handle, struct inode * inode)
223 /* Ok, now we can actually update the inode bitmaps.. */ 223 /* Ok, now we can actually update the inode bitmaps.. */
224 if (!ext4_clear_bit_atomic(sb_bgl_lock(sbi, block_group), 224 if (!ext4_clear_bit_atomic(sb_bgl_lock(sbi, block_group),
225 bit, bitmap_bh->b_data)) 225 bit, bitmap_bh->b_data))
226 ext4_error (sb, "ext4_free_inode", 226 ext4_error(sb, "ext4_free_inode",
227 "bit already cleared for inode %lu", ino); 227 "bit already cleared for inode %lu", ino);
228 else { 228 else {
229 gdp = ext4_get_group_desc (sb, block_group, &bh2); 229 gdp = ext4_get_group_desc(sb, block_group, &bh2);
230 230
231 BUFFER_TRACE(bh2, "get_write_access"); 231 BUFFER_TRACE(bh2, "get_write_access");
232 fatal = ext4_journal_get_write_access(handle, bh2); 232 fatal = ext4_journal_get_write_access(handle, bh2);
@@ -288,7 +288,7 @@ static int find_group_dir(struct super_block *sb, struct inode *parent,
288 avefreei = freei / ngroups; 288 avefreei = freei / ngroups;
289 289
290 for (group = 0; group < ngroups; group++) { 290 for (group = 0; group < ngroups; group++) {
291 desc = ext4_get_group_desc (sb, group, NULL); 291 desc = ext4_get_group_desc(sb, group, NULL);
292 if (!desc || !desc->bg_free_inodes_count) 292 if (!desc || !desc->bg_free_inodes_count)
293 continue; 293 continue;
294 if (le16_to_cpu(desc->bg_free_inodes_count) < avefreei) 294 if (le16_to_cpu(desc->bg_free_inodes_count) < avefreei)
@@ -577,16 +577,16 @@ static int find_group_other(struct super_block *sb, struct inode *parent,
577 * For other inodes, search forward from the parent directory's block 577 * For other inodes, search forward from the parent directory's block
578 * group to find a free inode. 578 * group to find a free inode.
579 */ 579 */
580struct inode *ext4_new_inode(handle_t *handle, struct inode * dir, int mode) 580struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, int mode)
581{ 581{
582 struct super_block *sb; 582 struct super_block *sb;
583 struct buffer_head *bitmap_bh = NULL; 583 struct buffer_head *bitmap_bh = NULL;
584 struct buffer_head *bh2; 584 struct buffer_head *bh2;
585 ext4_group_t group = 0; 585 ext4_group_t group = 0;
586 unsigned long ino = 0; 586 unsigned long ino = 0;
587 struct inode * inode; 587 struct inode *inode;
588 struct ext4_group_desc * gdp = NULL; 588 struct ext4_group_desc *gdp = NULL;
589 struct ext4_super_block * es; 589 struct ext4_super_block *es;
590 struct ext4_inode_info *ei; 590 struct ext4_inode_info *ei;
591 struct ext4_sb_info *sbi; 591 struct ext4_sb_info *sbi;
592 int ret2, err = 0; 592 int ret2, err = 0;
@@ -614,7 +614,7 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode * dir, int mode)
614 } 614 }
615 615
616 if (S_ISDIR(mode)) { 616 if (S_ISDIR(mode)) {
617 if (test_opt (sb, OLDALLOC)) 617 if (test_opt(sb, OLDALLOC))
618 ret2 = find_group_dir(sb, dir, &group); 618 ret2 = find_group_dir(sb, dir, &group);
619 else 619 else
620 ret2 = find_group_orlov(sb, dir, &group); 620 ret2 = find_group_orlov(sb, dir, &group);
@@ -784,7 +784,7 @@ got:
784 } 784 }
785 785
786 inode->i_uid = current->fsuid; 786 inode->i_uid = current->fsuid;
787 if (test_opt (sb, GRPID)) 787 if (test_opt(sb, GRPID))
788 inode->i_gid = dir->i_gid; 788 inode->i_gid = dir->i_gid;
789 else if (dir->i_mode & S_ISGID) { 789 else if (dir->i_mode & S_ISGID) {
790 inode->i_gid = dir->i_gid; 790 inode->i_gid = dir->i_gid;
@@ -833,7 +833,7 @@ got:
833 ei->i_extra_isize = EXT4_SB(sb)->s_want_extra_isize; 833 ei->i_extra_isize = EXT4_SB(sb)->s_want_extra_isize;
834 834
835 ret = inode; 835 ret = inode;
836 if(DQUOT_ALLOC_INODE(inode)) { 836 if (DQUOT_ALLOC_INODE(inode)) {
837 err = -EDQUOT; 837 err = -EDQUOT;
838 goto fail_drop; 838 goto fail_drop;
839 } 839 }
@@ -842,7 +842,7 @@ got:
842 if (err) 842 if (err)
843 goto fail_free_drop; 843 goto fail_free_drop;
844 844
845 err = ext4_init_security(handle,inode, dir); 845 err = ext4_init_security(handle, inode, dir);
846 if (err) 846 if (err)
847 goto fail_free_drop; 847 goto fail_free_drop;
848 848
@@ -960,7 +960,7 @@ error:
960 return ERR_PTR(err); 960 return ERR_PTR(err);
961} 961}
962 962
963unsigned long ext4_count_free_inodes (struct super_block * sb) 963unsigned long ext4_count_free_inodes(struct super_block *sb)
964{ 964{
965 unsigned long desc_count; 965 unsigned long desc_count;
966 struct ext4_group_desc *gdp; 966 struct ext4_group_desc *gdp;
@@ -975,7 +975,7 @@ unsigned long ext4_count_free_inodes (struct super_block * sb)
975 bitmap_count = 0; 975 bitmap_count = 0;
976 gdp = NULL; 976 gdp = NULL;
977 for (i = 0; i < EXT4_SB(sb)->s_groups_count; i++) { 977 for (i = 0; i < EXT4_SB(sb)->s_groups_count; i++) {
978 gdp = ext4_get_group_desc (sb, i, NULL); 978 gdp = ext4_get_group_desc(sb, i, NULL);
979 if (!gdp) 979 if (!gdp)
980 continue; 980 continue;
981 desc_count += le16_to_cpu(gdp->bg_free_inodes_count); 981 desc_count += le16_to_cpu(gdp->bg_free_inodes_count);
@@ -997,7 +997,7 @@ unsigned long ext4_count_free_inodes (struct super_block * sb)
997#else 997#else
998 desc_count = 0; 998 desc_count = 0;
999 for (i = 0; i < EXT4_SB(sb)->s_groups_count; i++) { 999 for (i = 0; i < EXT4_SB(sb)->s_groups_count; i++) {
1000 gdp = ext4_get_group_desc (sb, i, NULL); 1000 gdp = ext4_get_group_desc(sb, i, NULL);
1001 if (!gdp) 1001 if (!gdp)
1002 continue; 1002 continue;
1003 desc_count += le16_to_cpu(gdp->bg_free_inodes_count); 1003 desc_count += le16_to_cpu(gdp->bg_free_inodes_count);
@@ -1008,13 +1008,13 @@ unsigned long ext4_count_free_inodes (struct super_block * sb)
1008} 1008}
1009 1009
1010/* Called at mount-time, super-block is locked */ 1010/* Called at mount-time, super-block is locked */
1011unsigned long ext4_count_dirs (struct super_block * sb) 1011unsigned long ext4_count_dirs(struct super_block * sb)
1012{ 1012{
1013 unsigned long count = 0; 1013 unsigned long count = 0;
1014 ext4_group_t i; 1014 ext4_group_t i;
1015 1015
1016 for (i = 0; i < EXT4_SB(sb)->s_groups_count; i++) { 1016 for (i = 0; i < EXT4_SB(sb)->s_groups_count; i++) {
1017 struct ext4_group_desc *gdp = ext4_get_group_desc (sb, i, NULL); 1017 struct ext4_group_desc *gdp = ext4_get_group_desc(sb, i, NULL);
1018 if (!gdp) 1018 if (!gdp)
1019 continue; 1019 continue;
1020 count += le16_to_cpu(gdp->bg_used_dirs_count); 1020 count += le16_to_cpu(gdp->bg_used_dirs_count);
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 7e91913e325b..89c92c0f8297 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -190,7 +190,7 @@ static int ext4_journal_test_restart(handle_t *handle, struct inode *inode)
190/* 190/*
191 * Called at the last iput() if i_nlink is zero. 191 * Called at the last iput() if i_nlink is zero.
192 */ 192 */
193void ext4_delete_inode (struct inode * inode) 193void ext4_delete_inode(struct inode *inode)
194{ 194{
195 handle_t *handle; 195 handle_t *handle;
196 int err; 196 int err;
@@ -330,11 +330,11 @@ static int ext4_block_to_path(struct inode *inode,
330 int final = 0; 330 int final = 0;
331 331
332 if (i_block < 0) { 332 if (i_block < 0) {
333 ext4_warning (inode->i_sb, "ext4_block_to_path", "block < 0"); 333 ext4_warning(inode->i_sb, "ext4_block_to_path", "block < 0");
334 } else if (i_block < direct_blocks) { 334 } else if (i_block < direct_blocks) {
335 offsets[n++] = i_block; 335 offsets[n++] = i_block;
336 final = direct_blocks; 336 final = direct_blocks;
337 } else if ( (i_block -= direct_blocks) < indirect_blocks) { 337 } else if ((i_block -= direct_blocks) < indirect_blocks) {
338 offsets[n++] = EXT4_IND_BLOCK; 338 offsets[n++] = EXT4_IND_BLOCK;
339 offsets[n++] = i_block; 339 offsets[n++] = i_block;
340 final = ptrs; 340 final = ptrs;
@@ -400,14 +400,14 @@ static Indirect *ext4_get_branch(struct inode *inode, int depth,
400 400
401 *err = 0; 401 *err = 0;
402 /* i_data is not going away, no lock needed */ 402 /* i_data is not going away, no lock needed */
403 add_chain (chain, NULL, EXT4_I(inode)->i_data + *offsets); 403 add_chain(chain, NULL, EXT4_I(inode)->i_data + *offsets);
404 if (!p->key) 404 if (!p->key)
405 goto no_block; 405 goto no_block;
406 while (--depth) { 406 while (--depth) {
407 bh = sb_bread(sb, le32_to_cpu(p->key)); 407 bh = sb_bread(sb, le32_to_cpu(p->key));
408 if (!bh) 408 if (!bh)
409 goto failure; 409 goto failure;
410 add_chain(++p, bh, (__le32*)bh->b_data + *++offsets); 410 add_chain(++p, bh, (__le32 *)bh->b_data + *++offsets);
411 /* Reader: end */ 411 /* Reader: end */
412 if (!p->key) 412 if (!p->key)
413 goto no_block; 413 goto no_block;
@@ -443,7 +443,7 @@ no_block:
443static ext4_fsblk_t ext4_find_near(struct inode *inode, Indirect *ind) 443static ext4_fsblk_t ext4_find_near(struct inode *inode, Indirect *ind)
444{ 444{
445 struct ext4_inode_info *ei = EXT4_I(inode); 445 struct ext4_inode_info *ei = EXT4_I(inode);
446 __le32 *start = ind->bh ? (__le32*) ind->bh->b_data : ei->i_data; 446 __le32 *start = ind->bh ? (__le32 *) ind->bh->b_data : ei->i_data;
447 __le32 *p; 447 __le32 *p;
448 ext4_fsblk_t bg_start; 448 ext4_fsblk_t bg_start;
449 ext4_fsblk_t last_block; 449 ext4_fsblk_t last_block;
@@ -630,7 +630,7 @@ allocated:
630 *err = 0; 630 *err = 0;
631 return ret; 631 return ret;
632failed_out: 632failed_out:
633 for (i = 0; i <index; i++) 633 for (i = 0; i < index; i++)
634 ext4_free_blocks(handle, inode, new_blocks[i], 1, 0); 634 ext4_free_blocks(handle, inode, new_blocks[i], 1, 0);
635 return ret; 635 return ret;
636} 636}
@@ -703,7 +703,7 @@ static int ext4_alloc_branch(handle_t *handle, struct inode *inode,
703 branch[n].p = (__le32 *) bh->b_data + offsets[n]; 703 branch[n].p = (__le32 *) bh->b_data + offsets[n];
704 branch[n].key = cpu_to_le32(new_blocks[n]); 704 branch[n].key = cpu_to_le32(new_blocks[n]);
705 *branch[n].p = branch[n].key; 705 *branch[n].p = branch[n].key;
706 if ( n == indirect_blks) { 706 if (n == indirect_blks) {
707 current_block = new_blocks[n]; 707 current_block = new_blocks[n];
708 /* 708 /*
709 * End of chain, update the last new metablock of 709 * End of chain, update the last new metablock of
@@ -730,7 +730,7 @@ failed:
730 BUFFER_TRACE(branch[i].bh, "call jbd2_journal_forget"); 730 BUFFER_TRACE(branch[i].bh, "call jbd2_journal_forget");
731 ext4_journal_forget(handle, branch[i].bh); 731 ext4_journal_forget(handle, branch[i].bh);
732 } 732 }
733 for (i = 0; i <indirect_blks; i++) 733 for (i = 0; i < indirect_blks; i++)
734 ext4_free_blocks(handle, inode, new_blocks[i], 1, 0); 734 ext4_free_blocks(handle, inode, new_blocks[i], 1, 0);
735 735
736 ext4_free_blocks(handle, inode, new_blocks[i], num, 0); 736 ext4_free_blocks(handle, inode, new_blocks[i], num, 0);
@@ -783,7 +783,7 @@ static int ext4_splice_branch(handle_t *handle, struct inode *inode,
783 if (num == 0 && blks > 1) { 783 if (num == 0 && blks > 1) {
784 current_block = le32_to_cpu(where->key) + 1; 784 current_block = le32_to_cpu(where->key) + 1;
785 for (i = 1; i < blks; i++) 785 for (i = 1; i < blks; i++)
786 *(where->p + i ) = cpu_to_le32(current_block++); 786 *(where->p + i) = cpu_to_le32(current_block++);
787 } 787 }
788 788
789 /* 789 /*
@@ -1241,7 +1241,7 @@ struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode,
1241 BUFFER_TRACE(bh, "call get_create_access"); 1241 BUFFER_TRACE(bh, "call get_create_access");
1242 fatal = ext4_journal_get_create_access(handle, bh); 1242 fatal = ext4_journal_get_create_access(handle, bh);
1243 if (!fatal && !buffer_uptodate(bh)) { 1243 if (!fatal && !buffer_uptodate(bh)) {
1244 memset(bh->b_data,0,inode->i_sb->s_blocksize); 1244 memset(bh->b_data, 0, inode->i_sb->s_blocksize);
1245 set_buffer_uptodate(bh); 1245 set_buffer_uptodate(bh);
1246 } 1246 }
1247 unlock_buffer(bh); 1247 unlock_buffer(bh);
@@ -1266,7 +1266,7 @@ err:
1266struct buffer_head *ext4_bread(handle_t *handle, struct inode *inode, 1266struct buffer_head *ext4_bread(handle_t *handle, struct inode *inode,
1267 ext4_lblk_t block, int create, int *err) 1267 ext4_lblk_t block, int create, int *err)
1268{ 1268{
1269 struct buffer_head * bh; 1269 struct buffer_head *bh;
1270 1270
1271 bh = ext4_getblk(handle, inode, block, create, err); 1271 bh = ext4_getblk(handle, inode, block, create, err);
1272 if (!bh) 1272 if (!bh)
@@ -1282,13 +1282,13 @@ struct buffer_head *ext4_bread(handle_t *handle, struct inode *inode,
1282 return NULL; 1282 return NULL;
1283} 1283}
1284 1284
1285static int walk_page_buffers( handle_t *handle, 1285static int walk_page_buffers(handle_t *handle,
1286 struct buffer_head *head, 1286 struct buffer_head *head,
1287 unsigned from, 1287 unsigned from,
1288 unsigned to, 1288 unsigned to,
1289 int *partial, 1289 int *partial,
1290 int (*fn)( handle_t *handle, 1290 int (*fn)(handle_t *handle,
1291 struct buffer_head *bh)) 1291 struct buffer_head *bh))
1292{ 1292{
1293 struct buffer_head *bh; 1293 struct buffer_head *bh;
1294 unsigned block_start, block_end; 1294 unsigned block_start, block_end;
@@ -1296,9 +1296,9 @@ static int walk_page_buffers( handle_t *handle,
1296 int err, ret = 0; 1296 int err, ret = 0;
1297 struct buffer_head *next; 1297 struct buffer_head *next;
1298 1298
1299 for ( bh = head, block_start = 0; 1299 for (bh = head, block_start = 0;
1300 ret == 0 && (bh != head || !block_start); 1300 ret == 0 && (bh != head || !block_start);
1301 block_start = block_end, bh = next) 1301 block_start = block_end, bh = next)
1302 { 1302 {
1303 next = bh->b_this_page; 1303 next = bh->b_this_page;
1304 block_end = block_start + blocksize; 1304 block_end = block_start + blocksize;
@@ -1351,23 +1351,23 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping,
1351 loff_t pos, unsigned len, unsigned flags, 1351 loff_t pos, unsigned len, unsigned flags,
1352 struct page **pagep, void **fsdata) 1352 struct page **pagep, void **fsdata)
1353{ 1353{
1354 struct inode *inode = mapping->host; 1354 struct inode *inode = mapping->host;
1355 int ret, needed_blocks = ext4_writepage_trans_blocks(inode); 1355 int ret, needed_blocks = ext4_writepage_trans_blocks(inode);
1356 handle_t *handle; 1356 handle_t *handle;
1357 int retries = 0; 1357 int retries = 0;
1358 struct page *page; 1358 struct page *page;
1359 pgoff_t index; 1359 pgoff_t index;
1360 unsigned from, to; 1360 unsigned from, to;
1361 1361
1362 index = pos >> PAGE_CACHE_SHIFT; 1362 index = pos >> PAGE_CACHE_SHIFT;
1363 from = pos & (PAGE_CACHE_SIZE - 1); 1363 from = pos & (PAGE_CACHE_SIZE - 1);
1364 to = from + len; 1364 to = from + len;
1365 1365
1366retry: 1366retry:
1367 handle = ext4_journal_start(inode, needed_blocks); 1367 handle = ext4_journal_start(inode, needed_blocks);
1368 if (IS_ERR(handle)) { 1368 if (IS_ERR(handle)) {
1369 ret = PTR_ERR(handle); 1369 ret = PTR_ERR(handle);
1370 goto out; 1370 goto out;
1371 } 1371 }
1372 1372
1373 page = __grab_cache_page(mapping, index); 1373 page = __grab_cache_page(mapping, index);
@@ -1387,9 +1387,9 @@ retry:
1387 } 1387 }
1388 1388
1389 if (ret) { 1389 if (ret) {
1390 unlock_page(page); 1390 unlock_page(page);
1391 ext4_journal_stop(handle); 1391 ext4_journal_stop(handle);
1392 page_cache_release(page); 1392 page_cache_release(page);
1393 } 1393 }
1394 1394
1395 if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) 1395 if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
@@ -2456,7 +2456,7 @@ static int ext4_da_should_update_i_disksize(struct page *page,
2456 bh = page_buffers(page); 2456 bh = page_buffers(page);
2457 idx = offset >> inode->i_blkbits; 2457 idx = offset >> inode->i_blkbits;
2458 2458
2459 for (i=0; i < idx; i++) 2459 for (i = 0; i < idx; i++)
2460 bh = bh->b_this_page; 2460 bh = bh->b_this_page;
2461 2461
2462 if (!buffer_mapped(bh) || (buffer_delay(bh))) 2462 if (!buffer_mapped(bh) || (buffer_delay(bh)))
@@ -2476,7 +2476,7 @@ static int ext4_da_write_end(struct file *file,
2476 unsigned long start, end; 2476 unsigned long start, end;
2477 2477
2478 start = pos & (PAGE_CACHE_SIZE - 1); 2478 start = pos & (PAGE_CACHE_SIZE - 1);
2479 end = start + copied -1; 2479 end = start + copied - 1;
2480 2480
2481 /* 2481 /*
2482 * generic_write_end() will run mark_inode_dirty() if i_size 2482 * generic_write_end() will run mark_inode_dirty() if i_size
@@ -2591,7 +2591,7 @@ static sector_t ext4_bmap(struct address_space *mapping, sector_t block)
2591 return 0; 2591 return 0;
2592 } 2592 }
2593 2593
2594 return generic_block_bmap(mapping,block,ext4_get_block); 2594 return generic_block_bmap(mapping, block, ext4_get_block);
2595} 2595}
2596 2596
2597static int bget_one(handle_t *handle, struct buffer_head *bh) 2597static int bget_one(handle_t *handle, struct buffer_head *bh)
@@ -3197,7 +3197,7 @@ static Indirect *ext4_find_shared(struct inode *inode, int depth,
3197 if (!partial->key && *partial->p) 3197 if (!partial->key && *partial->p)
3198 /* Writer: end */ 3198 /* Writer: end */
3199 goto no_top; 3199 goto no_top;
3200 for (p=partial; p>chain && all_zeroes((__le32*)p->bh->b_data,p->p); p--) 3200 for (p = partial; (p > chain) && all_zeroes((__le32 *) p->bh->b_data, p->p); p--)
3201 ; 3201 ;
3202 /* 3202 /*
3203 * OK, we've found the last block that must survive. The rest of our 3203 * OK, we've found the last block that must survive. The rest of our
@@ -3216,7 +3216,7 @@ static Indirect *ext4_find_shared(struct inode *inode, int depth,
3216 } 3216 }
3217 /* Writer: end */ 3217 /* Writer: end */
3218 3218
3219 while(partial > p) { 3219 while (partial > p) {
3220 brelse(partial->bh); 3220 brelse(partial->bh);
3221 partial--; 3221 partial--;
3222 } 3222 }
@@ -3408,9 +3408,9 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode,
3408 /* This zaps the entire block. Bottom up. */ 3408 /* This zaps the entire block. Bottom up. */
3409 BUFFER_TRACE(bh, "free child branches"); 3409 BUFFER_TRACE(bh, "free child branches");
3410 ext4_free_branches(handle, inode, bh, 3410 ext4_free_branches(handle, inode, bh,
3411 (__le32*)bh->b_data, 3411 (__le32 *) bh->b_data,
3412 (__le32*)bh->b_data + addr_per_block, 3412 (__le32 *) bh->b_data + addr_per_block,
3413 depth); 3413 depth);
3414 3414
3415 /* 3415 /*
3416 * We've probably journalled the indirect block several 3416 * We've probably journalled the indirect block several
@@ -3927,7 +3927,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
3927 inode->i_mode = le16_to_cpu(raw_inode->i_mode); 3927 inode->i_mode = le16_to_cpu(raw_inode->i_mode);
3928 inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low); 3928 inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
3929 inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low); 3929 inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
3930 if(!(test_opt (inode->i_sb, NO_UID32))) { 3930 if (!(test_opt(inode->i_sb, NO_UID32))) {
3931 inode->i_uid |= le16_to_cpu(raw_inode->i_uid_high) << 16; 3931 inode->i_uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
3932 inode->i_gid |= le16_to_cpu(raw_inode->i_gid_high) << 16; 3932 inode->i_gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
3933 } 3933 }
@@ -3945,7 +3945,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
3945 if (inode->i_mode == 0 || 3945 if (inode->i_mode == 0 ||
3946 !(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_ORPHAN_FS)) { 3946 !(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_ORPHAN_FS)) {
3947 /* this inode is deleted */ 3947 /* this inode is deleted */
3948 brelse (bh); 3948 brelse(bh);
3949 ret = -ESTALE; 3949 ret = -ESTALE;
3950 goto bad_inode; 3950 goto bad_inode;
3951 } 3951 }
@@ -3978,7 +3978,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
3978 ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize); 3978 ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize);
3979 if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > 3979 if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize >
3980 EXT4_INODE_SIZE(inode->i_sb)) { 3980 EXT4_INODE_SIZE(inode->i_sb)) {
3981 brelse (bh); 3981 brelse(bh);
3982 ret = -EIO; 3982 ret = -EIO;
3983 goto bad_inode; 3983 goto bad_inode;
3984 } 3984 }
@@ -4031,7 +4031,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
4031 init_special_inode(inode, inode->i_mode, 4031 init_special_inode(inode, inode->i_mode,
4032 new_decode_dev(le32_to_cpu(raw_inode->i_block[1]))); 4032 new_decode_dev(le32_to_cpu(raw_inode->i_block[1])));
4033 } 4033 }
4034 brelse (iloc.bh); 4034 brelse(iloc.bh);
4035 ext4_set_inode_flags(inode); 4035 ext4_set_inode_flags(inode);
4036 unlock_new_inode(inode); 4036 unlock_new_inode(inode);
4037 return inode; 4037 return inode;
@@ -4113,14 +4113,14 @@ static int ext4_do_update_inode(handle_t *handle,
4113 4113
4114 ext4_get_inode_flags(ei); 4114 ext4_get_inode_flags(ei);
4115 raw_inode->i_mode = cpu_to_le16(inode->i_mode); 4115 raw_inode->i_mode = cpu_to_le16(inode->i_mode);
4116 if(!(test_opt(inode->i_sb, NO_UID32))) { 4116 if (!(test_opt(inode->i_sb, NO_UID32))) {
4117 raw_inode->i_uid_low = cpu_to_le16(low_16_bits(inode->i_uid)); 4117 raw_inode->i_uid_low = cpu_to_le16(low_16_bits(inode->i_uid));
4118 raw_inode->i_gid_low = cpu_to_le16(low_16_bits(inode->i_gid)); 4118 raw_inode->i_gid_low = cpu_to_le16(low_16_bits(inode->i_gid));
4119/* 4119/*
4120 * Fix up interoperability with old kernels. Otherwise, old inodes get 4120 * Fix up interoperability with old kernels. Otherwise, old inodes get
4121 * re-used with the upper 16 bits of the uid/gid intact 4121 * re-used with the upper 16 bits of the uid/gid intact
4122 */ 4122 */
4123 if(!ei->i_dtime) { 4123 if (!ei->i_dtime) {
4124 raw_inode->i_uid_high = 4124 raw_inode->i_uid_high =
4125 cpu_to_le16(high_16_bits(inode->i_uid)); 4125 cpu_to_le16(high_16_bits(inode->i_uid));
4126 raw_inode->i_gid_high = 4126 raw_inode->i_gid_high =
@@ -4208,7 +4208,7 @@ static int ext4_do_update_inode(handle_t *handle,
4208 ei->i_state &= ~EXT4_STATE_NEW; 4208 ei->i_state &= ~EXT4_STATE_NEW;
4209 4209
4210out_brelse: 4210out_brelse:
4211 brelse (bh); 4211 brelse(bh);
4212 ext4_std_error(inode->i_sb, err); 4212 ext4_std_error(inode->i_sb, err);
4213 return err; 4213 return err;
4214} 4214}
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 7a6c2f1faba6..ca09dd1039ec 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -25,7 +25,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
25 unsigned int flags; 25 unsigned int flags;
26 unsigned short rsv_window_size; 26 unsigned short rsv_window_size;
27 27
28 ext4_debug ("cmd = %u, arg = %lu\n", cmd, arg); 28 ext4_debug("cmd = %u, arg = %lu\n", cmd, arg);
29 29
30 switch (cmd) { 30 switch (cmd) {
31 case EXT4_IOC_GETFLAGS: 31 case EXT4_IOC_GETFLAGS:
@@ -186,7 +186,7 @@ setversion_out:
186 case EXT4_IOC_SETRSVSZ: { 186 case EXT4_IOC_SETRSVSZ: {
187 int err; 187 int err;
188 188
189 if (!test_opt(inode->i_sb, RESERVATION) ||!S_ISREG(inode->i_mode)) 189 if (!test_opt(inode->i_sb, RESERVATION) || !S_ISREG(inode->i_mode))
190 return -ENOTTY; 190 return -ENOTTY;
191 191
192 if (!is_owner_or_cap(inode)) 192 if (!is_owner_or_cap(inode))
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 978b57f8630d..a1f72d217c7c 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -151,26 +151,26 @@ struct dx_map_entry
151 151
152static inline ext4_lblk_t dx_get_block(struct dx_entry *entry); 152static inline ext4_lblk_t dx_get_block(struct dx_entry *entry);
153static void dx_set_block(struct dx_entry *entry, ext4_lblk_t value); 153static void dx_set_block(struct dx_entry *entry, ext4_lblk_t value);
154static inline unsigned dx_get_hash (struct dx_entry *entry); 154static inline unsigned dx_get_hash(struct dx_entry *entry);
155static void dx_set_hash (struct dx_entry *entry, unsigned value); 155static void dx_set_hash(struct dx_entry *entry, unsigned value);
156static unsigned dx_get_count (struct dx_entry *entries); 156static unsigned dx_get_count(struct dx_entry *entries);
157static unsigned dx_get_limit (struct dx_entry *entries); 157static unsigned dx_get_limit(struct dx_entry *entries);
158static void dx_set_count (struct dx_entry *entries, unsigned value); 158static void dx_set_count(struct dx_entry *entries, unsigned value);
159static void dx_set_limit (struct dx_entry *entries, unsigned value); 159static void dx_set_limit(struct dx_entry *entries, unsigned value);
160static unsigned dx_root_limit (struct inode *dir, unsigned infosize); 160static unsigned dx_root_limit(struct inode *dir, unsigned infosize);
161static unsigned dx_node_limit (struct inode *dir); 161static unsigned dx_node_limit(struct inode *dir);
162static struct dx_frame *dx_probe(struct dentry *dentry, 162static struct dx_frame *dx_probe(struct dentry *dentry,
163 struct inode *dir, 163 struct inode *dir,
164 struct dx_hash_info *hinfo, 164 struct dx_hash_info *hinfo,
165 struct dx_frame *frame, 165 struct dx_frame *frame,
166 int *err); 166 int *err);
167static void dx_release (struct dx_frame *frames); 167static void dx_release(struct dx_frame *frames);
168static int dx_make_map (struct ext4_dir_entry_2 *de, int size, 168static int dx_make_map(struct ext4_dir_entry_2 *de, int size,
169 struct dx_hash_info *hinfo, struct dx_map_entry map[]); 169 struct dx_hash_info *hinfo, struct dx_map_entry map[]);
170static void dx_sort_map(struct dx_map_entry *map, unsigned count); 170static void dx_sort_map(struct dx_map_entry *map, unsigned count);
171static struct ext4_dir_entry_2 *dx_move_dirents (char *from, char *to, 171static struct ext4_dir_entry_2 *dx_move_dirents(char *from, char *to,
172 struct dx_map_entry *offsets, int count); 172 struct dx_map_entry *offsets, int count);
173static struct ext4_dir_entry_2* dx_pack_dirents (char *base, int size); 173static struct ext4_dir_entry_2* dx_pack_dirents(char *base, int size);
174static void dx_insert_block(struct dx_frame *frame, 174static void dx_insert_block(struct dx_frame *frame,
175 u32 hash, ext4_lblk_t block); 175 u32 hash, ext4_lblk_t block);
176static int ext4_htree_next_block(struct inode *dir, __u32 hash, 176static int ext4_htree_next_block(struct inode *dir, __u32 hash,
@@ -207,44 +207,44 @@ static inline void dx_set_block(struct dx_entry *entry, ext4_lblk_t value)
207 entry->block = cpu_to_le32(value); 207 entry->block = cpu_to_le32(value);
208} 208}
209 209
210static inline unsigned dx_get_hash (struct dx_entry *entry) 210static inline unsigned dx_get_hash(struct dx_entry *entry)
211{ 211{
212 return le32_to_cpu(entry->hash); 212 return le32_to_cpu(entry->hash);
213} 213}
214 214
215static inline void dx_set_hash (struct dx_entry *entry, unsigned value) 215static inline void dx_set_hash(struct dx_entry *entry, unsigned value)
216{ 216{
217 entry->hash = cpu_to_le32(value); 217 entry->hash = cpu_to_le32(value);
218} 218}
219 219
220static inline unsigned dx_get_count (struct dx_entry *entries) 220static inline unsigned dx_get_count(struct dx_entry *entries)
221{ 221{
222 return le16_to_cpu(((struct dx_countlimit *) entries)->count); 222 return le16_to_cpu(((struct dx_countlimit *) entries)->count);
223} 223}
224 224
225static inline unsigned dx_get_limit (struct dx_entry *entries) 225static inline unsigned dx_get_limit(struct dx_entry *entries)
226{ 226{
227 return le16_to_cpu(((struct dx_countlimit *) entries)->limit); 227 return le16_to_cpu(((struct dx_countlimit *) entries)->limit);
228} 228}
229 229
230static inline void dx_set_count (struct dx_entry *entries, unsigned value) 230static inline void dx_set_count(struct dx_entry *entries, unsigned value)
231{ 231{
232 ((struct dx_countlimit *) entries)->count = cpu_to_le16(value); 232 ((struct dx_countlimit *) entries)->count = cpu_to_le16(value);
233} 233}
234 234
235static inline void dx_set_limit (struct dx_entry *entries, unsigned value) 235static inline void dx_set_limit(struct dx_entry *entries, unsigned value)
236{ 236{
237 ((struct dx_countlimit *) entries)->limit = cpu_to_le16(value); 237 ((struct dx_countlimit *) entries)->limit = cpu_to_le16(value);
238} 238}
239 239
240static inline unsigned dx_root_limit (struct inode *dir, unsigned infosize) 240static inline unsigned dx_root_limit(struct inode *dir, unsigned infosize)
241{ 241{
242 unsigned entry_space = dir->i_sb->s_blocksize - EXT4_DIR_REC_LEN(1) - 242 unsigned entry_space = dir->i_sb->s_blocksize - EXT4_DIR_REC_LEN(1) -
243 EXT4_DIR_REC_LEN(2) - infosize; 243 EXT4_DIR_REC_LEN(2) - infosize;
244 return entry_space / sizeof(struct dx_entry); 244 return entry_space / sizeof(struct dx_entry);
245} 245}
246 246
247static inline unsigned dx_node_limit (struct inode *dir) 247static inline unsigned dx_node_limit(struct inode *dir)
248{ 248{
249 unsigned entry_space = dir->i_sb->s_blocksize - EXT4_DIR_REC_LEN(0); 249 unsigned entry_space = dir->i_sb->s_blocksize - EXT4_DIR_REC_LEN(0);
250 return entry_space / sizeof(struct dx_entry); 250 return entry_space / sizeof(struct dx_entry);
@@ -306,7 +306,7 @@ struct stats dx_show_entries(struct dx_hash_info *hinfo, struct inode *dir,
306 struct dx_entry *entries, int levels) 306 struct dx_entry *entries, int levels)
307{ 307{
308 unsigned blocksize = dir->i_sb->s_blocksize; 308 unsigned blocksize = dir->i_sb->s_blocksize;
309 unsigned count = dx_get_count (entries), names = 0, space = 0, i; 309 unsigned count = dx_get_count(entries), names = 0, space = 0, i;
310 unsigned bcount = 0; 310 unsigned bcount = 0;
311 struct buffer_head *bh; 311 struct buffer_head *bh;
312 int err; 312 int err;
@@ -325,7 +325,7 @@ struct stats dx_show_entries(struct dx_hash_info *hinfo, struct inode *dir,
325 names += stats.names; 325 names += stats.names;
326 space += stats.space; 326 space += stats.space;
327 bcount += stats.bcount; 327 bcount += stats.bcount;
328 brelse (bh); 328 brelse(bh);
329 } 329 }
330 if (bcount) 330 if (bcount)
331 printk(KERN_DEBUG "%snames %u, fullness %u (%u%%)\n", 331 printk(KERN_DEBUG "%snames %u, fullness %u (%u%%)\n",
@@ -407,7 +407,7 @@ dx_probe(struct dentry *dentry, struct inode *dir,
407 goto fail; 407 goto fail;
408 } 408 }
409 409
410 dxtrace (printk("Look up %x", hash)); 410 dxtrace(printk("Look up %x", hash));
411 while (1) 411 while (1)
412 { 412 {
413 count = dx_get_count(entries); 413 count = dx_get_count(entries);
@@ -556,7 +556,7 @@ static int ext4_htree_next_block(struct inode *dir, __u32 hash,
556 0, &err))) 556 0, &err)))
557 return err; /* Failure */ 557 return err; /* Failure */
558 p++; 558 p++;
559 brelse (p->bh); 559 brelse(p->bh);
560 p->bh = bh; 560 p->bh = bh;
561 p->at = p->entries = ((struct dx_node *) bh->b_data)->entries; 561 p->at = p->entries = ((struct dx_node *) bh->b_data)->entries;
562 } 562 }
@@ -594,7 +594,7 @@ static int htree_dirblock_to_tree(struct file *dir_file,
594 /* On error, skip the f_pos to the next block. */ 594 /* On error, skip the f_pos to the next block. */
595 dir_file->f_pos = (dir_file->f_pos | 595 dir_file->f_pos = (dir_file->f_pos |
596 (dir->i_sb->s_blocksize - 1)) + 1; 596 (dir->i_sb->s_blocksize - 1)) + 1;
597 brelse (bh); 597 brelse(bh);
598 return count; 598 return count;
599 } 599 }
600 ext4fs_dirhash(de->name, de->name_len, hinfo); 600 ext4fs_dirhash(de->name, de->name_len, hinfo);
@@ -803,7 +803,7 @@ static inline int ext4_match (int len, const char * const name,
803/* 803/*
804 * Returns 0 if not found, -1 on failure, and 1 on success 804 * Returns 0 if not found, -1 on failure, and 1 on success
805 */ 805 */
806static inline int search_dirblock(struct buffer_head * bh, 806static inline int search_dirblock(struct buffer_head *bh,
807 struct inode *dir, 807 struct inode *dir,
808 struct dentry *dentry, 808 struct dentry *dentry,
809 unsigned long offset, 809 unsigned long offset,
@@ -855,9 +855,9 @@ static inline int search_dirblock(struct buffer_head * bh,
855static struct buffer_head * ext4_find_entry (struct dentry *dentry, 855static struct buffer_head * ext4_find_entry (struct dentry *dentry,
856 struct ext4_dir_entry_2 ** res_dir) 856 struct ext4_dir_entry_2 ** res_dir)
857{ 857{
858 struct super_block * sb; 858 struct super_block *sb;
859 struct buffer_head * bh_use[NAMEI_RA_SIZE]; 859 struct buffer_head *bh_use[NAMEI_RA_SIZE];
860 struct buffer_head * bh, *ret = NULL; 860 struct buffer_head *bh, *ret = NULL;
861 ext4_lblk_t start, block, b; 861 ext4_lblk_t start, block, b;
862 int ra_max = 0; /* Number of bh's in the readahead 862 int ra_max = 0; /* Number of bh's in the readahead
863 buffer, bh_use[] */ 863 buffer, bh_use[] */
@@ -958,7 +958,7 @@ restart:
958cleanup_and_exit: 958cleanup_and_exit:
959 /* Clean up the read-ahead blocks */ 959 /* Clean up the read-ahead blocks */
960 for (; ra_ptr < ra_max; ra_ptr++) 960 for (; ra_ptr < ra_max; ra_ptr++)
961 brelse (bh_use[ra_ptr]); 961 brelse(bh_use[ra_ptr]);
962 return ret; 962 return ret;
963} 963}
964 964
@@ -1012,7 +1012,7 @@ static struct buffer_head * ext4_dx_find_entry(struct dentry *dentry,
1012 return bh; 1012 return bh;
1013 } 1013 }
1014 } 1014 }
1015 brelse (bh); 1015 brelse(bh);
1016 /* Check to see if we should continue to search */ 1016 /* Check to see if we should continue to search */
1017 retval = ext4_htree_next_block(dir, hash, frame, 1017 retval = ext4_htree_next_block(dir, hash, frame,
1018 frames, NULL); 1018 frames, NULL);
@@ -1032,11 +1032,11 @@ errout:
1032 return NULL; 1032 return NULL;
1033} 1033}
1034 1034
1035static struct dentry *ext4_lookup(struct inode * dir, struct dentry *dentry, struct nameidata *nd) 1035static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
1036{ 1036{
1037 struct inode * inode; 1037 struct inode *inode;
1038 struct ext4_dir_entry_2 * de; 1038 struct ext4_dir_entry_2 *de;
1039 struct buffer_head * bh; 1039 struct buffer_head *bh;
1040 1040
1041 if (dentry->d_name.len > EXT4_NAME_LEN) 1041 if (dentry->d_name.len > EXT4_NAME_LEN)
1042 return ERR_PTR(-ENAMETOOLONG); 1042 return ERR_PTR(-ENAMETOOLONG);
@@ -1045,7 +1045,7 @@ static struct dentry *ext4_lookup(struct inode * dir, struct dentry *dentry, str
1045 inode = NULL; 1045 inode = NULL;
1046 if (bh) { 1046 if (bh) {
1047 unsigned long ino = le32_to_cpu(de->inode); 1047 unsigned long ino = le32_to_cpu(de->inode);
1048 brelse (bh); 1048 brelse(bh);
1049 if (!ext4_valid_inum(dir->i_sb, ino)) { 1049 if (!ext4_valid_inum(dir->i_sb, ino)) {
1050 ext4_error(dir->i_sb, "ext4_lookup", 1050 ext4_error(dir->i_sb, "ext4_lookup",
1051 "bad inode number: %lu", ino); 1051 "bad inode number: %lu", ino);
@@ -1203,10 +1203,10 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
1203 1203
1204 /* create map in the end of data2 block */ 1204 /* create map in the end of data2 block */
1205 map = (struct dx_map_entry *) (data2 + blocksize); 1205 map = (struct dx_map_entry *) (data2 + blocksize);
1206 count = dx_make_map ((struct ext4_dir_entry_2 *) data1, 1206 count = dx_make_map((struct ext4_dir_entry_2 *) data1,
1207 blocksize, hinfo, map); 1207 blocksize, hinfo, map);
1208 map -= count; 1208 map -= count;
1209 dx_sort_map (map, count); 1209 dx_sort_map(map, count);
1210 /* Split the existing block in the middle, size-wise */ 1210 /* Split the existing block in the middle, size-wise */
1211 size = 0; 1211 size = 0;
1212 move = 0; 1212 move = 0;
@@ -1227,7 +1227,7 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
1227 1227
1228 /* Fancy dance to stay within two buffers */ 1228 /* Fancy dance to stay within two buffers */
1229 de2 = dx_move_dirents(data1, data2, map + split, count - split); 1229 de2 = dx_move_dirents(data1, data2, map + split, count - split);
1230 de = dx_pack_dirents(data1,blocksize); 1230 de = dx_pack_dirents(data1, blocksize);
1231 de->rec_len = ext4_rec_len_to_disk(data1 + blocksize - (char *) de); 1231 de->rec_len = ext4_rec_len_to_disk(data1 + blocksize - (char *) de);
1232 de2->rec_len = ext4_rec_len_to_disk(data2 + blocksize - (char *) de2); 1232 de2->rec_len = ext4_rec_len_to_disk(data2 + blocksize - (char *) de2);
1233 dxtrace(dx_show_leaf (hinfo, (struct ext4_dir_entry_2 *) data1, blocksize, 1)); 1233 dxtrace(dx_show_leaf (hinfo, (struct ext4_dir_entry_2 *) data1, blocksize, 1));
@@ -1239,15 +1239,15 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
1239 swap(*bh, bh2); 1239 swap(*bh, bh2);
1240 de = de2; 1240 de = de2;
1241 } 1241 }
1242 dx_insert_block (frame, hash2 + continued, newblock); 1242 dx_insert_block(frame, hash2 + continued, newblock);
1243 err = ext4_journal_dirty_metadata (handle, bh2); 1243 err = ext4_journal_dirty_metadata(handle, bh2);
1244 if (err) 1244 if (err)
1245 goto journal_error; 1245 goto journal_error;
1246 err = ext4_journal_dirty_metadata (handle, frame->bh); 1246 err = ext4_journal_dirty_metadata(handle, frame->bh);
1247 if (err) 1247 if (err)
1248 goto journal_error; 1248 goto journal_error;
1249 brelse (bh2); 1249 brelse(bh2);
1250 dxtrace(dx_show_index ("frame", frame->entries)); 1250 dxtrace(dx_show_index("frame", frame->entries));
1251 return de; 1251 return de;
1252 1252
1253journal_error: 1253journal_error:
@@ -1273,7 +1273,7 @@ errout:
1273 */ 1273 */
1274static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry, 1274static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
1275 struct inode *inode, struct ext4_dir_entry_2 *de, 1275 struct inode *inode, struct ext4_dir_entry_2 *de,
1276 struct buffer_head * bh) 1276 struct buffer_head *bh)
1277{ 1277{
1278 struct inode *dir = dentry->d_parent->d_inode; 1278 struct inode *dir = dentry->d_parent->d_inode;
1279 const char *name = dentry->d_name.name; 1279 const char *name = dentry->d_name.name;
@@ -1290,11 +1290,11 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
1290 while ((char *) de <= top) { 1290 while ((char *) de <= top) {
1291 if (!ext4_check_dir_entry("ext4_add_entry", dir, de, 1291 if (!ext4_check_dir_entry("ext4_add_entry", dir, de,
1292 bh, offset)) { 1292 bh, offset)) {
1293 brelse (bh); 1293 brelse(bh);
1294 return -EIO; 1294 return -EIO;
1295 } 1295 }
1296 if (ext4_match (namelen, name, de)) { 1296 if (ext4_match(namelen, name, de)) {
1297 brelse (bh); 1297 brelse(bh);
1298 return -EEXIST; 1298 return -EEXIST;
1299 } 1299 }
1300 nlen = EXT4_DIR_REC_LEN(de->name_len); 1300 nlen = EXT4_DIR_REC_LEN(de->name_len);
@@ -1331,7 +1331,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
1331 } else 1331 } else
1332 de->inode = 0; 1332 de->inode = 0;
1333 de->name_len = namelen; 1333 de->name_len = namelen;
1334 memcpy (de->name, name, namelen); 1334 memcpy(de->name, name, namelen);
1335 /* 1335 /*
1336 * XXX shouldn't update any times until successful 1336 * XXX shouldn't update any times until successful
1337 * completion of syscall, but too many callers depend 1337 * completion of syscall, but too many callers depend
@@ -1388,7 +1388,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1388 } 1388 }
1389 root = (struct dx_root *) bh->b_data; 1389 root = (struct dx_root *) bh->b_data;
1390 1390
1391 bh2 = ext4_append (handle, dir, &block, &retval); 1391 bh2 = ext4_append(handle, dir, &block, &retval);
1392 if (!(bh2)) { 1392 if (!(bh2)) {
1393 brelse(bh); 1393 brelse(bh);
1394 return retval; 1394 return retval;
@@ -1414,9 +1414,9 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1414 root->info.info_length = sizeof(root->info); 1414 root->info.info_length = sizeof(root->info);
1415 root->info.hash_version = EXT4_SB(dir->i_sb)->s_def_hash_version; 1415 root->info.hash_version = EXT4_SB(dir->i_sb)->s_def_hash_version;
1416 entries = root->entries; 1416 entries = root->entries;
1417 dx_set_block (entries, 1); 1417 dx_set_block(entries, 1);
1418 dx_set_count (entries, 1); 1418 dx_set_count(entries, 1);
1419 dx_set_limit (entries, dx_root_limit(dir, sizeof(root->info))); 1419 dx_set_limit(entries, dx_root_limit(dir, sizeof(root->info)));
1420 1420
1421 /* Initialize as for dx_probe */ 1421 /* Initialize as for dx_probe */
1422 hinfo.hash_version = root->info.hash_version; 1422 hinfo.hash_version = root->info.hash_version;
@@ -1445,14 +1445,14 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1445 * may not sleep between calling this and putting something into 1445 * may not sleep between calling this and putting something into
1446 * the entry, as someone else might have used it while you slept. 1446 * the entry, as someone else might have used it while you slept.
1447 */ 1447 */
1448static int ext4_add_entry (handle_t *handle, struct dentry *dentry, 1448static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
1449 struct inode *inode) 1449 struct inode *inode)
1450{ 1450{
1451 struct inode *dir = dentry->d_parent->d_inode; 1451 struct inode *dir = dentry->d_parent->d_inode;
1452 unsigned long offset; 1452 unsigned long offset;
1453 struct buffer_head * bh; 1453 struct buffer_head *bh;
1454 struct ext4_dir_entry_2 *de; 1454 struct ext4_dir_entry_2 *de;
1455 struct super_block * sb; 1455 struct super_block *sb;
1456 int retval; 1456 int retval;
1457 int dx_fallback=0; 1457 int dx_fallback=0;
1458 unsigned blocksize; 1458 unsigned blocksize;
@@ -1502,9 +1502,9 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
1502 struct dx_frame frames[2], *frame; 1502 struct dx_frame frames[2], *frame;
1503 struct dx_entry *entries, *at; 1503 struct dx_entry *entries, *at;
1504 struct dx_hash_info hinfo; 1504 struct dx_hash_info hinfo;
1505 struct buffer_head * bh; 1505 struct buffer_head *bh;
1506 struct inode *dir = dentry->d_parent->d_inode; 1506 struct inode *dir = dentry->d_parent->d_inode;
1507 struct super_block * sb = dir->i_sb; 1507 struct super_block *sb = dir->i_sb;
1508 struct ext4_dir_entry_2 *de; 1508 struct ext4_dir_entry_2 *de;
1509 int err; 1509 int err;
1510 1510
@@ -1570,11 +1570,11 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
1570 if (err) 1570 if (err)
1571 goto journal_error; 1571 goto journal_error;
1572 1572
1573 memcpy ((char *) entries2, (char *) (entries + icount1), 1573 memcpy((char *) entries2, (char *) (entries + icount1),
1574 icount2 * sizeof(struct dx_entry)); 1574 icount2 * sizeof(struct dx_entry));
1575 dx_set_count (entries, icount1); 1575 dx_set_count(entries, icount1);
1576 dx_set_count (entries2, icount2); 1576 dx_set_count(entries2, icount2);
1577 dx_set_limit (entries2, dx_node_limit(dir)); 1577 dx_set_limit(entries2, dx_node_limit(dir));
1578 1578
1579 /* Which index block gets the new entry? */ 1579 /* Which index block gets the new entry? */
1580 if (at - entries >= icount1) { 1580 if (at - entries >= icount1) {
@@ -1582,9 +1582,9 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
1582 frame->entries = entries = entries2; 1582 frame->entries = entries = entries2;
1583 swap(frame->bh, bh2); 1583 swap(frame->bh, bh2);
1584 } 1584 }
1585 dx_insert_block (frames + 0, hash2, newblock); 1585 dx_insert_block(frames + 0, hash2, newblock);
1586 dxtrace(dx_show_index ("node", frames[1].entries)); 1586 dxtrace(dx_show_index("node", frames[1].entries));
1587 dxtrace(dx_show_index ("node", 1587 dxtrace(dx_show_index("node",
1588 ((struct dx_node *) bh2->b_data)->entries)); 1588 ((struct dx_node *) bh2->b_data)->entries));
1589 err = ext4_journal_dirty_metadata(handle, bh2); 1589 err = ext4_journal_dirty_metadata(handle, bh2);
1590 if (err) 1590 if (err)
@@ -1634,12 +1634,12 @@ cleanup:
1634 * ext4_delete_entry deletes a directory entry by merging it with the 1634 * ext4_delete_entry deletes a directory entry by merging it with the
1635 * previous entry 1635 * previous entry
1636 */ 1636 */
1637static int ext4_delete_entry (handle_t *handle, 1637static int ext4_delete_entry(handle_t *handle,
1638 struct inode * dir, 1638 struct inode *dir,
1639 struct ext4_dir_entry_2 * de_del, 1639 struct ext4_dir_entry_2 *de_del,
1640 struct buffer_head * bh) 1640 struct buffer_head *bh)
1641{ 1641{
1642 struct ext4_dir_entry_2 * de, * pde; 1642 struct ext4_dir_entry_2 *de, *pde;
1643 int i; 1643 int i;
1644 1644
1645 i = 0; 1645 i = 0;
@@ -1720,11 +1720,11 @@ static int ext4_add_nondir(handle_t *handle,
1720 * If the create succeeds, we fill in the inode information 1720 * If the create succeeds, we fill in the inode information
1721 * with d_instantiate(). 1721 * with d_instantiate().
1722 */ 1722 */
1723static int ext4_create (struct inode * dir, struct dentry * dentry, int mode, 1723static int ext4_create(struct inode *dir, struct dentry *dentry, int mode,
1724 struct nameidata *nd) 1724 struct nameidata *nd)
1725{ 1725{
1726 handle_t *handle; 1726 handle_t *handle;
1727 struct inode * inode; 1727 struct inode *inode;
1728 int err, retries = 0; 1728 int err, retries = 0;
1729 1729
1730retry: 1730retry:
@@ -1751,8 +1751,8 @@ retry:
1751 return err; 1751 return err;
1752} 1752}
1753 1753
1754static int ext4_mknod (struct inode * dir, struct dentry *dentry, 1754static int ext4_mknod(struct inode *dir, struct dentry *dentry,
1755 int mode, dev_t rdev) 1755 int mode, dev_t rdev)
1756{ 1756{
1757 handle_t *handle; 1757 handle_t *handle;
1758 struct inode *inode; 1758 struct inode *inode;
@@ -1771,7 +1771,7 @@ retry:
1771 if (IS_DIRSYNC(dir)) 1771 if (IS_DIRSYNC(dir))
1772 handle->h_sync = 1; 1772 handle->h_sync = 1;
1773 1773
1774 inode = ext4_new_inode (handle, dir, mode); 1774 inode = ext4_new_inode(handle, dir, mode);
1775 err = PTR_ERR(inode); 1775 err = PTR_ERR(inode);
1776 if (!IS_ERR(inode)) { 1776 if (!IS_ERR(inode)) {
1777 init_special_inode(inode, inode->i_mode, rdev); 1777 init_special_inode(inode, inode->i_mode, rdev);
@@ -1786,12 +1786,12 @@ retry:
1786 return err; 1786 return err;
1787} 1787}
1788 1788
1789static int ext4_mkdir(struct inode * dir, struct dentry * dentry, int mode) 1789static int ext4_mkdir(struct inode *dir, struct dentry *dentry, int mode)
1790{ 1790{
1791 handle_t *handle; 1791 handle_t *handle;
1792 struct inode * inode; 1792 struct inode *inode;
1793 struct buffer_head * dir_block; 1793 struct buffer_head *dir_block;
1794 struct ext4_dir_entry_2 * de; 1794 struct ext4_dir_entry_2 *de;
1795 int err, retries = 0; 1795 int err, retries = 0;
1796 1796
1797 if (EXT4_DIR_LINK_MAX(dir)) 1797 if (EXT4_DIR_LINK_MAX(dir))
@@ -1807,7 +1807,7 @@ retry:
1807 if (IS_DIRSYNC(dir)) 1807 if (IS_DIRSYNC(dir))
1808 handle->h_sync = 1; 1808 handle->h_sync = 1;
1809 1809
1810 inode = ext4_new_inode (handle, dir, S_IFDIR | mode); 1810 inode = ext4_new_inode(handle, dir, S_IFDIR | mode);
1811 err = PTR_ERR(inode); 1811 err = PTR_ERR(inode);
1812 if (IS_ERR(inode)) 1812 if (IS_ERR(inode))
1813 goto out_stop; 1813 goto out_stop;
@@ -1815,7 +1815,7 @@ retry:
1815 inode->i_op = &ext4_dir_inode_operations; 1815 inode->i_op = &ext4_dir_inode_operations;
1816 inode->i_fop = &ext4_dir_operations; 1816 inode->i_fop = &ext4_dir_operations;
1817 inode->i_size = EXT4_I(inode)->i_disksize = inode->i_sb->s_blocksize; 1817 inode->i_size = EXT4_I(inode)->i_disksize = inode->i_sb->s_blocksize;
1818 dir_block = ext4_bread (handle, inode, 0, 1, &err); 1818 dir_block = ext4_bread(handle, inode, 0, 1, &err);
1819 if (!dir_block) 1819 if (!dir_block)
1820 goto out_clear_inode; 1820 goto out_clear_inode;
1821 BUFFER_TRACE(dir_block, "get_write_access"); 1821 BUFFER_TRACE(dir_block, "get_write_access");
@@ -1824,26 +1824,26 @@ retry:
1824 de->inode = cpu_to_le32(inode->i_ino); 1824 de->inode = cpu_to_le32(inode->i_ino);
1825 de->name_len = 1; 1825 de->name_len = 1;
1826 de->rec_len = ext4_rec_len_to_disk(EXT4_DIR_REC_LEN(de->name_len)); 1826 de->rec_len = ext4_rec_len_to_disk(EXT4_DIR_REC_LEN(de->name_len));
1827 strcpy (de->name, "."); 1827 strcpy(de->name, ".");
1828 ext4_set_de_type(dir->i_sb, de, S_IFDIR); 1828 ext4_set_de_type(dir->i_sb, de, S_IFDIR);
1829 de = ext4_next_entry(de); 1829 de = ext4_next_entry(de);
1830 de->inode = cpu_to_le32(dir->i_ino); 1830 de->inode = cpu_to_le32(dir->i_ino);
1831 de->rec_len = ext4_rec_len_to_disk(inode->i_sb->s_blocksize - 1831 de->rec_len = ext4_rec_len_to_disk(inode->i_sb->s_blocksize -
1832 EXT4_DIR_REC_LEN(1)); 1832 EXT4_DIR_REC_LEN(1));
1833 de->name_len = 2; 1833 de->name_len = 2;
1834 strcpy (de->name, ".."); 1834 strcpy(de->name, "..");
1835 ext4_set_de_type(dir->i_sb, de, S_IFDIR); 1835 ext4_set_de_type(dir->i_sb, de, S_IFDIR);
1836 inode->i_nlink = 2; 1836 inode->i_nlink = 2;
1837 BUFFER_TRACE(dir_block, "call ext4_journal_dirty_metadata"); 1837 BUFFER_TRACE(dir_block, "call ext4_journal_dirty_metadata");
1838 ext4_journal_dirty_metadata(handle, dir_block); 1838 ext4_journal_dirty_metadata(handle, dir_block);
1839 brelse (dir_block); 1839 brelse(dir_block);
1840 ext4_mark_inode_dirty(handle, inode); 1840 ext4_mark_inode_dirty(handle, inode);
1841 err = ext4_add_entry (handle, dentry, inode); 1841 err = ext4_add_entry(handle, dentry, inode);
1842 if (err) { 1842 if (err) {
1843out_clear_inode: 1843out_clear_inode:
1844 clear_nlink(inode); 1844 clear_nlink(inode);
1845 ext4_mark_inode_dirty(handle, inode); 1845 ext4_mark_inode_dirty(handle, inode);
1846 iput (inode); 1846 iput(inode);
1847 goto out_stop; 1847 goto out_stop;
1848 } 1848 }
1849 ext4_inc_count(handle, dir); 1849 ext4_inc_count(handle, dir);
@@ -1860,17 +1860,17 @@ out_stop:
1860/* 1860/*
1861 * routine to check that the specified directory is empty (for rmdir) 1861 * routine to check that the specified directory is empty (for rmdir)
1862 */ 1862 */
1863static int empty_dir (struct inode * inode) 1863static int empty_dir(struct inode *inode)
1864{ 1864{
1865 unsigned long offset; 1865 unsigned long offset;
1866 struct buffer_head * bh; 1866 struct buffer_head *bh;
1867 struct ext4_dir_entry_2 * de, * de1; 1867 struct ext4_dir_entry_2 *de, *de1;
1868 struct super_block * sb; 1868 struct super_block *sb;
1869 int err = 0; 1869 int err = 0;
1870 1870
1871 sb = inode->i_sb; 1871 sb = inode->i_sb;
1872 if (inode->i_size < EXT4_DIR_REC_LEN(1) + EXT4_DIR_REC_LEN(2) || 1872 if (inode->i_size < EXT4_DIR_REC_LEN(1) + EXT4_DIR_REC_LEN(2) ||
1873 !(bh = ext4_bread (NULL, inode, 0, 0, &err))) { 1873 !(bh = ext4_bread(NULL, inode, 0, 0, &err))) {
1874 if (err) 1874 if (err)
1875 ext4_error(inode->i_sb, __func__, 1875 ext4_error(inode->i_sb, __func__,
1876 "error %d reading directory #%lu offset 0", 1876 "error %d reading directory #%lu offset 0",
@@ -1885,23 +1885,23 @@ static int empty_dir (struct inode * inode)
1885 de1 = ext4_next_entry(de); 1885 de1 = ext4_next_entry(de);
1886 if (le32_to_cpu(de->inode) != inode->i_ino || 1886 if (le32_to_cpu(de->inode) != inode->i_ino ||
1887 !le32_to_cpu(de1->inode) || 1887 !le32_to_cpu(de1->inode) ||
1888 strcmp (".", de->name) || 1888 strcmp(".", de->name) ||
1889 strcmp ("..", de1->name)) { 1889 strcmp("..", de1->name)) {
1890 ext4_warning (inode->i_sb, "empty_dir", 1890 ext4_warning(inode->i_sb, "empty_dir",
1891 "bad directory (dir #%lu) - no `.' or `..'", 1891 "bad directory (dir #%lu) - no `.' or `..'",
1892 inode->i_ino); 1892 inode->i_ino);
1893 brelse (bh); 1893 brelse(bh);
1894 return 1; 1894 return 1;
1895 } 1895 }
1896 offset = ext4_rec_len_from_disk(de->rec_len) + 1896 offset = ext4_rec_len_from_disk(de->rec_len) +
1897 ext4_rec_len_from_disk(de1->rec_len); 1897 ext4_rec_len_from_disk(de1->rec_len);
1898 de = ext4_next_entry(de1); 1898 de = ext4_next_entry(de1);
1899 while (offset < inode->i_size ) { 1899 while (offset < inode->i_size) {
1900 if (!bh || 1900 if (!bh ||
1901 (void *) de >= (void *) (bh->b_data+sb->s_blocksize)) { 1901 (void *) de >= (void *) (bh->b_data+sb->s_blocksize)) {
1902 err = 0; 1902 err = 0;
1903 brelse (bh); 1903 brelse(bh);
1904 bh = ext4_bread (NULL, inode, 1904 bh = ext4_bread(NULL, inode,
1905 offset >> EXT4_BLOCK_SIZE_BITS(sb), 0, &err); 1905 offset >> EXT4_BLOCK_SIZE_BITS(sb), 0, &err);
1906 if (!bh) { 1906 if (!bh) {
1907 if (err) 1907 if (err)
@@ -1921,13 +1921,13 @@ static int empty_dir (struct inode * inode)
1921 continue; 1921 continue;
1922 } 1922 }
1923 if (le32_to_cpu(de->inode)) { 1923 if (le32_to_cpu(de->inode)) {
1924 brelse (bh); 1924 brelse(bh);
1925 return 0; 1925 return 0;
1926 } 1926 }
1927 offset += ext4_rec_len_from_disk(de->rec_len); 1927 offset += ext4_rec_len_from_disk(de->rec_len);
1928 de = ext4_next_entry(de); 1928 de = ext4_next_entry(de);
1929 } 1929 }
1930 brelse (bh); 1930 brelse(bh);
1931 return 1; 1931 return 1;
1932} 1932}
1933 1933
@@ -1958,8 +1958,8 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode)
1958 * ->i_nlink. For, say it, character device. Not a regular file, 1958 * ->i_nlink. For, say it, character device. Not a regular file,
1959 * not a directory, not a symlink and ->i_nlink > 0. 1959 * not a directory, not a symlink and ->i_nlink > 0.
1960 */ 1960 */
1961 J_ASSERT ((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || 1961 J_ASSERT((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
1962 S_ISLNK(inode->i_mode)) || inode->i_nlink == 0); 1962 S_ISLNK(inode->i_mode)) || inode->i_nlink == 0);
1963 1963
1964 BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "get_write_access"); 1964 BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "get_write_access");
1965 err = ext4_journal_get_write_access(handle, EXT4_SB(sb)->s_sbh); 1965 err = ext4_journal_get_write_access(handle, EXT4_SB(sb)->s_sbh);
@@ -2073,12 +2073,12 @@ out_brelse:
2073 goto out_err; 2073 goto out_err;
2074} 2074}
2075 2075
2076static int ext4_rmdir (struct inode * dir, struct dentry *dentry) 2076static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
2077{ 2077{
2078 int retval; 2078 int retval;
2079 struct inode * inode; 2079 struct inode *inode;
2080 struct buffer_head * bh; 2080 struct buffer_head *bh;
2081 struct ext4_dir_entry_2 * de; 2081 struct ext4_dir_entry_2 *de;
2082 handle_t *handle; 2082 handle_t *handle;
2083 2083
2084 /* Initialize quotas before so that eventual writes go in 2084 /* Initialize quotas before so that eventual writes go in
@@ -2089,7 +2089,7 @@ static int ext4_rmdir (struct inode * dir, struct dentry *dentry)
2089 return PTR_ERR(handle); 2089 return PTR_ERR(handle);
2090 2090
2091 retval = -ENOENT; 2091 retval = -ENOENT;
2092 bh = ext4_find_entry (dentry, &de); 2092 bh = ext4_find_entry(dentry, &de);
2093 if (!bh) 2093 if (!bh)
2094 goto end_rmdir; 2094 goto end_rmdir;
2095 2095
@@ -2103,16 +2103,16 @@ static int ext4_rmdir (struct inode * dir, struct dentry *dentry)
2103 goto end_rmdir; 2103 goto end_rmdir;
2104 2104
2105 retval = -ENOTEMPTY; 2105 retval = -ENOTEMPTY;
2106 if (!empty_dir (inode)) 2106 if (!empty_dir(inode))
2107 goto end_rmdir; 2107 goto end_rmdir;
2108 2108
2109 retval = ext4_delete_entry(handle, dir, de, bh); 2109 retval = ext4_delete_entry(handle, dir, de, bh);
2110 if (retval) 2110 if (retval)
2111 goto end_rmdir; 2111 goto end_rmdir;
2112 if (!EXT4_DIR_LINK_EMPTY(inode)) 2112 if (!EXT4_DIR_LINK_EMPTY(inode))
2113 ext4_warning (inode->i_sb, "ext4_rmdir", 2113 ext4_warning(inode->i_sb, "ext4_rmdir",
2114 "empty directory has too many links (%d)", 2114 "empty directory has too many links (%d)",
2115 inode->i_nlink); 2115 inode->i_nlink);
2116 inode->i_version++; 2116 inode->i_version++;
2117 clear_nlink(inode); 2117 clear_nlink(inode);
2118 /* There's no need to set i_disksize: the fact that i_nlink is 2118 /* There's no need to set i_disksize: the fact that i_nlink is
@@ -2128,16 +2128,16 @@ static int ext4_rmdir (struct inode * dir, struct dentry *dentry)
2128 2128
2129end_rmdir: 2129end_rmdir:
2130 ext4_journal_stop(handle); 2130 ext4_journal_stop(handle);
2131 brelse (bh); 2131 brelse(bh);
2132 return retval; 2132 return retval;
2133} 2133}
2134 2134
2135static int ext4_unlink(struct inode * dir, struct dentry *dentry) 2135static int ext4_unlink(struct inode *dir, struct dentry *dentry)
2136{ 2136{
2137 int retval; 2137 int retval;
2138 struct inode * inode; 2138 struct inode *inode;
2139 struct buffer_head * bh; 2139 struct buffer_head *bh;
2140 struct ext4_dir_entry_2 * de; 2140 struct ext4_dir_entry_2 *de;
2141 handle_t *handle; 2141 handle_t *handle;
2142 2142
2143 /* Initialize quotas before so that eventual writes go 2143 /* Initialize quotas before so that eventual writes go
@@ -2151,7 +2151,7 @@ static int ext4_unlink(struct inode * dir, struct dentry *dentry)
2151 handle->h_sync = 1; 2151 handle->h_sync = 1;
2152 2152
2153 retval = -ENOENT; 2153 retval = -ENOENT;
2154 bh = ext4_find_entry (dentry, &de); 2154 bh = ext4_find_entry(dentry, &de);
2155 if (!bh) 2155 if (!bh)
2156 goto end_unlink; 2156 goto end_unlink;
2157 2157
@@ -2162,9 +2162,9 @@ static int ext4_unlink(struct inode * dir, struct dentry *dentry)
2162 goto end_unlink; 2162 goto end_unlink;
2163 2163
2164 if (!inode->i_nlink) { 2164 if (!inode->i_nlink) {
2165 ext4_warning (inode->i_sb, "ext4_unlink", 2165 ext4_warning(inode->i_sb, "ext4_unlink",
2166 "Deleting nonexistent file (%lu), %d", 2166 "Deleting nonexistent file (%lu), %d",
2167 inode->i_ino, inode->i_nlink); 2167 inode->i_ino, inode->i_nlink);
2168 inode->i_nlink = 1; 2168 inode->i_nlink = 1;
2169 } 2169 }
2170 retval = ext4_delete_entry(handle, dir, de, bh); 2170 retval = ext4_delete_entry(handle, dir, de, bh);
@@ -2182,15 +2182,15 @@ static int ext4_unlink(struct inode * dir, struct dentry *dentry)
2182 2182
2183end_unlink: 2183end_unlink:
2184 ext4_journal_stop(handle); 2184 ext4_journal_stop(handle);
2185 brelse (bh); 2185 brelse(bh);
2186 return retval; 2186 return retval;
2187} 2187}
2188 2188
2189static int ext4_symlink (struct inode * dir, 2189static int ext4_symlink(struct inode *dir,
2190 struct dentry *dentry, const char * symname) 2190 struct dentry *dentry, const char *symname)
2191{ 2191{
2192 handle_t *handle; 2192 handle_t *handle;
2193 struct inode * inode; 2193 struct inode *inode;
2194 int l, err, retries = 0; 2194 int l, err, retries = 0;
2195 2195
2196 l = strlen(symname)+1; 2196 l = strlen(symname)+1;
@@ -2207,12 +2207,12 @@ retry:
2207 if (IS_DIRSYNC(dir)) 2207 if (IS_DIRSYNC(dir))
2208 handle->h_sync = 1; 2208 handle->h_sync = 1;
2209 2209
2210 inode = ext4_new_inode (handle, dir, S_IFLNK|S_IRWXUGO); 2210 inode = ext4_new_inode(handle, dir, S_IFLNK|S_IRWXUGO);
2211 err = PTR_ERR(inode); 2211 err = PTR_ERR(inode);
2212 if (IS_ERR(inode)) 2212 if (IS_ERR(inode))
2213 goto out_stop; 2213 goto out_stop;
2214 2214
2215 if (l > sizeof (EXT4_I(inode)->i_data)) { 2215 if (l > sizeof(EXT4_I(inode)->i_data)) {
2216 inode->i_op = &ext4_symlink_inode_operations; 2216 inode->i_op = &ext4_symlink_inode_operations;
2217 ext4_set_aops(inode); 2217 ext4_set_aops(inode);
2218 /* 2218 /*
@@ -2225,14 +2225,14 @@ retry:
2225 if (err) { 2225 if (err) {
2226 clear_nlink(inode); 2226 clear_nlink(inode);
2227 ext4_mark_inode_dirty(handle, inode); 2227 ext4_mark_inode_dirty(handle, inode);
2228 iput (inode); 2228 iput(inode);
2229 goto out_stop; 2229 goto out_stop;
2230 } 2230 }
2231 } else { 2231 } else {
2232 /* clear the extent format for fast symlink */ 2232 /* clear the extent format for fast symlink */
2233 EXT4_I(inode)->i_flags &= ~EXT4_EXTENTS_FL; 2233 EXT4_I(inode)->i_flags &= ~EXT4_EXTENTS_FL;
2234 inode->i_op = &ext4_fast_symlink_inode_operations; 2234 inode->i_op = &ext4_fast_symlink_inode_operations;
2235 memcpy((char*)&EXT4_I(inode)->i_data,symname,l); 2235 memcpy((char *)&EXT4_I(inode)->i_data, symname, l);
2236 inode->i_size = l-1; 2236 inode->i_size = l-1;
2237 } 2237 }
2238 EXT4_I(inode)->i_disksize = inode->i_size; 2238 EXT4_I(inode)->i_disksize = inode->i_size;
@@ -2244,8 +2244,8 @@ out_stop:
2244 return err; 2244 return err;
2245} 2245}
2246 2246
2247static int ext4_link (struct dentry * old_dentry, 2247static int ext4_link(struct dentry *old_dentry,
2248 struct inode * dir, struct dentry *dentry) 2248 struct inode *dir, struct dentry *dentry)
2249{ 2249{
2250 handle_t *handle; 2250 handle_t *handle;
2251 struct inode *inode = old_dentry->d_inode; 2251 struct inode *inode = old_dentry->d_inode;
@@ -2288,13 +2288,13 @@ retry:
2288 * Anybody can rename anything with this: the permission checks are left to the 2288 * Anybody can rename anything with this: the permission checks are left to the
2289 * higher-level routines. 2289 * higher-level routines.
2290 */ 2290 */
2291static int ext4_rename (struct inode * old_dir, struct dentry *old_dentry, 2291static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
2292 struct inode * new_dir,struct dentry *new_dentry) 2292 struct inode *new_dir, struct dentry *new_dentry)
2293{ 2293{
2294 handle_t *handle; 2294 handle_t *handle;
2295 struct inode * old_inode, * new_inode; 2295 struct inode *old_inode, *new_inode;
2296 struct buffer_head * old_bh, * new_bh, * dir_bh; 2296 struct buffer_head *old_bh, *new_bh, *dir_bh;
2297 struct ext4_dir_entry_2 * old_de, * new_de; 2297 struct ext4_dir_entry_2 *old_de, *new_de;
2298 int retval; 2298 int retval;
2299 2299
2300 old_bh = new_bh = dir_bh = NULL; 2300 old_bh = new_bh = dir_bh = NULL;
@@ -2312,7 +2312,7 @@ static int ext4_rename (struct inode * old_dir, struct dentry *old_dentry,
2312 if (IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir)) 2312 if (IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir))
2313 handle->h_sync = 1; 2313 handle->h_sync = 1;
2314 2314
2315 old_bh = ext4_find_entry (old_dentry, &old_de); 2315 old_bh = ext4_find_entry(old_dentry, &old_de);
2316 /* 2316 /*
2317 * Check for inode number is _not_ due to possible IO errors. 2317 * Check for inode number is _not_ due to possible IO errors.
2318 * We might rmdir the source, keep it as pwd of some process 2318 * We might rmdir the source, keep it as pwd of some process
@@ -2325,32 +2325,32 @@ static int ext4_rename (struct inode * old_dir, struct dentry *old_dentry,
2325 goto end_rename; 2325 goto end_rename;
2326 2326
2327 new_inode = new_dentry->d_inode; 2327 new_inode = new_dentry->d_inode;
2328 new_bh = ext4_find_entry (new_dentry, &new_de); 2328 new_bh = ext4_find_entry(new_dentry, &new_de);
2329 if (new_bh) { 2329 if (new_bh) {
2330 if (!new_inode) { 2330 if (!new_inode) {
2331 brelse (new_bh); 2331 brelse(new_bh);
2332 new_bh = NULL; 2332 new_bh = NULL;
2333 } 2333 }
2334 } 2334 }
2335 if (S_ISDIR(old_inode->i_mode)) { 2335 if (S_ISDIR(old_inode->i_mode)) {
2336 if (new_inode) { 2336 if (new_inode) {
2337 retval = -ENOTEMPTY; 2337 retval = -ENOTEMPTY;
2338 if (!empty_dir (new_inode)) 2338 if (!empty_dir(new_inode))
2339 goto end_rename; 2339 goto end_rename;
2340 } 2340 }
2341 retval = -EIO; 2341 retval = -EIO;
2342 dir_bh = ext4_bread (handle, old_inode, 0, 0, &retval); 2342 dir_bh = ext4_bread(handle, old_inode, 0, 0, &retval);
2343 if (!dir_bh) 2343 if (!dir_bh)
2344 goto end_rename; 2344 goto end_rename;
2345 if (le32_to_cpu(PARENT_INO(dir_bh->b_data)) != old_dir->i_ino) 2345 if (le32_to_cpu(PARENT_INO(dir_bh->b_data)) != old_dir->i_ino)
2346 goto end_rename; 2346 goto end_rename;
2347 retval = -EMLINK; 2347 retval = -EMLINK;
2348 if (!new_inode && new_dir!=old_dir && 2348 if (!new_inode && new_dir != old_dir &&
2349 new_dir->i_nlink >= EXT4_LINK_MAX) 2349 new_dir->i_nlink >= EXT4_LINK_MAX)
2350 goto end_rename; 2350 goto end_rename;
2351 } 2351 }
2352 if (!new_bh) { 2352 if (!new_bh) {
2353 retval = ext4_add_entry (handle, new_dentry, old_inode); 2353 retval = ext4_add_entry(handle, new_dentry, old_inode);
2354 if (retval) 2354 if (retval)
2355 goto end_rename; 2355 goto end_rename;
2356 } else { 2356 } else {
@@ -2437,9 +2437,9 @@ static int ext4_rename (struct inode * old_dir, struct dentry *old_dentry,
2437 retval = 0; 2437 retval = 0;
2438 2438
2439end_rename: 2439end_rename:
2440 brelse (dir_bh); 2440 brelse(dir_bh);
2441 brelse (old_bh); 2441 brelse(old_bh);
2442 brelse (new_bh); 2442 brelse(new_bh);
2443 ext4_journal_stop(handle); 2443 ext4_journal_stop(handle);
2444 return retval; 2444 return retval;
2445} 2445}
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index b3d35604ea18..4392e3fd0f0f 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -416,8 +416,8 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
416 "EXT4-fs: ext4_add_new_gdb: adding group block %lu\n", 416 "EXT4-fs: ext4_add_new_gdb: adding group block %lu\n",
417 gdb_num); 417 gdb_num);
418 418
419 /* 419 /*
420 * If we are not using the primary superblock/GDT copy don't resize, 420 * If we are not using the primary superblock/GDT copy don't resize,
421 * because the user tools have no way of handling this. Probably a 421 * because the user tools have no way of handling this. Probably a
422 * bad time to do it anyways. 422 * bad time to do it anyways.
423 */ 423 */
@@ -964,7 +964,7 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es,
964 ext4_group_t o_groups_count; 964 ext4_group_t o_groups_count;
965 ext4_grpblk_t last; 965 ext4_grpblk_t last;
966 ext4_grpblk_t add; 966 ext4_grpblk_t add;
967 struct buffer_head * bh; 967 struct buffer_head *bh;
968 handle_t *handle; 968 handle_t *handle;
969 int err; 969 int err;
970 unsigned long freed_blocks; 970 unsigned long freed_blocks;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index c10aaf7d83c3..7de6ca0c9e9b 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -654,7 +654,7 @@ static inline void ext4_show_quota_options(struct seq_file *seq,
654 654
655 if (sbi->s_jquota_fmt) 655 if (sbi->s_jquota_fmt)
656 seq_printf(seq, ",jqfmt=%s", 656 seq_printf(seq, ",jqfmt=%s",
657 (sbi->s_jquota_fmt == QFMT_VFS_OLD) ? "vfsold": "vfsv0"); 657 (sbi->s_jquota_fmt == QFMT_VFS_OLD) ? "vfsold" : "vfsv0");
658 658
659 if (sbi->s_qf_names[USRQUOTA]) 659 if (sbi->s_qf_names[USRQUOTA])
660 seq_printf(seq, ",usrjquota=%s", sbi->s_qf_names[USRQUOTA]); 660 seq_printf(seq, ",usrjquota=%s", sbi->s_qf_names[USRQUOTA]);
@@ -822,7 +822,7 @@ static struct dentry *ext4_fh_to_parent(struct super_block *sb, struct fid *fid,
822} 822}
823 823
824#ifdef CONFIG_QUOTA 824#ifdef CONFIG_QUOTA
825#define QTYPE2NAME(t) ((t) == USRQUOTA?"user":"group") 825#define QTYPE2NAME(t) ((t) == USRQUOTA ? "user" : "group")
826#define QTYPE2MOPT(on, t) ((t) == USRQUOTA?((on)##USRJQUOTA):((on)##GRPJQUOTA)) 826#define QTYPE2MOPT(on, t) ((t) == USRQUOTA?((on)##USRJQUOTA):((on)##GRPJQUOTA))
827 827
828static int ext4_dquot_initialize(struct inode *inode, int type); 828static int ext4_dquot_initialize(struct inode *inode, int type);
@@ -1586,7 +1586,7 @@ static int ext4_check_descriptors(struct super_block *sb)
1586 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) 1586 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG))
1587 flexbg_flag = 1; 1587 flexbg_flag = 1;
1588 1588
1589 ext4_debug ("Checking group descriptors"); 1589 ext4_debug("Checking group descriptors");
1590 1590
1591 for (i = 0; i < sbi->s_groups_count; i++) { 1591 for (i = 0; i < sbi->s_groups_count; i++) {
1592 struct ext4_group_desc *gdp = ext4_get_group_desc(sb, i, NULL); 1592 struct ext4_group_desc *gdp = ext4_get_group_desc(sb, i, NULL);
diff --git a/fs/ext4/symlink.c b/fs/ext4/symlink.c
index e9178643dc01..0013d52f73bb 100644
--- a/fs/ext4/symlink.c
+++ b/fs/ext4/symlink.c
@@ -23,10 +23,10 @@
23#include "ext4.h" 23#include "ext4.h"
24#include "xattr.h" 24#include "xattr.h"
25 25
26static void * ext4_follow_link(struct dentry *dentry, struct nameidata *nd) 26static void *ext4_follow_link(struct dentry *dentry, struct nameidata *nd)
27{ 27{
28 struct ext4_inode_info *ei = EXT4_I(dentry->d_inode); 28 struct ext4_inode_info *ei = EXT4_I(dentry->d_inode);
29 nd_set_link(nd, (char*)ei->i_data); 29 nd_set_link(nd, (char *) ei->i_data);
30 return NULL; 30 return NULL;
31} 31}
32 32
diff --git a/fs/ext4/xattr.h b/fs/ext4/xattr.h
index 5992fe979bb9..814ea58d4d57 100644
--- a/fs/ext4/xattr.h
+++ b/fs/ext4/xattr.h
@@ -51,8 +51,8 @@ struct ext4_xattr_entry {
51 (((name_len) + EXT4_XATTR_ROUND + \ 51 (((name_len) + EXT4_XATTR_ROUND + \
52 sizeof(struct ext4_xattr_entry)) & ~EXT4_XATTR_ROUND) 52 sizeof(struct ext4_xattr_entry)) & ~EXT4_XATTR_ROUND)
53#define EXT4_XATTR_NEXT(entry) \ 53#define EXT4_XATTR_NEXT(entry) \
54 ( (struct ext4_xattr_entry *)( \ 54 ((struct ext4_xattr_entry *)( \
55 (char *)(entry) + EXT4_XATTR_LEN((entry)->e_name_len)) ) 55 (char *)(entry) + EXT4_XATTR_LEN((entry)->e_name_len)))
56#define EXT4_XATTR_SIZE(size) \ 56#define EXT4_XATTR_SIZE(size) \
57 (((size) + EXT4_XATTR_ROUND) & ~EXT4_XATTR_ROUND) 57 (((size) + EXT4_XATTR_ROUND) & ~EXT4_XATTR_ROUND)
58 58