aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/dir.c')
-rw-r--r--fs/ext4/dir.c52
1 files changed, 26 insertions, 26 deletions
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);