diff options
Diffstat (limited to 'fs/ext3/namei.c')
-rw-r--r-- | fs/ext3/namei.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index 85d132c37ee0..906731a20f1a 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/string.h> | 35 | #include <linux/string.h> |
36 | #include <linux/quotaops.h> | 36 | #include <linux/quotaops.h> |
37 | #include <linux/buffer_head.h> | 37 | #include <linux/buffer_head.h> |
38 | #include <linux/bio.h> | ||
38 | #include <linux/smp_lock.h> | 39 | #include <linux/smp_lock.h> |
39 | 40 | ||
40 | #include "namei.h" | 41 | #include "namei.h" |
@@ -870,7 +871,7 @@ restart: | |||
870 | bh = ext3_getblk(NULL, dir, b++, 0, &err); | 871 | bh = ext3_getblk(NULL, dir, b++, 0, &err); |
871 | bh_use[ra_max] = bh; | 872 | bh_use[ra_max] = bh; |
872 | if (bh) | 873 | if (bh) |
873 | ll_rw_block(READ, 1, &bh); | 874 | ll_rw_block(READ_META, 1, &bh); |
874 | } | 875 | } |
875 | } | 876 | } |
876 | if ((bh = bh_use[ra_ptr++]) == NULL) | 877 | if ((bh = bh_use[ra_ptr++]) == NULL) |
@@ -1615,12 +1616,12 @@ static int ext3_delete_entry (handle_t *handle, | |||
1615 | */ | 1616 | */ |
1616 | static inline void ext3_inc_count(handle_t *handle, struct inode *inode) | 1617 | static inline void ext3_inc_count(handle_t *handle, struct inode *inode) |
1617 | { | 1618 | { |
1618 | inode->i_nlink++; | 1619 | inc_nlink(inode); |
1619 | } | 1620 | } |
1620 | 1621 | ||
1621 | static inline void ext3_dec_count(handle_t *handle, struct inode *inode) | 1622 | static inline void ext3_dec_count(handle_t *handle, struct inode *inode) |
1622 | { | 1623 | { |
1623 | inode->i_nlink--; | 1624 | drop_nlink(inode); |
1624 | } | 1625 | } |
1625 | 1626 | ||
1626 | static int ext3_add_nondir(handle_t *handle, | 1627 | static int ext3_add_nondir(handle_t *handle, |
@@ -1742,7 +1743,7 @@ retry: | |||
1742 | inode->i_size = EXT3_I(inode)->i_disksize = inode->i_sb->s_blocksize; | 1743 | inode->i_size = EXT3_I(inode)->i_disksize = inode->i_sb->s_blocksize; |
1743 | dir_block = ext3_bread (handle, inode, 0, 1, &err); | 1744 | dir_block = ext3_bread (handle, inode, 0, 1, &err); |
1744 | if (!dir_block) { | 1745 | if (!dir_block) { |
1745 | inode->i_nlink--; /* is this nlink == 0? */ | 1746 | drop_nlink(inode); /* is this nlink == 0? */ |
1746 | ext3_mark_inode_dirty(handle, inode); | 1747 | ext3_mark_inode_dirty(handle, inode); |
1747 | iput (inode); | 1748 | iput (inode); |
1748 | goto out_stop; | 1749 | goto out_stop; |
@@ -1774,7 +1775,7 @@ retry: | |||
1774 | iput (inode); | 1775 | iput (inode); |
1775 | goto out_stop; | 1776 | goto out_stop; |
1776 | } | 1777 | } |
1777 | dir->i_nlink++; | 1778 | inc_nlink(dir); |
1778 | ext3_update_dx_flag(dir); | 1779 | ext3_update_dx_flag(dir); |
1779 | ext3_mark_inode_dirty(handle, dir); | 1780 | ext3_mark_inode_dirty(handle, dir); |
1780 | d_instantiate(dentry, inode); | 1781 | d_instantiate(dentry, inode); |
@@ -2044,7 +2045,7 @@ static int ext3_rmdir (struct inode * dir, struct dentry *dentry) | |||
2044 | "empty directory has nlink!=2 (%d)", | 2045 | "empty directory has nlink!=2 (%d)", |
2045 | inode->i_nlink); | 2046 | inode->i_nlink); |
2046 | inode->i_version++; | 2047 | inode->i_version++; |
2047 | inode->i_nlink = 0; | 2048 | clear_nlink(inode); |
2048 | /* There's no need to set i_disksize: the fact that i_nlink is | 2049 | /* There's no need to set i_disksize: the fact that i_nlink is |
2049 | * zero will ensure that the right thing happens during any | 2050 | * zero will ensure that the right thing happens during any |
2050 | * recovery. */ | 2051 | * recovery. */ |
@@ -2052,7 +2053,7 @@ static int ext3_rmdir (struct inode * dir, struct dentry *dentry) | |||
2052 | ext3_orphan_add(handle, inode); | 2053 | ext3_orphan_add(handle, inode); |
2053 | inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; | 2054 | inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; |
2054 | ext3_mark_inode_dirty(handle, inode); | 2055 | ext3_mark_inode_dirty(handle, inode); |
2055 | dir->i_nlink--; | 2056 | drop_nlink(dir); |
2056 | ext3_update_dx_flag(dir); | 2057 | ext3_update_dx_flag(dir); |
2057 | ext3_mark_inode_dirty(handle, dir); | 2058 | ext3_mark_inode_dirty(handle, dir); |
2058 | 2059 | ||
@@ -2103,7 +2104,7 @@ static int ext3_unlink(struct inode * dir, struct dentry *dentry) | |||
2103 | dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; | 2104 | dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; |
2104 | ext3_update_dx_flag(dir); | 2105 | ext3_update_dx_flag(dir); |
2105 | ext3_mark_inode_dirty(handle, dir); | 2106 | ext3_mark_inode_dirty(handle, dir); |
2106 | inode->i_nlink--; | 2107 | drop_nlink(inode); |
2107 | if (!inode->i_nlink) | 2108 | if (!inode->i_nlink) |
2108 | ext3_orphan_add(handle, inode); | 2109 | ext3_orphan_add(handle, inode); |
2109 | inode->i_ctime = dir->i_ctime; | 2110 | inode->i_ctime = dir->i_ctime; |
@@ -2325,7 +2326,7 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry, | |||
2325 | } | 2326 | } |
2326 | 2327 | ||
2327 | if (new_inode) { | 2328 | if (new_inode) { |
2328 | new_inode->i_nlink--; | 2329 | drop_nlink(new_inode); |
2329 | new_inode->i_ctime = CURRENT_TIME_SEC; | 2330 | new_inode->i_ctime = CURRENT_TIME_SEC; |
2330 | } | 2331 | } |
2331 | old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC; | 2332 | old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC; |
@@ -2336,11 +2337,11 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry, | |||
2336 | PARENT_INO(dir_bh->b_data) = cpu_to_le32(new_dir->i_ino); | 2337 | PARENT_INO(dir_bh->b_data) = cpu_to_le32(new_dir->i_ino); |
2337 | BUFFER_TRACE(dir_bh, "call ext3_journal_dirty_metadata"); | 2338 | BUFFER_TRACE(dir_bh, "call ext3_journal_dirty_metadata"); |
2338 | ext3_journal_dirty_metadata(handle, dir_bh); | 2339 | ext3_journal_dirty_metadata(handle, dir_bh); |
2339 | old_dir->i_nlink--; | 2340 | drop_nlink(old_dir); |
2340 | if (new_inode) { | 2341 | if (new_inode) { |
2341 | new_inode->i_nlink--; | 2342 | drop_nlink(new_inode); |
2342 | } else { | 2343 | } else { |
2343 | new_dir->i_nlink++; | 2344 | inc_nlink(new_dir); |
2344 | ext3_update_dx_flag(new_dir); | 2345 | ext3_update_dx_flag(new_dir); |
2345 | ext3_mark_inode_dirty(handle, new_dir); | 2346 | ext3_mark_inode_dirty(handle, new_dir); |
2346 | } | 2347 | } |