aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dquot.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/dquot.c')
-rw-r--r--fs/dquot.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/fs/dquot.c b/fs/dquot.c
index ad88cf6fcbaf..0bcaf970bbb4 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -1153,6 +1153,28 @@ int dquot_drop(struct inode *inode)
1153 return 0; 1153 return 0;
1154} 1154}
1155 1155
1156/* Wrapper to remove references to quota structures from inode */
1157void vfs_dq_drop(struct inode *inode)
1158{
1159 /* Here we can get arbitrary inode from clear_inode() so we have
1160 * to be careful. OTOH we don't need locking as quota operations
1161 * are allowed to change only at mount time */
1162 if (!IS_NOQUOTA(inode) && inode->i_sb && inode->i_sb->dq_op
1163 && inode->i_sb->dq_op->drop) {
1164 int cnt;
1165 /* Test before calling to rule out calls from proc and such
1166 * where we are not allowed to block. Note that this is
1167 * actually reliable test even without the lock - the caller
1168 * must assure that nobody can come after the DQUOT_DROP and
1169 * add quota pointers back anyway */
1170 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
1171 if (inode->i_dquot[cnt] != NODQUOT)
1172 break;
1173 if (cnt < MAXQUOTAS)
1174 inode->i_sb->dq_op->drop(inode);
1175 }
1176}
1177
1156/* 1178/*
1157 * Following four functions update i_blocks+i_bytes fields and 1179 * Following four functions update i_blocks+i_bytes fields and
1158 * quota information (together with appropriate checks) 1180 * quota information (together with appropriate checks)
@@ -1426,6 +1448,18 @@ warn_put_all:
1426 return ret; 1448 return ret;
1427} 1449}
1428 1450
1451/* Wrapper for transferring ownership of an inode */
1452int vfs_dq_transfer(struct inode *inode, struct iattr *iattr)
1453{
1454 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) {
1455 vfs_dq_init(inode);
1456 if (inode->i_sb->dq_op->transfer(inode, iattr) == NO_QUOTA)
1457 return 1;
1458 }
1459 return 0;
1460}
1461
1462
1429/* 1463/*
1430 * Write info of quota file to disk 1464 * Write info of quota file to disk
1431 */ 1465 */
@@ -1766,6 +1800,22 @@ out:
1766 return error; 1800 return error;
1767} 1801}
1768 1802
1803/* Wrapper to turn on quotas when remounting rw */
1804int vfs_dq_quota_on_remount(struct super_block *sb)
1805{
1806 int cnt;
1807 int ret = 0, err;
1808
1809 if (!sb->s_qcop || !sb->s_qcop->quota_on)
1810 return -ENOSYS;
1811 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
1812 err = sb->s_qcop->quota_on(sb, cnt, 0, NULL, 1);
1813 if (err < 0 && !ret)
1814 ret = err;
1815 }
1816 return ret;
1817}
1818
1769/* Generic routine for getting common part of quota structure */ 1819/* Generic routine for getting common part of quota structure */
1770static void do_get_dqblk(struct dquot *dquot, struct if_dqblk *di) 1820static void do_get_dqblk(struct dquot *dquot, struct if_dqblk *di)
1771{ 1821{
@@ -2101,8 +2151,11 @@ EXPORT_SYMBOL(dquot_release);
2101EXPORT_SYMBOL(dquot_mark_dquot_dirty); 2151EXPORT_SYMBOL(dquot_mark_dquot_dirty);
2102EXPORT_SYMBOL(dquot_initialize); 2152EXPORT_SYMBOL(dquot_initialize);
2103EXPORT_SYMBOL(dquot_drop); 2153EXPORT_SYMBOL(dquot_drop);
2154EXPORT_SYMBOL(vfs_dq_drop);
2104EXPORT_SYMBOL(dquot_alloc_space); 2155EXPORT_SYMBOL(dquot_alloc_space);
2105EXPORT_SYMBOL(dquot_alloc_inode); 2156EXPORT_SYMBOL(dquot_alloc_inode);
2106EXPORT_SYMBOL(dquot_free_space); 2157EXPORT_SYMBOL(dquot_free_space);
2107EXPORT_SYMBOL(dquot_free_inode); 2158EXPORT_SYMBOL(dquot_free_inode);
2108EXPORT_SYMBOL(dquot_transfer); 2159EXPORT_SYMBOL(dquot_transfer);
2160EXPORT_SYMBOL(vfs_dq_transfer);
2161EXPORT_SYMBOL(vfs_dq_quota_on_remount);