diff options
-rw-r--r-- | fs/quota/dquot.c | 23 | ||||
-rw-r--r-- | include/linux/quotaops.h | 10 |
2 files changed, 16 insertions, 17 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 2857fd67ff33..2eebf72d07c8 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -1315,6 +1315,15 @@ static int info_bdq_free(struct dquot *dquot, qsize_t space) | |||
1315 | return QUOTA_NL_NOWARN; | 1315 | return QUOTA_NL_NOWARN; |
1316 | } | 1316 | } |
1317 | 1317 | ||
1318 | static int dquot_active(const struct inode *inode) | ||
1319 | { | ||
1320 | struct super_block *sb = inode->i_sb; | ||
1321 | |||
1322 | if (IS_NOQUOTA(inode)) | ||
1323 | return 0; | ||
1324 | return sb_any_quota_loaded(sb) & ~sb_any_quota_suspended(sb); | ||
1325 | } | ||
1326 | |||
1318 | /* | 1327 | /* |
1319 | * Initialize quota pointers in inode | 1328 | * Initialize quota pointers in inode |
1320 | * | 1329 | * |
@@ -1334,7 +1343,7 @@ static void __dquot_initialize(struct inode *inode, int type) | |||
1334 | 1343 | ||
1335 | /* First test before acquiring mutex - solves deadlocks when we | 1344 | /* First test before acquiring mutex - solves deadlocks when we |
1336 | * re-enter the quota code and are already holding the mutex */ | 1345 | * re-enter the quota code and are already holding the mutex */ |
1337 | if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode)) | 1346 | if (!dquot_active(inode)) |
1338 | return; | 1347 | return; |
1339 | 1348 | ||
1340 | /* First get references to structures we might need. */ | 1349 | /* First get references to structures we might need. */ |
@@ -1518,7 +1527,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags) | |||
1518 | * First test before acquiring mutex - solves deadlocks when we | 1527 | * First test before acquiring mutex - solves deadlocks when we |
1519 | * re-enter the quota code and are already holding the mutex | 1528 | * re-enter the quota code and are already holding the mutex |
1520 | */ | 1529 | */ |
1521 | if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode)) { | 1530 | if (!dquot_active(inode)) { |
1522 | inode_incr_space(inode, number, reserve); | 1531 | inode_incr_space(inode, number, reserve); |
1523 | goto out; | 1532 | goto out; |
1524 | } | 1533 | } |
@@ -1570,7 +1579,7 @@ int dquot_alloc_inode(const struct inode *inode) | |||
1570 | 1579 | ||
1571 | /* First test before acquiring mutex - solves deadlocks when we | 1580 | /* First test before acquiring mutex - solves deadlocks when we |
1572 | * re-enter the quota code and are already holding the mutex */ | 1581 | * re-enter the quota code and are already holding the mutex */ |
1573 | if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode)) | 1582 | if (!dquot_active(inode)) |
1574 | return 0; | 1583 | return 0; |
1575 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) | 1584 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) |
1576 | warntype[cnt] = QUOTA_NL_NOWARN; | 1585 | warntype[cnt] = QUOTA_NL_NOWARN; |
@@ -1607,7 +1616,7 @@ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number) | |||
1607 | { | 1616 | { |
1608 | int cnt; | 1617 | int cnt; |
1609 | 1618 | ||
1610 | if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode)) { | 1619 | if (!dquot_active(inode)) { |
1611 | inode_claim_rsv_space(inode, number); | 1620 | inode_claim_rsv_space(inode, number); |
1612 | return 0; | 1621 | return 0; |
1613 | } | 1622 | } |
@@ -1640,7 +1649,7 @@ void __dquot_free_space(struct inode *inode, qsize_t number, int flags) | |||
1640 | 1649 | ||
1641 | /* First test before acquiring mutex - solves deadlocks when we | 1650 | /* First test before acquiring mutex - solves deadlocks when we |
1642 | * re-enter the quota code and are already holding the mutex */ | 1651 | * re-enter the quota code and are already holding the mutex */ |
1643 | if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode)) { | 1652 | if (!dquot_active(inode)) { |
1644 | inode_decr_space(inode, number, reserve); | 1653 | inode_decr_space(inode, number, reserve); |
1645 | return; | 1654 | return; |
1646 | } | 1655 | } |
@@ -1678,7 +1687,7 @@ void dquot_free_inode(const struct inode *inode) | |||
1678 | 1687 | ||
1679 | /* First test before acquiring mutex - solves deadlocks when we | 1688 | /* First test before acquiring mutex - solves deadlocks when we |
1680 | * re-enter the quota code and are already holding the mutex */ | 1689 | * re-enter the quota code and are already holding the mutex */ |
1681 | if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode)) | 1690 | if (!dquot_active(inode)) |
1682 | return; | 1691 | return; |
1683 | 1692 | ||
1684 | down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); | 1693 | down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); |
@@ -1801,7 +1810,7 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr) | |||
1801 | struct super_block *sb = inode->i_sb; | 1810 | struct super_block *sb = inode->i_sb; |
1802 | int ret; | 1811 | int ret; |
1803 | 1812 | ||
1804 | if (!sb_any_quota_active(sb) || IS_NOQUOTA(inode)) | 1813 | if (!dquot_active(inode)) |
1805 | return 0; | 1814 | return 0; |
1806 | 1815 | ||
1807 | if (iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) | 1816 | if (iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) |
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index aa36793b48bd..126193c1a5ce 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
@@ -145,11 +145,6 @@ static inline bool sb_has_quota_active(struct super_block *sb, int type) | |||
145 | !sb_has_quota_suspended(sb, type); | 145 | !sb_has_quota_suspended(sb, type); |
146 | } | 146 | } |
147 | 147 | ||
148 | static inline unsigned sb_any_quota_active(struct super_block *sb) | ||
149 | { | ||
150 | return sb_any_quota_loaded(sb) & ~sb_any_quota_suspended(sb); | ||
151 | } | ||
152 | |||
153 | /* | 148 | /* |
154 | * Operations supported for diskquotas. | 149 | * Operations supported for diskquotas. |
155 | */ | 150 | */ |
@@ -194,11 +189,6 @@ static inline int sb_has_quota_active(struct super_block *sb, int type) | |||
194 | return 0; | 189 | return 0; |
195 | } | 190 | } |
196 | 191 | ||
197 | static inline int sb_any_quota_active(struct super_block *sb) | ||
198 | { | ||
199 | return 0; | ||
200 | } | ||
201 | |||
202 | static inline void dquot_initialize(struct inode *inode) | 192 | static inline void dquot_initialize(struct inode *inode) |
203 | { | 193 | { |
204 | } | 194 | } |