Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174719
b: refs/heads/master
c: 565de40
h: refs/heads/master
i:
  174717: 26ed8c0
  174715: 4aac978
  174711: 22c6bd8
  174703: 5ac7b26
  174687: 04c475a
  174655: fa3ae19
  174591: 176efaa
v: v3
  • Loading branch information
Jiro SEKIBA authored and Ryusuke Konishi committed Nov 27, 2009
1 parent 8f3ddf4 commit 54ce1bc
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 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: 43f8bc262fcfadc7583b2353d2708e6eb77788ff
refs/heads/master: 565de406e7bfa92ffec6315e89857986da657192
49 changes: 32 additions & 17 deletions trunk/fs/nilfs2/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ static int nilfs_symlink(struct inode *dir, struct dentry *dentry,
return err;

out_fail:
inode_dec_link_count(inode);
drop_nlink(inode);
mark_inode_dirty(inode);
iput(inode);
goto out;
}
Expand Down Expand Up @@ -245,7 +246,8 @@ static int nilfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
if (err)
return err;

inode_inc_link_count(dir);
inc_nlink(dir);
mark_inode_dirty(dir);

inode = nilfs_new_inode(dir, S_IFDIR | mode);
err = PTR_ERR(inode);
Expand All @@ -256,7 +258,8 @@ static int nilfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
inode->i_fop = &nilfs_dir_operations;
inode->i_mapping->a_ops = &nilfs_aops;

inode_inc_link_count(inode);
inc_nlink(inode);
mark_inode_dirty(inode);

err = nilfs_make_empty(inode, dir);
if (err)
Expand All @@ -276,11 +279,14 @@ static int nilfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
return err;

out_fail:
inode_dec_link_count(inode);
inode_dec_link_count(inode);
drop_nlink(inode);
mark_inode_dirty(inode);
drop_nlink(inode);
mark_inode_dirty(inode);
iput(inode);
out_dir:
inode_dec_link_count(dir);
drop_nlink(dir);
mark_inode_dirty(dir);
goto out;
}

Expand Down Expand Up @@ -317,7 +323,8 @@ static int nilfs_unlink(struct inode *dir, struct dentry *dentry)
goto out;

inode->i_ctime = dir->i_ctime;
inode_dec_link_count(inode);
drop_nlink(inode);
mark_inode_dirty(inode);
err = 0;
out:
if (!err)
Expand All @@ -343,8 +350,10 @@ static int nilfs_rmdir(struct inode *dir, struct dentry *dentry)
err = nilfs_unlink(dir, dentry);
if (!err) {
inode->i_size = 0;
inode_dec_link_count(inode);
inode_dec_link_count(dir);
drop_nlink(inode);
mark_inode_dirty(inode);
drop_nlink(dir);
mark_inode_dirty(dir);
}
}
if (!err)
Expand Down Expand Up @@ -395,33 +404,38 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
new_de = nilfs_find_entry(new_dir, new_dentry, &new_page);
if (!new_de)
goto out_dir;
inode_inc_link_count(old_inode);
inc_nlink(old_inode);
mark_inode_dirty(old_inode);
nilfs_set_link(new_dir, new_de, new_page, old_inode);
mark_inode_dirty(new_dir);
new_inode->i_ctime = CURRENT_TIME;
if (dir_de)
drop_nlink(new_inode);
inode_dec_link_count(new_inode);
drop_nlink(new_inode);
mark_inode_dirty(new_inode);
} else {
if (dir_de) {
err = -EMLINK;
if (new_dir->i_nlink >= NILFS_LINK_MAX)
goto out_dir;
}
inode_inc_link_count(old_inode);
inc_nlink(old_inode);
mark_inode_dirty(old_inode);
err = nilfs_add_link(new_dentry, old_inode);
if (err) {
inode_dec_link_count(old_inode);
drop_nlink(old_inode);
mark_inode_dirty(old_inode);
goto out_dir;
}
if (dir_de)
inode_inc_link_count(new_dir);
if (dir_de) {
inc_nlink(new_dir);
mark_inode_dirty(new_dir);
}
}

/*
* Like most other Unix systems, set the ctime for inodes on a
* rename.
* inode_dec_link_count() will mark the inode dirty.
*/
old_inode->i_ctime = CURRENT_TIME;

Expand All @@ -430,7 +444,8 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,

if (dir_de) {
nilfs_set_link(old_inode, dir_de, dir_page, new_dir);
inode_dec_link_count(old_dir);
drop_nlink(old_dir);
mark_inode_dirty(old_dir);
}
mark_inode_dirty(old_inode);

Expand Down

0 comments on commit 54ce1bc

Please sign in to comment.