aboutsummaryrefslogtreecommitdiffstats
path: root/fs/befs/linuxvfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/befs/linuxvfs.c')
-rw-r--r--fs/befs/linuxvfs.c43
1 files changed, 28 insertions, 15 deletions
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index b28a20e61b80..82123ff3e1dd 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -35,7 +35,7 @@ static int befs_get_block(struct inode *, sector_t, struct buffer_head *, int);
35static int befs_readpage(struct file *file, struct page *page); 35static int befs_readpage(struct file *file, struct page *page);
36static sector_t befs_bmap(struct address_space *mapping, sector_t block); 36static sector_t befs_bmap(struct address_space *mapping, sector_t block);
37static struct dentry *befs_lookup(struct inode *, struct dentry *, struct nameidata *); 37static struct dentry *befs_lookup(struct inode *, struct dentry *, struct nameidata *);
38static void befs_read_inode(struct inode *ino); 38static struct inode *befs_iget(struct super_block *, unsigned long);
39static struct inode *befs_alloc_inode(struct super_block *sb); 39static struct inode *befs_alloc_inode(struct super_block *sb);
40static void befs_destroy_inode(struct inode *inode); 40static void befs_destroy_inode(struct inode *inode);
41static int befs_init_inodecache(void); 41static int befs_init_inodecache(void);
@@ -52,12 +52,12 @@ static int befs_statfs(struct dentry *, struct kstatfs *);
52static int parse_options(char *, befs_mount_options *); 52static int parse_options(char *, befs_mount_options *);
53 53
54static const struct super_operations befs_sops = { 54static const struct super_operations befs_sops = {
55 .read_inode = befs_read_inode, /* initialize & read inode */
56 .alloc_inode = befs_alloc_inode, /* allocate a new inode */ 55 .alloc_inode = befs_alloc_inode, /* allocate a new inode */
57 .destroy_inode = befs_destroy_inode, /* deallocate an inode */ 56 .destroy_inode = befs_destroy_inode, /* deallocate an inode */
58 .put_super = befs_put_super, /* uninit super */ 57 .put_super = befs_put_super, /* uninit super */
59 .statfs = befs_statfs, /* statfs */ 58 .statfs = befs_statfs, /* statfs */
60 .remount_fs = befs_remount, 59 .remount_fs = befs_remount,
60 .show_options = generic_show_options,
61}; 61};
62 62
63/* slab cache for befs_inode_info objects */ 63/* slab cache for befs_inode_info objects */
@@ -198,9 +198,9 @@ befs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
198 return ERR_PTR(-ENODATA); 198 return ERR_PTR(-ENODATA);
199 } 199 }
200 200
201 inode = iget(dir->i_sb, (ino_t) offset); 201 inode = befs_iget(dir->i_sb, (ino_t) offset);
202 if (!inode) 202 if (IS_ERR(inode))
203 return ERR_PTR(-EACCES); 203 return ERR_CAST(inode);
204 204
205 d_add(dentry, inode); 205 d_add(dentry, inode);
206 206
@@ -296,17 +296,23 @@ static void init_once(struct kmem_cache *cachep, void *foo)
296 inode_init_once(&bi->vfs_inode); 296 inode_init_once(&bi->vfs_inode);
297} 297}
298 298
299static void 299static struct inode *befs_iget(struct super_block *sb, unsigned long ino)
300befs_read_inode(struct inode *inode)
301{ 300{
302 struct buffer_head *bh = NULL; 301 struct buffer_head *bh = NULL;
303 befs_inode *raw_inode = NULL; 302 befs_inode *raw_inode = NULL;
304 303
305 struct super_block *sb = inode->i_sb;
306 befs_sb_info *befs_sb = BEFS_SB(sb); 304 befs_sb_info *befs_sb = BEFS_SB(sb);
307 befs_inode_info *befs_ino = NULL; 305 befs_inode_info *befs_ino = NULL;
306 struct inode *inode;
307 long ret = -EIO;
308
309 befs_debug(sb, "---> befs_read_inode() " "inode = %lu", ino);
308 310
309 befs_debug(sb, "---> befs_read_inode() " "inode = %lu", inode->i_ino); 311 inode = iget_locked(sb, ino);
312 if (IS_ERR(inode))
313 return inode;
314 if (!(inode->i_state & I_NEW))
315 return inode;
310 316
311 befs_ino = BEFS_I(inode); 317 befs_ino = BEFS_I(inode);
312 318
@@ -402,15 +408,16 @@ befs_read_inode(struct inode *inode)
402 408
403 brelse(bh); 409 brelse(bh);
404 befs_debug(sb, "<--- befs_read_inode()"); 410 befs_debug(sb, "<--- befs_read_inode()");
405 return; 411 unlock_new_inode(inode);
412 return inode;
406 413
407 unacquire_bh: 414 unacquire_bh:
408 brelse(bh); 415 brelse(bh);
409 416
410 unacquire_none: 417 unacquire_none:
411 make_bad_inode(inode); 418 iget_failed(inode);
412 befs_debug(sb, "<--- befs_read_inode() - Bad inode"); 419 befs_debug(sb, "<--- befs_read_inode() - Bad inode");
413 return; 420 return ERR_PTR(ret);
414} 421}
415 422
416/* Initialize the inode cache. Called at fs setup. 423/* Initialize the inode cache. Called at fs setup.
@@ -752,10 +759,12 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
752 befs_sb_info *befs_sb; 759 befs_sb_info *befs_sb;
753 befs_super_block *disk_sb; 760 befs_super_block *disk_sb;
754 struct inode *root; 761 struct inode *root;
755 762 long ret = -EINVAL;
756 const unsigned long sb_block = 0; 763 const unsigned long sb_block = 0;
757 const off_t x86_sb_off = 512; 764 const off_t x86_sb_off = 512;
758 765
766 save_mount_options(sb, data);
767
759 sb->s_fs_info = kmalloc(sizeof (*befs_sb), GFP_KERNEL); 768 sb->s_fs_info = kmalloc(sizeof (*befs_sb), GFP_KERNEL);
760 if (sb->s_fs_info == NULL) { 769 if (sb->s_fs_info == NULL) {
761 printk(KERN_ERR 770 printk(KERN_ERR
@@ -833,7 +842,11 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
833 /* Set real blocksize of fs */ 842 /* Set real blocksize of fs */
834 sb_set_blocksize(sb, (ulong) befs_sb->block_size); 843 sb_set_blocksize(sb, (ulong) befs_sb->block_size);
835 sb->s_op = (struct super_operations *) &befs_sops; 844 sb->s_op = (struct super_operations *) &befs_sops;
836 root = iget(sb, iaddr2blockno(sb, &(befs_sb->root_dir))); 845 root = befs_iget(sb, iaddr2blockno(sb, &(befs_sb->root_dir)));
846 if (IS_ERR(root)) {
847 ret = PTR_ERR(root);
848 goto unacquire_priv_sbp;
849 }
837 sb->s_root = d_alloc_root(root); 850 sb->s_root = d_alloc_root(root);
838 if (!sb->s_root) { 851 if (!sb->s_root) {
839 iput(root); 852 iput(root);
@@ -868,7 +881,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
868 881
869 unacquire_none: 882 unacquire_none:
870 sb->s_fs_info = NULL; 883 sb->s_fs_info = NULL;
871 return -EINVAL; 884 return ret;
872} 885}
873 886
874static int 887static int