@@ -1378,15 +1378,23 @@ static int __ocfs2_recovery_thread(void *arg)
1378
1378
int rm_quota_used = 0 , i ;
1379
1379
struct ocfs2_quota_recovery * qrec ;
1380
1380
1381
+ /* Whether the quota supported. */
1382
+ int quota_enabled = OCFS2_HAS_RO_COMPAT_FEATURE (osb -> sb ,
1383
+ OCFS2_FEATURE_RO_COMPAT_USRQUOTA )
1384
+ || OCFS2_HAS_RO_COMPAT_FEATURE (osb -> sb ,
1385
+ OCFS2_FEATURE_RO_COMPAT_GRPQUOTA );
1386
+
1381
1387
status = ocfs2_wait_on_mount (osb );
1382
1388
if (status < 0 ) {
1383
1389
goto bail ;
1384
1390
}
1385
1391
1386
- rm_quota = kcalloc (osb -> max_slots , sizeof (int ), GFP_NOFS );
1387
- if (!rm_quota ) {
1388
- status = - ENOMEM ;
1389
- goto bail ;
1392
+ if (quota_enabled ) {
1393
+ rm_quota = kcalloc (osb -> max_slots , sizeof (int ), GFP_NOFS );
1394
+ if (!rm_quota ) {
1395
+ status = - ENOMEM ;
1396
+ goto bail ;
1397
+ }
1390
1398
}
1391
1399
restart :
1392
1400
status = ocfs2_super_lock (osb , 1 );
@@ -1422,9 +1430,14 @@ static int __ocfs2_recovery_thread(void *arg)
1422
1430
* then quota usage would be out of sync until some node takes
1423
1431
* the slot. So we remember which nodes need quota recovery
1424
1432
* and when everything else is done, we recover quotas. */
1425
- for (i = 0 ; i < rm_quota_used && rm_quota [i ] != slot_num ; i ++ );
1426
- if (i == rm_quota_used )
1427
- rm_quota [rm_quota_used ++ ] = slot_num ;
1433
+ if (quota_enabled ) {
1434
+ for (i = 0 ; i < rm_quota_used
1435
+ && rm_quota [i ] != slot_num ; i ++ )
1436
+ ;
1437
+
1438
+ if (i == rm_quota_used )
1439
+ rm_quota [rm_quota_used ++ ] = slot_num ;
1440
+ }
1428
1441
1429
1442
status = ocfs2_recover_node (osb , node_num , slot_num );
1430
1443
skip_recovery :
@@ -1452,16 +1465,19 @@ static int __ocfs2_recovery_thread(void *arg)
1452
1465
/* Now it is right time to recover quotas... We have to do this under
1453
1466
* superblock lock so that no one can start using the slot (and crash)
1454
1467
* before we recover it */
1455
- for (i = 0 ; i < rm_quota_used ; i ++ ) {
1456
- qrec = ocfs2_begin_quota_recovery (osb , rm_quota [i ]);
1457
- if (IS_ERR (qrec )) {
1458
- status = PTR_ERR (qrec );
1459
- mlog_errno (status );
1460
- continue ;
1468
+ if (quota_enabled ) {
1469
+ for (i = 0 ; i < rm_quota_used ; i ++ ) {
1470
+ qrec = ocfs2_begin_quota_recovery (osb , rm_quota [i ]);
1471
+ if (IS_ERR (qrec )) {
1472
+ status = PTR_ERR (qrec );
1473
+ mlog_errno (status );
1474
+ continue ;
1475
+ }
1476
+ ocfs2_queue_recovery_completion (osb -> journal ,
1477
+ rm_quota [i ],
1478
+ NULL , NULL , qrec ,
1479
+ ORPHAN_NEED_TRUNCATE );
1461
1480
}
1462
- ocfs2_queue_recovery_completion (osb -> journal , rm_quota [i ],
1463
- NULL , NULL , qrec ,
1464
- ORPHAN_NEED_TRUNCATE );
1465
1481
}
1466
1482
1467
1483
ocfs2_super_unlock (osb , 1 );
@@ -1483,7 +1499,8 @@ static int __ocfs2_recovery_thread(void *arg)
1483
1499
1484
1500
mutex_unlock (& osb -> recovery_lock );
1485
1501
1486
- kfree (rm_quota );
1502
+ if (quota_enabled )
1503
+ kfree (rm_quota );
1487
1504
1488
1505
/* no one is callint kthread_stop() for us so the kthread() api
1489
1506
* requires that we call do_exit(). And it isn't exported, but
0 commit comments