diff options
-rw-r--r-- | Documentation/filesystems/Locking | 8 | ||||
-rw-r--r-- | fs/ext2/ialloc.c | 10 | ||||
-rw-r--r-- | fs/ext3/ialloc.c | 10 | ||||
-rw-r--r-- | fs/ext3/super.c | 2 | ||||
-rw-r--r-- | fs/ext4/ialloc.c | 10 | ||||
-rw-r--r-- | fs/ext4/super.c | 2 | ||||
-rw-r--r-- | fs/jfs/inode.c | 2 | ||||
-rw-r--r-- | fs/jfs/jfs_inode.c | 6 | ||||
-rw-r--r-- | fs/ocfs2/inode.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/namei.c | 30 | ||||
-rw-r--r-- | fs/ocfs2/quota_global.c | 2 | ||||
-rw-r--r-- | fs/quota/dquot.c | 29 | ||||
-rw-r--r-- | fs/reiserfs/inode.c | 10 | ||||
-rw-r--r-- | fs/reiserfs/super.c | 2 | ||||
-rw-r--r-- | fs/udf/ialloc.c | 10 | ||||
-rw-r--r-- | fs/ufs/ialloc.c | 7 | ||||
-rw-r--r-- | include/linux/quota.h | 2 | ||||
-rw-r--r-- | include/linux/quotaops.h | 24 |
18 files changed, 61 insertions, 107 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index 1192fde11638..4428f55f2131 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking | |||
@@ -462,8 +462,6 @@ in sys_read() and friends. | |||
462 | prototypes: | 462 | prototypes: |
463 | int (*initialize) (struct inode *, int); | 463 | int (*initialize) (struct inode *, int); |
464 | int (*drop) (struct inode *); | 464 | int (*drop) (struct inode *); |
465 | int (*alloc_inode) (const struct inode *, unsigned long); | ||
466 | int (*free_inode) (const struct inode *, unsigned long); | ||
467 | int (*transfer) (struct inode *, struct iattr *); | 465 | int (*transfer) (struct inode *, struct iattr *); |
468 | int (*write_dquot) (struct dquot *); | 466 | int (*write_dquot) (struct dquot *); |
469 | int (*acquire_dquot) (struct dquot *); | 467 | int (*acquire_dquot) (struct dquot *); |
@@ -479,8 +477,6 @@ What filesystem should expect from the generic quota functions: | |||
479 | FS recursion Held locks when called | 477 | FS recursion Held locks when called |
480 | initialize: yes maybe dqonoff_sem | 478 | initialize: yes maybe dqonoff_sem |
481 | drop: yes - | 479 | drop: yes - |
482 | alloc_inode: ->mark_dirty() - | ||
483 | free_inode: ->mark_dirty() - | ||
484 | transfer: yes - | 480 | transfer: yes - |
485 | write_dquot: yes dqonoff_sem or dqptr_sem | 481 | write_dquot: yes dqonoff_sem or dqptr_sem |
486 | acquire_dquot: yes dqonoff_sem or dqptr_sem | 482 | acquire_dquot: yes dqonoff_sem or dqptr_sem |
@@ -491,10 +487,6 @@ write_info: yes dqonoff_sem | |||
491 | FS recursion means calling ->quota_read() and ->quota_write() from superblock | 487 | FS recursion means calling ->quota_read() and ->quota_write() from superblock |
492 | operations. | 488 | operations. |
493 | 489 | ||
494 | ->alloc_inode(), ->free_inode() are called | ||
495 | only directly by the filesystem and do not call any fs functions only | ||
496 | the ->mark_dirty() operation. | ||
497 | |||
498 | More details about quota locking can be found in fs/dquot.c. | 490 | More details about quota locking can be found in fs/dquot.c. |
499 | 491 | ||
500 | --------------------------- vm_operations_struct ----------------------------- | 492 | --------------------------- vm_operations_struct ----------------------------- |
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c index 15387c9c17d8..d12f9809559c 100644 --- a/fs/ext2/ialloc.c +++ b/fs/ext2/ialloc.c | |||
@@ -121,7 +121,7 @@ void ext2_free_inode (struct inode * inode) | |||
121 | if (!is_bad_inode(inode)) { | 121 | if (!is_bad_inode(inode)) { |
122 | /* Quota is already initialized in iput() */ | 122 | /* Quota is already initialized in iput() */ |
123 | ext2_xattr_delete_inode(inode); | 123 | ext2_xattr_delete_inode(inode); |
124 | vfs_dq_free_inode(inode); | 124 | dquot_free_inode(inode); |
125 | vfs_dq_drop(inode); | 125 | vfs_dq_drop(inode); |
126 | } | 126 | } |
127 | 127 | ||
@@ -586,10 +586,10 @@ got: | |||
586 | goto fail_drop; | 586 | goto fail_drop; |
587 | } | 587 | } |
588 | 588 | ||
589 | if (vfs_dq_alloc_inode(inode)) { | 589 | vfs_dq_init(inode); |
590 | err = -EDQUOT; | 590 | err = dquot_alloc_inode(inode); |
591 | if (err) | ||
591 | goto fail_drop; | 592 | goto fail_drop; |
592 | } | ||
593 | 593 | ||
594 | err = ext2_init_acl(inode, dir); | 594 | err = ext2_init_acl(inode, dir); |
595 | if (err) | 595 | if (err) |
@@ -605,7 +605,7 @@ got: | |||
605 | return inode; | 605 | return inode; |
606 | 606 | ||
607 | fail_free_drop: | 607 | fail_free_drop: |
608 | vfs_dq_free_inode(inode); | 608 | dquot_free_inode(inode); |
609 | 609 | ||
610 | fail_drop: | 610 | fail_drop: |
611 | vfs_dq_drop(inode); | 611 | vfs_dq_drop(inode); |
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c index b39991285136..8bf00e997c38 100644 --- a/fs/ext3/ialloc.c +++ b/fs/ext3/ialloc.c | |||
@@ -125,7 +125,7 @@ void ext3_free_inode (handle_t *handle, struct inode * inode) | |||
125 | */ | 125 | */ |
126 | vfs_dq_init(inode); | 126 | vfs_dq_init(inode); |
127 | ext3_xattr_delete_inode(handle, inode); | 127 | ext3_xattr_delete_inode(handle, inode); |
128 | vfs_dq_free_inode(inode); | 128 | dquot_free_inode(inode); |
129 | vfs_dq_drop(inode); | 129 | vfs_dq_drop(inode); |
130 | 130 | ||
131 | is_directory = S_ISDIR(inode->i_mode); | 131 | is_directory = S_ISDIR(inode->i_mode); |
@@ -588,10 +588,10 @@ got: | |||
588 | sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE : 0; | 588 | sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE : 0; |
589 | 589 | ||
590 | ret = inode; | 590 | ret = inode; |
591 | if (vfs_dq_alloc_inode(inode)) { | 591 | vfs_dq_init(inode); |
592 | err = -EDQUOT; | 592 | err = dquot_alloc_inode(inode); |
593 | if (err) | ||
593 | goto fail_drop; | 594 | goto fail_drop; |
594 | } | ||
595 | 595 | ||
596 | err = ext3_init_acl(handle, inode, dir); | 596 | err = ext3_init_acl(handle, inode, dir); |
597 | if (err) | 597 | if (err) |
@@ -619,7 +619,7 @@ really_out: | |||
619 | return ret; | 619 | return ret; |
620 | 620 | ||
621 | fail_free_drop: | 621 | fail_free_drop: |
622 | vfs_dq_free_inode(inode); | 622 | dquot_free_inode(inode); |
623 | 623 | ||
624 | fail_drop: | 624 | fail_drop: |
625 | vfs_dq_drop(inode); | 625 | vfs_dq_drop(inode); |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 8c13910a3782..8b8bc4f9cb14 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -752,8 +752,6 @@ static ssize_t ext3_quota_write(struct super_block *sb, int type, | |||
752 | static const struct dquot_operations ext3_quota_operations = { | 752 | static const struct dquot_operations ext3_quota_operations = { |
753 | .initialize = dquot_initialize, | 753 | .initialize = dquot_initialize, |
754 | .drop = dquot_drop, | 754 | .drop = dquot_drop, |
755 | .alloc_inode = dquot_alloc_inode, | ||
756 | .free_inode = dquot_free_inode, | ||
757 | .transfer = dquot_transfer, | 755 | .transfer = dquot_transfer, |
758 | .write_dquot = ext3_write_dquot, | 756 | .write_dquot = ext3_write_dquot, |
759 | .acquire_dquot = ext3_acquire_dquot, | 757 | .acquire_dquot = ext3_acquire_dquot, |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index f3624ead4f6c..b0d744cf8b95 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -219,7 +219,7 @@ void ext4_free_inode(handle_t *handle, struct inode *inode) | |||
219 | */ | 219 | */ |
220 | vfs_dq_init(inode); | 220 | vfs_dq_init(inode); |
221 | ext4_xattr_delete_inode(handle, inode); | 221 | ext4_xattr_delete_inode(handle, inode); |
222 | vfs_dq_free_inode(inode); | 222 | dquot_free_inode(inode); |
223 | vfs_dq_drop(inode); | 223 | vfs_dq_drop(inode); |
224 | 224 | ||
225 | is_directory = S_ISDIR(inode->i_mode); | 225 | is_directory = S_ISDIR(inode->i_mode); |
@@ -1034,10 +1034,10 @@ got: | |||
1034 | ei->i_extra_isize = EXT4_SB(sb)->s_want_extra_isize; | 1034 | ei->i_extra_isize = EXT4_SB(sb)->s_want_extra_isize; |
1035 | 1035 | ||
1036 | ret = inode; | 1036 | ret = inode; |
1037 | if (vfs_dq_alloc_inode(inode)) { | 1037 | vfs_dq_init(inode); |
1038 | err = -EDQUOT; | 1038 | err = dquot_alloc_inode(inode); |
1039 | if (err) | ||
1039 | goto fail_drop; | 1040 | goto fail_drop; |
1040 | } | ||
1041 | 1041 | ||
1042 | err = ext4_init_acl(handle, inode, dir); | 1042 | err = ext4_init_acl(handle, inode, dir); |
1043 | if (err) | 1043 | if (err) |
@@ -1074,7 +1074,7 @@ really_out: | |||
1074 | return ret; | 1074 | return ret; |
1075 | 1075 | ||
1076 | fail_free_drop: | 1076 | fail_free_drop: |
1077 | vfs_dq_free_inode(inode); | 1077 | dquot_free_inode(inode); |
1078 | 1078 | ||
1079 | fail_drop: | 1079 | fail_drop: |
1080 | vfs_dq_drop(inode); | 1080 | vfs_dq_drop(inode); |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index fa8f4deda652..d231da8798e3 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1017,8 +1017,6 @@ static const struct dquot_operations ext4_quota_operations = { | |||
1017 | #ifdef CONFIG_QUOTA | 1017 | #ifdef CONFIG_QUOTA |
1018 | .get_reserved_space = ext4_get_reserved_space, | 1018 | .get_reserved_space = ext4_get_reserved_space, |
1019 | #endif | 1019 | #endif |
1020 | .alloc_inode = dquot_alloc_inode, | ||
1021 | .free_inode = dquot_free_inode, | ||
1022 | .transfer = dquot_transfer, | 1020 | .transfer = dquot_transfer, |
1023 | .write_dquot = ext4_write_dquot, | 1021 | .write_dquot = ext4_write_dquot, |
1024 | .acquire_dquot = ext4_acquire_dquot, | 1022 | .acquire_dquot = ext4_acquire_dquot, |
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c index b2ae190a77ba..2562d18988f7 100644 --- a/fs/jfs/inode.c +++ b/fs/jfs/inode.c | |||
@@ -159,7 +159,7 @@ void jfs_delete_inode(struct inode *inode) | |||
159 | * Free the inode from the quota allocation. | 159 | * Free the inode from the quota allocation. |
160 | */ | 160 | */ |
161 | vfs_dq_init(inode); | 161 | vfs_dq_init(inode); |
162 | vfs_dq_free_inode(inode); | 162 | dquot_free_inode(inode); |
163 | vfs_dq_drop(inode); | 163 | vfs_dq_drop(inode); |
164 | } | 164 | } |
165 | 165 | ||
diff --git a/fs/jfs/jfs_inode.c b/fs/jfs/jfs_inode.c index dc0e02159ac9..7762f33e062b 100644 --- a/fs/jfs/jfs_inode.c +++ b/fs/jfs/jfs_inode.c | |||
@@ -116,10 +116,10 @@ struct inode *ialloc(struct inode *parent, umode_t mode) | |||
116 | /* | 116 | /* |
117 | * Allocate inode to quota. | 117 | * Allocate inode to quota. |
118 | */ | 118 | */ |
119 | if (vfs_dq_alloc_inode(inode)) { | 119 | vfs_dq_init(inode); |
120 | rc = -EDQUOT; | 120 | rc = dquot_alloc_inode(inode); |
121 | if (rc) | ||
121 | goto fail_drop; | 122 | goto fail_drop; |
122 | } | ||
123 | 123 | ||
124 | inode->i_mode = mode; | 124 | inode->i_mode = mode; |
125 | /* inherit flags from parent */ | 125 | /* inherit flags from parent */ |
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 88459bdd1ff3..cb7f67d8441a 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -665,7 +665,7 @@ static int ocfs2_remove_inode(struct inode *inode, | |||
665 | } | 665 | } |
666 | 666 | ||
667 | ocfs2_remove_from_cache(INODE_CACHE(inode), di_bh); | 667 | ocfs2_remove_from_cache(INODE_CACHE(inode), di_bh); |
668 | vfs_dq_free_inode(inode); | 668 | dquot_free_inode(inode); |
669 | 669 | ||
670 | status = ocfs2_free_dinode(handle, inode_alloc_inode, | 670 | status = ocfs2_free_dinode(handle, inode_alloc_inode, |
671 | inode_alloc_bh, di); | 671 | inode_alloc_bh, di); |
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 13adaa1f40cd..99766b6418eb 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -348,13 +348,9 @@ static int ocfs2_mknod(struct inode *dir, | |||
348 | goto leave; | 348 | goto leave; |
349 | } | 349 | } |
350 | 350 | ||
351 | /* We don't use standard VFS wrapper because we don't want vfs_dq_init | 351 | status = dquot_alloc_inode(inode); |
352 | * to be called. */ | 352 | 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; | 353 | goto leave; |
357 | } | ||
358 | did_quota_inode = 1; | 354 | did_quota_inode = 1; |
359 | 355 | ||
360 | mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry, | 356 | mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry, |
@@ -431,7 +427,7 @@ static int ocfs2_mknod(struct inode *dir, | |||
431 | status = 0; | 427 | status = 0; |
432 | leave: | 428 | leave: |
433 | if (status < 0 && did_quota_inode) | 429 | if (status < 0 && did_quota_inode) |
434 | vfs_dq_free_inode(inode); | 430 | dquot_free_inode(inode); |
435 | if (handle) | 431 | if (handle) |
436 | ocfs2_commit_trans(osb, handle); | 432 | ocfs2_commit_trans(osb, handle); |
437 | 433 | ||
@@ -1688,13 +1684,9 @@ static int ocfs2_symlink(struct inode *dir, | |||
1688 | goto bail; | 1684 | goto bail; |
1689 | } | 1685 | } |
1690 | 1686 | ||
1691 | /* We don't use standard VFS wrapper because we don't want vfs_dq_init | 1687 | status = dquot_alloc_inode(inode); |
1692 | * to be called. */ | 1688 | 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; | 1689 | goto bail; |
1697 | } | ||
1698 | did_quota_inode = 1; | 1690 | did_quota_inode = 1; |
1699 | 1691 | ||
1700 | mlog_entry("(0x%p, 0x%p, %d, '%.*s')\n", dir, dentry, | 1692 | mlog_entry("(0x%p, 0x%p, %d, '%.*s')\n", dir, dentry, |
@@ -1790,7 +1782,7 @@ bail: | |||
1790 | dquot_free_space_nodirty(inode, | 1782 | dquot_free_space_nodirty(inode, |
1791 | ocfs2_clusters_to_bytes(osb->sb, 1)); | 1783 | ocfs2_clusters_to_bytes(osb->sb, 1)); |
1792 | if (status < 0 && did_quota_inode) | 1784 | if (status < 0 && did_quota_inode) |
1793 | vfs_dq_free_inode(inode); | 1785 | dquot_free_inode(inode); |
1794 | if (handle) | 1786 | if (handle) |
1795 | ocfs2_commit_trans(osb, handle); | 1787 | ocfs2_commit_trans(osb, handle); |
1796 | 1788 | ||
@@ -2098,13 +2090,9 @@ int ocfs2_create_inode_in_orphan(struct inode *dir, | |||
2098 | goto leave; | 2090 | goto leave; |
2099 | } | 2091 | } |
2100 | 2092 | ||
2101 | /* We don't use standard VFS wrapper because we don't want vfs_dq_init | 2093 | status = dquot_alloc_inode(inode); |
2102 | * to be called. */ | 2094 | if (status) |
2103 | if (sb_any_quota_active(osb->sb) && | ||
2104 | osb->sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) { | ||
2105 | status = -EDQUOT; | ||
2106 | goto leave; | 2095 | goto leave; |
2107 | } | ||
2108 | did_quota_inode = 1; | 2096 | did_quota_inode = 1; |
2109 | 2097 | ||
2110 | inode->i_nlink = 0; | 2098 | inode->i_nlink = 0; |
@@ -2139,7 +2127,7 @@ int ocfs2_create_inode_in_orphan(struct inode *dir, | |||
2139 | insert_inode_hash(inode); | 2127 | insert_inode_hash(inode); |
2140 | leave: | 2128 | leave: |
2141 | if (status < 0 && did_quota_inode) | 2129 | if (status < 0 && did_quota_inode) |
2142 | vfs_dq_free_inode(inode); | 2130 | dquot_free_inode(inode); |
2143 | if (handle) | 2131 | if (handle) |
2144 | ocfs2_commit_trans(osb, handle); | 2132 | ocfs2_commit_trans(osb, handle); |
2145 | 2133 | ||
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c index aa66fb277225..ed96b3eeb13c 100644 --- a/fs/ocfs2/quota_global.c +++ b/fs/ocfs2/quota_global.c | |||
@@ -853,8 +853,6 @@ static void ocfs2_destroy_dquot(struct dquot *dquot) | |||
853 | const struct dquot_operations ocfs2_quota_operations = { | 853 | const struct dquot_operations ocfs2_quota_operations = { |
854 | .initialize = dquot_initialize, | 854 | .initialize = dquot_initialize, |
855 | .drop = dquot_drop, | 855 | .drop = dquot_drop, |
856 | .alloc_inode = dquot_alloc_inode, | ||
857 | .free_inode = dquot_free_inode, | ||
858 | .transfer = dquot_transfer, | 856 | .transfer = dquot_transfer, |
859 | .write_dquot = ocfs2_write_dquot, | 857 | .write_dquot = ocfs2_write_dquot, |
860 | .acquire_dquot = ocfs2_acquire_dquot, | 858 | .acquire_dquot = ocfs2_acquire_dquot, |
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index baf202c012cc..ed131318b849 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -1531,15 +1531,15 @@ EXPORT_SYMBOL(__dquot_alloc_space); | |||
1531 | /* | 1531 | /* |
1532 | * This operation can block, but only after everything is updated | 1532 | * This operation can block, but only after everything is updated |
1533 | */ | 1533 | */ |
1534 | int dquot_alloc_inode(const struct inode *inode, qsize_t number) | 1534 | int dquot_alloc_inode(const struct inode *inode) |
1535 | { | 1535 | { |
1536 | int cnt, ret = NO_QUOTA; | 1536 | int cnt, ret = -EDQUOT; |
1537 | char warntype[MAXQUOTAS]; | 1537 | char warntype[MAXQUOTAS]; |
1538 | 1538 | ||
1539 | /* First test before acquiring mutex - solves deadlocks when we | 1539 | /* First test before acquiring mutex - solves deadlocks when we |
1540 | * re-enter the quota code and are already holding the mutex */ | 1540 | * re-enter the quota code and are already holding the mutex */ |
1541 | if (IS_NOQUOTA(inode)) | 1541 | if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode)) |
1542 | return QUOTA_OK; | 1542 | return 0; |
1543 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) | 1543 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) |
1544 | warntype[cnt] = QUOTA_NL_NOWARN; | 1544 | warntype[cnt] = QUOTA_NL_NOWARN; |
1545 | down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); | 1545 | down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); |
@@ -1547,7 +1547,7 @@ int dquot_alloc_inode(const struct inode *inode, qsize_t number) | |||
1547 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) { | 1547 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) { |
1548 | if (!inode->i_dquot[cnt]) | 1548 | if (!inode->i_dquot[cnt]) |
1549 | continue; | 1549 | continue; |
1550 | if (check_idq(inode->i_dquot[cnt], number, warntype+cnt) | 1550 | if (check_idq(inode->i_dquot[cnt], 1, warntype+cnt) |
1551 | == NO_QUOTA) | 1551 | == NO_QUOTA) |
1552 | goto warn_put_all; | 1552 | goto warn_put_all; |
1553 | } | 1553 | } |
@@ -1555,12 +1555,12 @@ int dquot_alloc_inode(const struct inode *inode, qsize_t number) | |||
1555 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) { | 1555 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) { |
1556 | if (!inode->i_dquot[cnt]) | 1556 | if (!inode->i_dquot[cnt]) |
1557 | continue; | 1557 | continue; |
1558 | dquot_incr_inodes(inode->i_dquot[cnt], number); | 1558 | dquot_incr_inodes(inode->i_dquot[cnt], 1); |
1559 | } | 1559 | } |
1560 | ret = QUOTA_OK; | 1560 | ret = 0; |
1561 | warn_put_all: | 1561 | warn_put_all: |
1562 | spin_unlock(&dq_data_lock); | 1562 | spin_unlock(&dq_data_lock); |
1563 | if (ret == QUOTA_OK) | 1563 | if (ret == 0) |
1564 | mark_all_dquot_dirty(inode->i_dquot); | 1564 | mark_all_dquot_dirty(inode->i_dquot); |
1565 | flush_warnings(inode->i_dquot, warntype); | 1565 | flush_warnings(inode->i_dquot, warntype); |
1566 | up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); | 1566 | up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); |
@@ -1638,29 +1638,28 @@ EXPORT_SYMBOL(__dquot_free_space); | |||
1638 | /* | 1638 | /* |
1639 | * This operation can block, but only after everything is updated | 1639 | * This operation can block, but only after everything is updated |
1640 | */ | 1640 | */ |
1641 | int dquot_free_inode(const struct inode *inode, qsize_t number) | 1641 | void dquot_free_inode(const struct inode *inode) |
1642 | { | 1642 | { |
1643 | unsigned int cnt; | 1643 | unsigned int cnt; |
1644 | char warntype[MAXQUOTAS]; | 1644 | char warntype[MAXQUOTAS]; |
1645 | 1645 | ||
1646 | /* First test before acquiring mutex - solves deadlocks when we | 1646 | /* First test before acquiring mutex - solves deadlocks when we |
1647 | * re-enter the quota code and are already holding the mutex */ | 1647 | * re-enter the quota code and are already holding the mutex */ |
1648 | if (IS_NOQUOTA(inode)) | 1648 | if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode)) |
1649 | return QUOTA_OK; | 1649 | return; |
1650 | 1650 | ||
1651 | down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); | 1651 | down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); |
1652 | spin_lock(&dq_data_lock); | 1652 | spin_lock(&dq_data_lock); |
1653 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) { | 1653 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) { |
1654 | if (!inode->i_dquot[cnt]) | 1654 | if (!inode->i_dquot[cnt]) |
1655 | continue; | 1655 | continue; |
1656 | warntype[cnt] = info_idq_free(inode->i_dquot[cnt], number); | 1656 | warntype[cnt] = info_idq_free(inode->i_dquot[cnt], 1); |
1657 | dquot_decr_inodes(inode->i_dquot[cnt], number); | 1657 | dquot_decr_inodes(inode->i_dquot[cnt], 1); |
1658 | } | 1658 | } |
1659 | spin_unlock(&dq_data_lock); | 1659 | spin_unlock(&dq_data_lock); |
1660 | mark_all_dquot_dirty(inode->i_dquot); | 1660 | mark_all_dquot_dirty(inode->i_dquot); |
1661 | flush_warnings(inode->i_dquot, warntype); | 1661 | flush_warnings(inode->i_dquot, warntype); |
1662 | up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); | 1662 | up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); |
1663 | return QUOTA_OK; | ||
1664 | } | 1663 | } |
1665 | EXPORT_SYMBOL(dquot_free_inode); | 1664 | EXPORT_SYMBOL(dquot_free_inode); |
1666 | 1665 | ||
@@ -1815,8 +1814,6 @@ EXPORT_SYMBOL(dquot_commit_info); | |||
1815 | const struct dquot_operations dquot_operations = { | 1814 | const struct dquot_operations dquot_operations = { |
1816 | .initialize = dquot_initialize, | 1815 | .initialize = dquot_initialize, |
1817 | .drop = dquot_drop, | 1816 | .drop = dquot_drop, |
1818 | .alloc_inode = dquot_alloc_inode, | ||
1819 | .free_inode = dquot_free_inode, | ||
1820 | .transfer = dquot_transfer, | 1817 | .transfer = dquot_transfer, |
1821 | .write_dquot = dquot_commit, | 1818 | .write_dquot = dquot_commit, |
1822 | .acquire_dquot = dquot_acquire, | 1819 | .acquire_dquot = dquot_acquire, |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 2df0f5c7c60b..f56a3d2e6497 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -54,7 +54,7 @@ void reiserfs_delete_inode(struct inode *inode) | |||
54 | * after delete_object so that quota updates go into the same transaction as | 54 | * after delete_object so that quota updates go into the same transaction as |
55 | * stat data deletion */ | 55 | * stat data deletion */ |
56 | if (!err) | 56 | if (!err) |
57 | vfs_dq_free_inode(inode); | 57 | dquot_free_inode(inode); |
58 | 58 | ||
59 | if (journal_end(&th, inode->i_sb, jbegin_count)) | 59 | if (journal_end(&th, inode->i_sb, jbegin_count)) |
60 | goto out; | 60 | goto out; |
@@ -1765,10 +1765,10 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th, | |||
1765 | 1765 | ||
1766 | BUG_ON(!th->t_trans_id); | 1766 | BUG_ON(!th->t_trans_id); |
1767 | 1767 | ||
1768 | if (vfs_dq_alloc_inode(inode)) { | 1768 | vfs_dq_init(inode); |
1769 | err = -EDQUOT; | 1769 | err = dquot_alloc_inode(inode); |
1770 | if (err) | ||
1770 | goto out_end_trans; | 1771 | goto out_end_trans; |
1771 | } | ||
1772 | if (!dir->i_nlink) { | 1772 | if (!dir->i_nlink) { |
1773 | err = -EPERM; | 1773 | err = -EPERM; |
1774 | goto out_bad_inode; | 1774 | goto out_bad_inode; |
@@ -1959,7 +1959,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th, | |||
1959 | INODE_PKEY(inode)->k_objectid = 0; | 1959 | INODE_PKEY(inode)->k_objectid = 0; |
1960 | 1960 | ||
1961 | /* Quota change must be inside a transaction for journaling */ | 1961 | /* Quota change must be inside a transaction for journaling */ |
1962 | vfs_dq_free_inode(inode); | 1962 | dquot_free_inode(inode); |
1963 | 1963 | ||
1964 | out_end_trans: | 1964 | out_end_trans: |
1965 | journal_end(th, th->t_super, th->t_blocks_allocated); | 1965 | journal_end(th, th->t_super, th->t_blocks_allocated); |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index ea4a77e9d7f5..e942ceecf2b8 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -618,8 +618,6 @@ static int reiserfs_quota_on(struct super_block *, int, int, char *, int); | |||
618 | static const struct dquot_operations reiserfs_quota_operations = { | 618 | static const struct dquot_operations reiserfs_quota_operations = { |
619 | .initialize = dquot_initialize, | 619 | .initialize = dquot_initialize, |
620 | .drop = dquot_drop, | 620 | .drop = dquot_drop, |
621 | .alloc_inode = dquot_alloc_inode, | ||
622 | .free_inode = dquot_free_inode, | ||
623 | .transfer = dquot_transfer, | 621 | .transfer = dquot_transfer, |
624 | .write_dquot = reiserfs_write_dquot, | 622 | .write_dquot = reiserfs_write_dquot, |
625 | .acquire_dquot = reiserfs_acquire_dquot, | 623 | .acquire_dquot = reiserfs_acquire_dquot, |
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c index c10fa39f97e2..e1856b89c9c8 100644 --- a/fs/udf/ialloc.c +++ b/fs/udf/ialloc.c | |||
@@ -36,7 +36,7 @@ void udf_free_inode(struct inode *inode) | |||
36 | * Note: we must free any quota before locking the superblock, | 36 | * Note: we must free any quota before locking the superblock, |
37 | * as writing the quota to disk may need the lock as well. | 37 | * as writing the quota to disk may need the lock as well. |
38 | */ | 38 | */ |
39 | vfs_dq_free_inode(inode); | 39 | dquot_free_inode(inode); |
40 | vfs_dq_drop(inode); | 40 | vfs_dq_drop(inode); |
41 | 41 | ||
42 | clear_inode(inode); | 42 | clear_inode(inode); |
@@ -61,7 +61,7 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) | |||
61 | struct super_block *sb = dir->i_sb; | 61 | struct super_block *sb = dir->i_sb; |
62 | struct udf_sb_info *sbi = UDF_SB(sb); | 62 | struct udf_sb_info *sbi = UDF_SB(sb); |
63 | struct inode *inode; | 63 | struct inode *inode; |
64 | int block; | 64 | int block, ret; |
65 | uint32_t start = UDF_I(dir)->i_location.logicalBlockNum; | 65 | uint32_t start = UDF_I(dir)->i_location.logicalBlockNum; |
66 | struct udf_inode_info *iinfo; | 66 | struct udf_inode_info *iinfo; |
67 | struct udf_inode_info *dinfo = UDF_I(dir); | 67 | struct udf_inode_info *dinfo = UDF_I(dir); |
@@ -153,12 +153,14 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) | |||
153 | insert_inode_hash(inode); | 153 | insert_inode_hash(inode); |
154 | mark_inode_dirty(inode); | 154 | mark_inode_dirty(inode); |
155 | 155 | ||
156 | if (vfs_dq_alloc_inode(inode)) { | 156 | vfs_dq_init(inode); |
157 | ret = dquot_alloc_inode(inode); | ||
158 | if (ret) { | ||
157 | vfs_dq_drop(inode); | 159 | vfs_dq_drop(inode); |
158 | inode->i_flags |= S_NOQUOTA; | 160 | inode->i_flags |= S_NOQUOTA; |
159 | inode->i_nlink = 0; | 161 | inode->i_nlink = 0; |
160 | iput(inode); | 162 | iput(inode); |
161 | *err = -EDQUOT; | 163 | *err = ret; |
162 | return NULL; | 164 | return NULL; |
163 | } | 165 | } |
164 | 166 | ||
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c index 3527c00fef0d..02f77882c573 100644 --- a/fs/ufs/ialloc.c +++ b/fs/ufs/ialloc.c | |||
@@ -95,7 +95,7 @@ void ufs_free_inode (struct inode * inode) | |||
95 | 95 | ||
96 | is_directory = S_ISDIR(inode->i_mode); | 96 | is_directory = S_ISDIR(inode->i_mode); |
97 | 97 | ||
98 | vfs_dq_free_inode(inode); | 98 | dquot_free_inode(inode); |
99 | vfs_dq_drop(inode); | 99 | vfs_dq_drop(inode); |
100 | 100 | ||
101 | clear_inode (inode); | 101 | clear_inode (inode); |
@@ -355,9 +355,10 @@ cg_found: | |||
355 | 355 | ||
356 | unlock_super (sb); | 356 | unlock_super (sb); |
357 | 357 | ||
358 | if (vfs_dq_alloc_inode(inode)) { | 358 | vfs_dq_init(inode); |
359 | err = dquot_alloc_inode(inode); | ||
360 | if (err) { | ||
359 | vfs_dq_drop(inode); | 361 | vfs_dq_drop(inode); |
360 | err = -EDQUOT; | ||
361 | goto fail_without_unlock; | 362 | goto fail_without_unlock; |
362 | } | 363 | } |
363 | 364 | ||
diff --git a/include/linux/quota.h b/include/linux/quota.h index 1b14ad287fe3..e3b07895d327 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
@@ -297,8 +297,6 @@ struct quota_format_ops { | |||
297 | struct dquot_operations { | 297 | struct dquot_operations { |
298 | int (*initialize) (struct inode *, int); | 298 | int (*initialize) (struct inode *, int); |
299 | int (*drop) (struct inode *); | 299 | int (*drop) (struct inode *); |
300 | int (*alloc_inode) (const struct inode *, qsize_t); | ||
301 | int (*free_inode) (const struct inode *, qsize_t); | ||
302 | int (*transfer) (struct inode *, qid_t *, unsigned long); | 300 | int (*transfer) (struct inode *, qid_t *, unsigned long); |
303 | int (*write_dquot) (struct dquot *); /* Ordinary dquot write */ | 301 | int (*write_dquot) (struct dquot *); /* Ordinary dquot write */ |
304 | struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */ | 302 | struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */ |
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index 47e85682e118..9ce7f051a4ba 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
@@ -37,10 +37,10 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, | |||
37 | int warn, int reserve); | 37 | int warn, int reserve); |
38 | void __dquot_free_space(struct inode *inode, qsize_t number, int reserve); | 38 | void __dquot_free_space(struct inode *inode, qsize_t number, int reserve); |
39 | 39 | ||
40 | int dquot_alloc_inode(const struct inode *inode, qsize_t number); | 40 | int dquot_alloc_inode(const struct inode *inode); |
41 | 41 | ||
42 | int dquot_claim_space_nodirty(struct inode *inode, qsize_t number); | 42 | int dquot_claim_space_nodirty(struct inode *inode, qsize_t number); |
43 | int dquot_free_inode(const struct inode *inode, qsize_t number); | 43 | void dquot_free_inode(const struct inode *inode); |
44 | 44 | ||
45 | int dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask); | 45 | int dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask); |
46 | int dquot_commit(struct dquot *dquot); | 46 | int dquot_commit(struct dquot *dquot); |
@@ -148,22 +148,6 @@ static inline void vfs_dq_init(struct inode *inode) | |||
148 | inode->i_sb->dq_op->initialize(inode, -1); | 148 | inode->i_sb->dq_op->initialize(inode, -1); |
149 | } | 149 | } |
150 | 150 | ||
151 | static inline int vfs_dq_alloc_inode(struct inode *inode) | ||
152 | { | ||
153 | if (sb_any_quota_active(inode->i_sb)) { | ||
154 | vfs_dq_init(inode); | ||
155 | if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) | ||
156 | return 1; | ||
157 | } | ||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | static inline void vfs_dq_free_inode(struct inode *inode) | ||
162 | { | ||
163 | if (sb_any_quota_active(inode->i_sb)) | ||
164 | inode->i_sb->dq_op->free_inode(inode, 1); | ||
165 | } | ||
166 | |||
167 | /* Cannot be called inside a transaction */ | 151 | /* Cannot be called inside a transaction */ |
168 | static inline int vfs_dq_off(struct super_block *sb, int remount) | 152 | static inline int vfs_dq_off(struct super_block *sb, int remount) |
169 | { | 153 | { |
@@ -231,12 +215,12 @@ static inline void vfs_dq_drop(struct inode *inode) | |||
231 | { | 215 | { |
232 | } | 216 | } |
233 | 217 | ||
234 | static inline int vfs_dq_alloc_inode(struct inode *inode) | 218 | static inline int dquot_alloc_inode(const struct inode *inode) |
235 | { | 219 | { |
236 | return 0; | 220 | return 0; |
237 | } | 221 | } |
238 | 222 | ||
239 | static inline void vfs_dq_free_inode(struct inode *inode) | 223 | static inline void dquot_free_inode(const struct inode *inode) |
240 | { | 224 | { |
241 | } | 225 | } |
242 | 226 | ||