@@ -86,6 +86,7 @@ bool no_holes = false;
8686bool is_free_space_tree = false;
8787bool init_extent_tree = false;
8888bool check_data_csum = false;
89+ static bool check_qgroup_accounting = true;
8990static bool found_free_ino_cache = false;
9091static bool found_unknown_key = false;
9192struct cache_tree * roots_info_cache = NULL ;
@@ -217,7 +218,9 @@ static void print_status_check_line(void *p)
217218 "[5/7] checking csums against data " :
218219 "[5/7] checking csums (without verifying data) " ,
219220 "[6/7] checking root refs " ,
220- "[7/7] checking quota groups " ,
221+ check_qgroup_accounting ?
222+ "[7/7] checking quota groups " :
223+ "[7/7] checking qgroups (no accounting verify) " ,
221224 };
222225 time_t elapsed ;
223226 int hours ;
@@ -10597,6 +10600,7 @@ static const char * const cmd_check_usage[] = {
1059710600 "" ,
1059810601 "Check and reporting options:" ,
1059910602 OPTLINE ("--check-data-csum" , "verify checksums of data blocks" ),
10603+ OPTLINE ("--skip-qgroup-accounting" , "skip quota group accounting verification" ),
1060010604 OPTLINE ("-Q, --qgroup-report" , "print a report on qgroup consistency" ),
1060110605 OPTLINE ("-E, --subvol-extents SUBVOLID" , "print subvolume extents and sharing state" ),
1060210606 OPTLINE ("-p, --progress" , "indicate progress" ),
@@ -10636,7 +10640,7 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
1063610640 GETOPT_VAL_INIT_EXTENT , GETOPT_VAL_CHECK_CSUM ,
1063710641 GETOPT_VAL_READONLY , GETOPT_VAL_CHUNK_TREE ,
1063810642 GETOPT_VAL_MODE , GETOPT_VAL_CLEAR_SPACE_CACHE ,
10639- GETOPT_VAL_FORCE };
10643+ GETOPT_VAL_FORCE , GETOPT_VAL_SKIP_QGROUP_ACCOUNTING };
1064010644 static const struct option long_options [] = {
1064110645 { "super" , required_argument , NULL , 's' },
1064210646 { "repair" , no_argument , NULL , GETOPT_VAL_REPAIR },
@@ -10647,6 +10651,8 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
1064710651 GETOPT_VAL_INIT_EXTENT },
1064810652 { "check-data-csum" , no_argument , NULL ,
1064910653 GETOPT_VAL_CHECK_CSUM },
10654+ { "skip-qgroup-accounting" , no_argument , NULL ,
10655+ GETOPT_VAL_SKIP_QGROUP_ACCOUNTING },
1065010656 { "backup" , no_argument , NULL , 'b' },
1065110657 { "subvol-extents" , required_argument , NULL , 'E' },
1065210658 { "qgroup-report" , no_argument , NULL , 'Q' },
@@ -10719,6 +10725,9 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
1071910725 case GETOPT_VAL_CHECK_CSUM :
1072010726 check_data_csum = true;
1072110727 break ;
10728+ case GETOPT_VAL_SKIP_QGROUP_ACCOUNTING :
10729+ check_qgroup_accounting = false;
10730+ break ;
1072210731 case GETOPT_VAL_MODE :
1072310732 check_mode = parse_check_mode (optarg );
1072410733 if (check_mode == CHECK_MODE_UNKNOWN ) {
@@ -10762,6 +10771,15 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
1076210771 exit (1 );
1076310772 }
1076410773
10774+ if (!check_qgroup_accounting && opt_check_repair ) {
10775+ error ("--skip-qgroup-accounting is not compatible with --repair" );
10776+ exit (1 );
10777+ }
10778+ if (!check_qgroup_accounting && qgroup_report ) {
10779+ error ("--skip-qgroup-accounting is not compatible with --qgroup-report" );
10780+ exit (1 );
10781+ }
10782+
1076510783 if (opt_check_repair && !force ) {
1076610784 int delay = 10 ;
1076710785
@@ -10882,7 +10900,7 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
1088210900
1088310901 if (qgroup_report ) {
1088410902 printf ("Print quota groups report for %s\nUUID: %s\n" , argv [optind ], uuidbuf );
10885- ret = qgroup_verify_all (gfs_info );
10903+ ret = qgroup_verify (gfs_info , true );
1088610904 err |= !!ret ;
1088710905 if (ret >= 0 )
1088810906 report_qgroups (1 );
@@ -11143,26 +11161,32 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
1114311161
1114411162 if (gfs_info -> quota_enabled ) {
1114511163 if (!g_task_ctx .progress_enabled ) {
11146- fprintf (stderr , "[8/8] checking quota groups\n" );
11164+ if (check_qgroup_accounting )
11165+ fprintf (stderr , "[8/8] checking quota groups\n" );
11166+ else
11167+ fprintf (stderr ,
11168+ "[8/8] checking quota groups (without verifying accounting)\n" );
1114711169 } else {
1114811170 g_task_ctx .tp = TASK_QGROUPS ;
1114911171 task_start (g_task_ctx .info , & g_task_ctx .start_time , & g_task_ctx .item_count );
1115011172 }
11151- qgroup_verify_ret = qgroup_verify_all (gfs_info );
11173+ qgroup_verify_ret = qgroup_verify (gfs_info , check_qgroup_accounting );
1115211174 task_stop (g_task_ctx .info );
1115311175 if (qgroup_verify_ret < 0 ) {
1115411176 error ("failed to check quota groups" );
1115511177 err |= !!qgroup_verify_ret ;
1115611178 goto out ;
1115711179 }
11158- report_qgroups (0 );
11159- ret = repair_qgroups (gfs_info , & qgroups_repaired , false);
11160- if (ret ) {
11161- error ("failed to repair quota groups" );
11162- goto out ;
11180+ if (check_qgroup_accounting ) {
11181+ report_qgroups (0 );
11182+ ret = repair_qgroups (gfs_info , & qgroups_repaired , false);
11183+ if (ret ) {
11184+ error ("failed to repair quota groups" );
11185+ goto out ;
11186+ }
11187+ if (qgroup_verify_ret && (!qgroups_repaired || ret ))
11188+ err |= !!qgroup_verify_ret ;
1116311189 }
11164- if (qgroup_verify_ret && (!qgroups_repaired || ret ))
11165- err |= !!qgroup_verify_ret ;
1116611190 ret = 0 ;
1116711191 } else {
1116811192 fprintf (stderr ,
0 commit comments