diff options
Diffstat (limited to 'fs/ocfs2/namei.c')
-rw-r--r-- | fs/ocfs2/namei.c | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 50fb26a6a5f5..d9cd4e373a53 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -212,7 +212,7 @@ static struct inode *ocfs2_get_init_inode(struct inode *dir, int mode) | |||
212 | } else | 212 | } else |
213 | inode->i_gid = current_fsgid(); | 213 | inode->i_gid = current_fsgid(); |
214 | inode->i_mode = mode; | 214 | inode->i_mode = mode; |
215 | vfs_dq_init(inode); | 215 | dquot_initialize(inode); |
216 | return inode; | 216 | return inode; |
217 | } | 217 | } |
218 | 218 | ||
@@ -244,6 +244,8 @@ static int ocfs2_mknod(struct inode *dir, | |||
244 | (unsigned long)dev, dentry->d_name.len, | 244 | (unsigned long)dev, dentry->d_name.len, |
245 | dentry->d_name.name); | 245 | dentry->d_name.name); |
246 | 246 | ||
247 | dquot_initialize(dir); | ||
248 | |||
247 | /* get our super block */ | 249 | /* get our super block */ |
248 | osb = OCFS2_SB(dir->i_sb); | 250 | osb = OCFS2_SB(dir->i_sb); |
249 | 251 | ||
@@ -348,13 +350,9 @@ static int ocfs2_mknod(struct inode *dir, | |||
348 | goto leave; | 350 | goto leave; |
349 | } | 351 | } |
350 | 352 | ||
351 | /* We don't use standard VFS wrapper because we don't want vfs_dq_init | 353 | status = dquot_alloc_inode(inode); |
352 | * to be called. */ | 354 | if (status) |
353 | if (sb_any_quota_active(osb->sb) && | ||
354 | osb->sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) { | ||
355 | status = -EDQUOT; | ||
356 | goto leave; | 355 | goto leave; |
357 | } | ||
358 | did_quota_inode = 1; | 356 | did_quota_inode = 1; |
359 | 357 | ||
360 | mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry, | 358 | mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry, |
@@ -431,7 +429,7 @@ static int ocfs2_mknod(struct inode *dir, | |||
431 | status = 0; | 429 | status = 0; |
432 | leave: | 430 | leave: |
433 | if (status < 0 && did_quota_inode) | 431 | if (status < 0 && did_quota_inode) |
434 | vfs_dq_free_inode(inode); | 432 | dquot_free_inode(inode); |
435 | if (handle) | 433 | if (handle) |
436 | ocfs2_commit_trans(osb, handle); | 434 | ocfs2_commit_trans(osb, handle); |
437 | 435 | ||
@@ -636,6 +634,8 @@ static int ocfs2_link(struct dentry *old_dentry, | |||
636 | if (S_ISDIR(inode->i_mode)) | 634 | if (S_ISDIR(inode->i_mode)) |
637 | return -EPERM; | 635 | return -EPERM; |
638 | 636 | ||
637 | dquot_initialize(dir); | ||
638 | |||
639 | err = ocfs2_inode_lock_nested(dir, &parent_fe_bh, 1, OI_LS_PARENT); | 639 | err = ocfs2_inode_lock_nested(dir, &parent_fe_bh, 1, OI_LS_PARENT); |
640 | if (err < 0) { | 640 | if (err < 0) { |
641 | if (err != -ENOENT) | 641 | if (err != -ENOENT) |
@@ -791,6 +791,8 @@ static int ocfs2_unlink(struct inode *dir, | |||
791 | mlog_entry("(0x%p, 0x%p, '%.*s')\n", dir, dentry, | 791 | mlog_entry("(0x%p, 0x%p, '%.*s')\n", dir, dentry, |
792 | dentry->d_name.len, dentry->d_name.name); | 792 | dentry->d_name.len, dentry->d_name.name); |
793 | 793 | ||
794 | dquot_initialize(dir); | ||
795 | |||
794 | BUG_ON(dentry->d_parent->d_inode != dir); | 796 | BUG_ON(dentry->d_parent->d_inode != dir); |
795 | 797 | ||
796 | mlog(0, "ino = %llu\n", (unsigned long long)OCFS2_I(inode)->ip_blkno); | 798 | mlog(0, "ino = %llu\n", (unsigned long long)OCFS2_I(inode)->ip_blkno); |
@@ -1051,6 +1053,9 @@ static int ocfs2_rename(struct inode *old_dir, | |||
1051 | old_dentry->d_name.len, old_dentry->d_name.name, | 1053 | old_dentry->d_name.len, old_dentry->d_name.name, |
1052 | new_dentry->d_name.len, new_dentry->d_name.name); | 1054 | new_dentry->d_name.len, new_dentry->d_name.name); |
1053 | 1055 | ||
1056 | dquot_initialize(old_dir); | ||
1057 | dquot_initialize(new_dir); | ||
1058 | |||
1054 | osb = OCFS2_SB(old_dir->i_sb); | 1059 | osb = OCFS2_SB(old_dir->i_sb); |
1055 | 1060 | ||
1056 | if (new_inode) { | 1061 | if (new_inode) { |
@@ -1599,6 +1604,8 @@ static int ocfs2_symlink(struct inode *dir, | |||
1599 | mlog_entry("(0x%p, 0x%p, symname='%s' actual='%.*s')\n", dir, | 1604 | mlog_entry("(0x%p, 0x%p, symname='%s' actual='%.*s')\n", dir, |
1600 | dentry, symname, dentry->d_name.len, dentry->d_name.name); | 1605 | dentry, symname, dentry->d_name.len, dentry->d_name.name); |
1601 | 1606 | ||
1607 | dquot_initialize(dir); | ||
1608 | |||
1602 | sb = dir->i_sb; | 1609 | sb = dir->i_sb; |
1603 | osb = OCFS2_SB(sb); | 1610 | osb = OCFS2_SB(sb); |
1604 | 1611 | ||
@@ -1688,13 +1695,9 @@ static int ocfs2_symlink(struct inode *dir, | |||
1688 | goto bail; | 1695 | goto bail; |
1689 | } | 1696 | } |
1690 | 1697 | ||
1691 | /* We don't use standard VFS wrapper because we don't want vfs_dq_init | 1698 | status = dquot_alloc_inode(inode); |
1692 | * to be called. */ | 1699 | if (status) |
1693 | if (sb_any_quota_active(osb->sb) && | ||
1694 | osb->sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) { | ||
1695 | status = -EDQUOT; | ||
1696 | goto bail; | 1700 | goto bail; |
1697 | } | ||
1698 | did_quota_inode = 1; | 1701 | did_quota_inode = 1; |
1699 | 1702 | ||
1700 | mlog_entry("(0x%p, 0x%p, %d, '%.*s')\n", dir, dentry, | 1703 | mlog_entry("(0x%p, 0x%p, %d, '%.*s')\n", dir, dentry, |
@@ -1716,11 +1719,10 @@ static int ocfs2_symlink(struct inode *dir, | |||
1716 | u32 offset = 0; | 1719 | u32 offset = 0; |
1717 | 1720 | ||
1718 | inode->i_op = &ocfs2_symlink_inode_operations; | 1721 | inode->i_op = &ocfs2_symlink_inode_operations; |
1719 | if (vfs_dq_alloc_space_nodirty(inode, | 1722 | status = dquot_alloc_space_nodirty(inode, |
1720 | ocfs2_clusters_to_bytes(osb->sb, 1))) { | 1723 | ocfs2_clusters_to_bytes(osb->sb, 1)); |
1721 | status = -EDQUOT; | 1724 | if (status) |
1722 | goto bail; | 1725 | goto bail; |
1723 | } | ||
1724 | did_quota = 1; | 1726 | did_quota = 1; |
1725 | status = ocfs2_add_inode_data(osb, inode, &offset, 1, 0, | 1727 | status = ocfs2_add_inode_data(osb, inode, &offset, 1, 0, |
1726 | new_fe_bh, | 1728 | new_fe_bh, |
@@ -1788,10 +1790,10 @@ static int ocfs2_symlink(struct inode *dir, | |||
1788 | d_instantiate(dentry, inode); | 1790 | d_instantiate(dentry, inode); |
1789 | bail: | 1791 | bail: |
1790 | if (status < 0 && did_quota) | 1792 | if (status < 0 && did_quota) |
1791 | vfs_dq_free_space_nodirty(inode, | 1793 | dquot_free_space_nodirty(inode, |
1792 | ocfs2_clusters_to_bytes(osb->sb, 1)); | 1794 | ocfs2_clusters_to_bytes(osb->sb, 1)); |
1793 | if (status < 0 && did_quota_inode) | 1795 | if (status < 0 && did_quota_inode) |
1794 | vfs_dq_free_inode(inode); | 1796 | dquot_free_inode(inode); |
1795 | if (handle) | 1797 | if (handle) |
1796 | ocfs2_commit_trans(osb, handle); | 1798 | ocfs2_commit_trans(osb, handle); |
1797 | 1799 | ||
@@ -2099,13 +2101,9 @@ int ocfs2_create_inode_in_orphan(struct inode *dir, | |||
2099 | goto leave; | 2101 | goto leave; |
2100 | } | 2102 | } |
2101 | 2103 | ||
2102 | /* We don't use standard VFS wrapper because we don't want vfs_dq_init | 2104 | status = dquot_alloc_inode(inode); |
2103 | * to be called. */ | 2105 | if (status) |
2104 | if (sb_any_quota_active(osb->sb) && | ||
2105 | osb->sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) { | ||
2106 | status = -EDQUOT; | ||
2107 | goto leave; | 2106 | goto leave; |
2108 | } | ||
2109 | did_quota_inode = 1; | 2107 | did_quota_inode = 1; |
2110 | 2108 | ||
2111 | inode->i_nlink = 0; | 2109 | inode->i_nlink = 0; |
@@ -2140,7 +2138,7 @@ int ocfs2_create_inode_in_orphan(struct inode *dir, | |||
2140 | insert_inode_hash(inode); | 2138 | insert_inode_hash(inode); |
2141 | leave: | 2139 | leave: |
2142 | if (status < 0 && did_quota_inode) | 2140 | if (status < 0 && did_quota_inode) |
2143 | vfs_dq_free_inode(inode); | 2141 | dquot_free_inode(inode); |
2144 | if (handle) | 2142 | if (handle) |
2145 | ocfs2_commit_trans(osb, handle); | 2143 | ocfs2_commit_trans(osb, handle); |
2146 | 2144 | ||