Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 213749
b: refs/heads/master
c: 367ea33
h: refs/heads/master
i:
  213747: f8a001a
v: v3
  • Loading branch information
Ryusuke Konishi committed Oct 23, 2010
1 parent f00769e commit 5e223cb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dc3d3b810a644dfa329efaa230cd514226f8981d
refs/heads/master: 367ea33486a68f935a01311a3be9b7e97d2e5ead
54 changes: 35 additions & 19 deletions trunk/fs/nilfs2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,39 @@ int nilfs_check_feature_compatibility(struct super_block *sb,
return 0;
}

static int nilfs_get_root_dentry(struct super_block *sb,
struct nilfs_root *root,
struct dentry **root_dentry)
{
struct inode *inode;
struct dentry *dentry;
int ret = 0;

inode = nilfs_iget(sb, root, NILFS_ROOT_INO);
if (IS_ERR(inode)) {
printk(KERN_ERR "NILFS: get root inode failed\n");
ret = PTR_ERR(inode);
goto out;
}
if (!S_ISDIR(inode->i_mode) || !inode->i_blocks || !inode->i_size) {
iput(inode);
printk(KERN_ERR "NILFS: corrupt root inode.\n");
ret = -EINVAL;
goto out;
}

dentry = d_alloc_root(inode);
if (!dentry) {
iput(inode);
printk(KERN_ERR "NILFS: get root dentry failed\n");
ret = -ENOMEM;
goto out;
}
*root_dentry = dentry;
out:
return ret;
}

/**
* nilfs_fill_super() - initialize a super block instance
* @sb: super_block
Expand All @@ -766,7 +799,6 @@ nilfs_fill_super(struct super_block *sb, void *data, int silent,
{
struct nilfs_sb_info *sbi;
struct nilfs_root *fsroot;
struct inode *root;
__u64 cno;
int err, curr_mnt;

Expand Down Expand Up @@ -850,25 +882,9 @@ nilfs_fill_super(struct super_block *sb, void *data, int silent,
goto failed_checkpoint;
}

root = nilfs_iget(sb, fsroot, NILFS_ROOT_INO);
if (IS_ERR(root)) {
printk(KERN_ERR "NILFS: get root inode failed\n");
err = PTR_ERR(root);
goto failed_segctor;
}
if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
iput(root);
printk(KERN_ERR "NILFS: corrupt root inode.\n");
err = -EINVAL;
goto failed_segctor;
}
sb->s_root = d_alloc_root(root);
if (!sb->s_root) {
iput(root);
printk(KERN_ERR "NILFS: get root dentry failed\n");
err = -ENOMEM;
err = nilfs_get_root_dentry(sb, fsroot, &sb->s_root);
if (err)
goto failed_segctor;
}

nilfs_put_root(fsroot);

Expand Down

0 comments on commit 5e223cb

Please sign in to comment.