aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJie Liu <jeff.liu@oracle.com>2014-07-24 06:49:57 -0400
committerDave Chinner <david@fromorbit.com>2014-07-24 06:49:57 -0400
commiteb866bbf095ec68552c0583199208858618498e3 (patch)
tree773eeb8f84535937e329cd31be771b0d0a2cc231
parent5c18717ea25fcb87c746deac1bf2ef2ff46e154a (diff)
xfs: mark xfs_qm_quotacheck as static
xfs_qm_quotacheck() is not used outside of xfs_qm.c. Mark it static and move it around in the file to avoid a forward declaration. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jie Liu <jeff.liu@oracle.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
-rw-r--r--fs/xfs/xfs_qm.c189
-rw-r--r--fs/xfs/xfs_qm.h1
2 files changed, 94 insertions, 96 deletions
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index ba284f6469db..7e1a80b45f87 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -221,100 +221,6 @@ xfs_qm_unmount(
221 } 221 }
222} 222}
223 223
224
225/*
226 * This is called from xfs_mountfs to start quotas and initialize all
227 * necessary data structures like quotainfo. This is also responsible for
228 * running a quotacheck as necessary. We are guaranteed that the superblock
229 * is consistently read in at this point.
230 *
231 * If we fail here, the mount will continue with quota turned off. We don't
232 * need to inidicate success or failure at all.
233 */
234void
235xfs_qm_mount_quotas(
236 xfs_mount_t *mp)
237{
238 int error = 0;
239 uint sbf;
240
241 /*
242 * If quotas on realtime volumes is not supported, we disable
243 * quotas immediately.
244 */
245 if (mp->m_sb.sb_rextents) {
246 xfs_notice(mp, "Cannot turn on quotas for realtime filesystem");
247 mp->m_qflags = 0;
248 goto write_changes;
249 }
250
251 ASSERT(XFS_IS_QUOTA_RUNNING(mp));
252
253 /*
254 * Allocate the quotainfo structure inside the mount struct, and
255 * create quotainode(s), and change/rev superblock if necessary.
256 */
257 error = xfs_qm_init_quotainfo(mp);
258 if (error) {
259 /*
260 * We must turn off quotas.
261 */
262 ASSERT(mp->m_quotainfo == NULL);
263 mp->m_qflags = 0;
264 goto write_changes;
265 }
266 /*
267 * If any of the quotas are not consistent, do a quotacheck.
268 */
269 if (XFS_QM_NEED_QUOTACHECK(mp)) {
270 error = xfs_qm_quotacheck(mp);
271 if (error) {
272 /* Quotacheck failed and disabled quotas. */
273 return;
274 }
275 }
276 /*
277 * If one type of quotas is off, then it will lose its
278 * quotachecked status, since we won't be doing accounting for
279 * that type anymore.
280 */
281 if (!XFS_IS_UQUOTA_ON(mp))
282 mp->m_qflags &= ~XFS_UQUOTA_CHKD;
283 if (!XFS_IS_GQUOTA_ON(mp))
284 mp->m_qflags &= ~XFS_GQUOTA_CHKD;
285 if (!XFS_IS_PQUOTA_ON(mp))
286 mp->m_qflags &= ~XFS_PQUOTA_CHKD;
287
288 write_changes:
289 /*
290 * We actually don't have to acquire the m_sb_lock at all.
291 * This can only be called from mount, and that's single threaded. XXX
292 */
293 spin_lock(&mp->m_sb_lock);
294 sbf = mp->m_sb.sb_qflags;
295 mp->m_sb.sb_qflags = mp->m_qflags & XFS_MOUNT_QUOTA_ALL;
296 spin_unlock(&mp->m_sb_lock);
297
298 if (sbf != (mp->m_qflags & XFS_MOUNT_QUOTA_ALL)) {
299 if (xfs_qm_write_sb_changes(mp, XFS_SB_QFLAGS)) {
300 /*
301 * We could only have been turning quotas off.
302 * We aren't in very good shape actually because
303 * the incore structures are convinced that quotas are
304 * off, but the on disk superblock doesn't know that !
305 */
306 ASSERT(!(XFS_IS_QUOTA_RUNNING(mp)));
307 xfs_alert(mp, "%s: Superblock update failed!",
308 __func__);
309 }
310 }
311
312 if (error) {
313 xfs_warn(mp, "Failed to initialize disk quotas.");
314 return;
315 }
316}
317
318/* 224/*
319 * Called from the vfsops layer. 225 * Called from the vfsops layer.
320 */ 226 */
@@ -1330,7 +1236,7 @@ out_unlock:
1330 * Walk thru all the filesystem inodes and construct a consistent view 1236 * Walk thru all the filesystem inodes and construct a consistent view
1331 * of the disk quota world. If the quotacheck fails, disable quotas. 1237 * of the disk quota world. If the quotacheck fails, disable quotas.
1332 */ 1238 */
1333int 1239STATIC int
1334xfs_qm_quotacheck( 1240xfs_qm_quotacheck(
1335 xfs_mount_t *mp) 1241 xfs_mount_t *mp)
1336{ 1242{
@@ -1467,6 +1373,99 @@ xfs_qm_quotacheck(
1467} 1373}
1468 1374
1469/* 1375/*
1376 * This is called from xfs_mountfs to start quotas and initialize all
1377 * necessary data structures like quotainfo. This is also responsible for
1378 * running a quotacheck as necessary. We are guaranteed that the superblock
1379 * is consistently read in at this point.
1380 *
1381 * If we fail here, the mount will continue with quota turned off. We don't
1382 * need to inidicate success or failure at all.
1383 */
1384void
1385xfs_qm_mount_quotas(
1386 struct xfs_mount *mp)
1387{
1388 int error = 0;
1389 uint sbf;
1390
1391 /*
1392 * If quotas on realtime volumes is not supported, we disable
1393 * quotas immediately.
1394 */
1395 if (mp->m_sb.sb_rextents) {
1396 xfs_notice(mp, "Cannot turn on quotas for realtime filesystem");
1397 mp->m_qflags = 0;
1398 goto write_changes;
1399 }
1400
1401 ASSERT(XFS_IS_QUOTA_RUNNING(mp));
1402
1403 /*
1404 * Allocate the quotainfo structure inside the mount struct, and
1405 * create quotainode(s), and change/rev superblock if necessary.
1406 */
1407 error = xfs_qm_init_quotainfo(mp);
1408 if (error) {
1409 /*
1410 * We must turn off quotas.
1411 */
1412 ASSERT(mp->m_quotainfo == NULL);
1413 mp->m_qflags = 0;
1414 goto write_changes;
1415 }
1416 /*
1417 * If any of the quotas are not consistent, do a quotacheck.
1418 */
1419 if (XFS_QM_NEED_QUOTACHECK(mp)) {
1420 error = xfs_qm_quotacheck(mp);
1421 if (error) {
1422 /* Quotacheck failed and disabled quotas. */
1423 return;
1424 }
1425 }
1426 /*
1427 * If one type of quotas is off, then it will lose its
1428 * quotachecked status, since we won't be doing accounting for
1429 * that type anymore.
1430 */
1431 if (!XFS_IS_UQUOTA_ON(mp))
1432 mp->m_qflags &= ~XFS_UQUOTA_CHKD;
1433 if (!XFS_IS_GQUOTA_ON(mp))
1434 mp->m_qflags &= ~XFS_GQUOTA_CHKD;
1435 if (!XFS_IS_PQUOTA_ON(mp))
1436 mp->m_qflags &= ~XFS_PQUOTA_CHKD;
1437
1438 write_changes:
1439 /*
1440 * We actually don't have to acquire the m_sb_lock at all.
1441 * This can only be called from mount, and that's single threaded. XXX
1442 */
1443 spin_lock(&mp->m_sb_lock);
1444 sbf = mp->m_sb.sb_qflags;
1445 mp->m_sb.sb_qflags = mp->m_qflags & XFS_MOUNT_QUOTA_ALL;
1446 spin_unlock(&mp->m_sb_lock);
1447
1448 if (sbf != (mp->m_qflags & XFS_MOUNT_QUOTA_ALL)) {
1449 if (xfs_qm_write_sb_changes(mp, XFS_SB_QFLAGS)) {
1450 /*
1451 * We could only have been turning quotas off.
1452 * We aren't in very good shape actually because
1453 * the incore structures are convinced that quotas are
1454 * off, but the on disk superblock doesn't know that !
1455 */
1456 ASSERT(!(XFS_IS_QUOTA_RUNNING(mp)));
1457 xfs_alert(mp, "%s: Superblock update failed!",
1458 __func__);
1459 }
1460 }
1461
1462 if (error) {
1463 xfs_warn(mp, "Failed to initialize disk quotas.");
1464 return;
1465 }
1466}
1467
1468/*
1470 * This is called after the superblock has been read in and we're ready to 1469 * This is called after the superblock has been read in and we're ready to
1471 * iget the quota inodes. 1470 * iget the quota inodes.
1472 */ 1471 */
diff --git a/fs/xfs/xfs_qm.h b/fs/xfs/xfs_qm.h
index 797fd4636273..3a07a937e232 100644
--- a/fs/xfs/xfs_qm.h
+++ b/fs/xfs/xfs_qm.h
@@ -157,7 +157,6 @@ struct xfs_dquot_acct {
157#define XFS_QM_RTBWARNLIMIT 5 157#define XFS_QM_RTBWARNLIMIT 5
158 158
159extern void xfs_qm_destroy_quotainfo(struct xfs_mount *); 159extern void xfs_qm_destroy_quotainfo(struct xfs_mount *);
160extern int xfs_qm_quotacheck(struct xfs_mount *);
161extern int xfs_qm_write_sb_changes(struct xfs_mount *, __int64_t); 160extern int xfs_qm_write_sb_changes(struct xfs_mount *, __int64_t);
162 161
163/* dquot stuff */ 162/* dquot stuff */