diff options
author | Theodore Ts'o <tytso@mit.edu> | 2008-09-08 22:25:24 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-09-08 22:25:24 -0400 |
commit | af5bc92dded4d98dfeabc8b5b9812571345b263d (patch) | |
tree | 5cfaf27e673a09d3ad1341c175559be0a3ea990d /fs/ext4/namei.c | |
parent | e5f8eab8851dff162e7ade46f084cb8575dc45f7 (diff) |
ext4: Fix whitespace checkpatch warnings/errors
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/namei.c')
-rw-r--r-- | fs/ext4/namei.c | 302 |
1 files changed, 151 insertions, 151 deletions
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 | ||
152 | static inline ext4_lblk_t dx_get_block(struct dx_entry *entry); | 152 | static inline ext4_lblk_t dx_get_block(struct dx_entry *entry); |
153 | static void dx_set_block(struct dx_entry *entry, ext4_lblk_t value); | 153 | static void dx_set_block(struct dx_entry *entry, ext4_lblk_t value); |
154 | static inline unsigned dx_get_hash (struct dx_entry *entry); | 154 | static inline unsigned dx_get_hash(struct dx_entry *entry); |
155 | static void dx_set_hash (struct dx_entry *entry, unsigned value); | 155 | static void dx_set_hash(struct dx_entry *entry, unsigned value); |
156 | static unsigned dx_get_count (struct dx_entry *entries); | 156 | static unsigned dx_get_count(struct dx_entry *entries); |
157 | static unsigned dx_get_limit (struct dx_entry *entries); | 157 | static unsigned dx_get_limit(struct dx_entry *entries); |
158 | static void dx_set_count (struct dx_entry *entries, unsigned value); | 158 | static void dx_set_count(struct dx_entry *entries, unsigned value); |
159 | static void dx_set_limit (struct dx_entry *entries, unsigned value); | 159 | static void dx_set_limit(struct dx_entry *entries, unsigned value); |
160 | static unsigned dx_root_limit (struct inode *dir, unsigned infosize); | 160 | static unsigned dx_root_limit(struct inode *dir, unsigned infosize); |
161 | static unsigned dx_node_limit (struct inode *dir); | 161 | static unsigned dx_node_limit(struct inode *dir); |
162 | static struct dx_frame *dx_probe(struct dentry *dentry, | 162 | static 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); |
167 | static void dx_release (struct dx_frame *frames); | 167 | static void dx_release(struct dx_frame *frames); |
168 | static int dx_make_map (struct ext4_dir_entry_2 *de, int size, | 168 | static 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[]); |
170 | static void dx_sort_map(struct dx_map_entry *map, unsigned count); | 170 | static void dx_sort_map(struct dx_map_entry *map, unsigned count); |
171 | static struct ext4_dir_entry_2 *dx_move_dirents (char *from, char *to, | 171 | static 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); |
173 | static struct ext4_dir_entry_2* dx_pack_dirents (char *base, int size); | 173 | static struct ext4_dir_entry_2* dx_pack_dirents(char *base, int size); |
174 | static void dx_insert_block(struct dx_frame *frame, | 174 | static void dx_insert_block(struct dx_frame *frame, |
175 | u32 hash, ext4_lblk_t block); | 175 | u32 hash, ext4_lblk_t block); |
176 | static int ext4_htree_next_block(struct inode *dir, __u32 hash, | 176 | static 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 | ||
210 | static inline unsigned dx_get_hash (struct dx_entry *entry) | 210 | static 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 | ||
215 | static inline void dx_set_hash (struct dx_entry *entry, unsigned value) | 215 | static 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 | ||
220 | static inline unsigned dx_get_count (struct dx_entry *entries) | 220 | static 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 | ||
225 | static inline unsigned dx_get_limit (struct dx_entry *entries) | 225 | static 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 | ||
230 | static inline void dx_set_count (struct dx_entry *entries, unsigned value) | 230 | static 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 | ||
235 | static inline void dx_set_limit (struct dx_entry *entries, unsigned value) | 235 | static 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 | ||
240 | static inline unsigned dx_root_limit (struct inode *dir, unsigned infosize) | 240 | static 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 | ||
247 | static inline unsigned dx_node_limit (struct inode *dir) | 247 | static 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 | */ |
806 | static inline int search_dirblock(struct buffer_head * bh, | 806 | static 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, | |||
855 | static struct buffer_head * ext4_find_entry (struct dentry *dentry, | 855 | static 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: | |||
958 | cleanup_and_exit: | 958 | cleanup_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 | ||
1035 | static struct dentry *ext4_lookup(struct inode * dir, struct dentry *dentry, struct nameidata *nd) | 1035 | static 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 | ||
1253 | journal_error: | 1253 | journal_error: |
@@ -1273,7 +1273,7 @@ errout: | |||
1273 | */ | 1273 | */ |
1274 | static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry, | 1274 | static 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 | */ |
1448 | static int ext4_add_entry (handle_t *handle, struct dentry *dentry, | 1448 | static 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 | */ |
1637 | static int ext4_delete_entry (handle_t *handle, | 1637 | static 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 | */ |
1723 | static int ext4_create (struct inode * dir, struct dentry * dentry, int mode, | 1723 | static 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 | ||
1730 | retry: | 1730 | retry: |
@@ -1751,8 +1751,8 @@ retry: | |||
1751 | return err; | 1751 | return err; |
1752 | } | 1752 | } |
1753 | 1753 | ||
1754 | static int ext4_mknod (struct inode * dir, struct dentry *dentry, | 1754 | static 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 | ||
1789 | static int ext4_mkdir(struct inode * dir, struct dentry * dentry, int mode) | 1789 | static 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) { |
1843 | out_clear_inode: | 1843 | out_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 | */ |
1863 | static int empty_dir (struct inode * inode) | 1863 | static 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 | ||
2076 | static int ext4_rmdir (struct inode * dir, struct dentry *dentry) | 2076 | static 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 | ||
2129 | end_rmdir: | 2129 | end_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 | ||
2135 | static int ext4_unlink(struct inode * dir, struct dentry *dentry) | 2135 | static 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 | ||
2183 | end_unlink: | 2183 | end_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 | ||
2189 | static int ext4_symlink (struct inode * dir, | 2189 | static 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 | ||
2247 | static int ext4_link (struct dentry * old_dentry, | 2247 | static 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 | */ |
2291 | static int ext4_rename (struct inode * old_dir, struct dentry *old_dentry, | 2291 | static 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 | ||
2439 | end_rename: | 2439 | end_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 | } |