@@ -36,7 +36,7 @@ static int64 blocks = 0;
3636static int64 badblocks = 0 ;
3737static ControlFileData * ControlFile ;
3838
39- static char * only_relfilenode = NULL ;
39+ static char * only_filenode = NULL ;
4040static bool do_sync = true;
4141static bool verbose = false;
4242static bool showprogress = false;
@@ -76,16 +76,16 @@ usage(void)
7676printf (_ ("Usage:\n" ));
7777printf (_ (" %s [OPTION]... [DATADIR]\n" ),progname );
7878printf (_ ("\nOptions:\n" ));
79- printf (_ (" [-D, --pgdata=]DATADIR data directory\n" ));
80- printf (_ (" -c, --check check data checksums (default)\n" ));
81- printf (_ (" -d, --disable disable data checksums\n" ));
82- printf (_ (" -e, --enable enable data checksums\n" ));
83- printf (_ (" -N , --no-sync do not wait for changes to be written safely to disk \n" ));
84- printf (_ (" -P , --progress show progress information \n" ));
85- printf (_ (" -v , --verbose output verbose messages \n" ));
86- printf (_ (" -r RELFILENODE check only relation with specified relfilenode \n" ));
87- printf (_ (" -V, --version output version information, then exit\n" ));
88- printf (_ (" -?, --help show this help, then exit\n" ));
79+ printf (_ (" [-D, --pgdata=]DATADIR data directory\n" ));
80+ printf (_ (" -c, --check check data checksums (default)\n" ));
81+ printf (_ (" -d, --disable disable data checksums\n" ));
82+ printf (_ (" -e, --enable enable data checksums\n" ));
83+ printf (_ (" -f , --filenode=FILENODE check only relation with specified filenode \n" ));
84+ printf (_ (" -N , --no-sync do not wait for changes to be written safely to disk \n" ));
85+ printf (_ (" -P , --progress show progress information \n" ));
86+ printf (_ (" -v, --verbose output verbose messages \n" ));
87+ printf (_ (" -V, --version output version information, then exit\n" ));
88+ printf (_ (" -?, --help show this help, then exit\n" ));
8989printf (_ ("\nIf no data directory (DATADIR) is specified, "
9090"the environment variable PGDATA\nis used.\n\n" ));
9191printf (_ ("Report bugs to <pgsql-bugs@lists.postgresql.org>.\n" ));
@@ -318,7 +318,7 @@ scan_directory(const char *basedir, const char *subdir, bool sizeonly)
318318/*
319319 * Cut off at the segment boundary (".") to get the segment number
320320 * in order to mix it into the checksum. Then also cut off at the
321- * fork boundary, to get therelfilenode the file belongs to for
321+ * fork boundary, to get thefilenode the file belongs to for
322322 * filtering.
323323 */
324324strlcpy (fnonly ,de -> d_name ,sizeof (fnonly ));
@@ -339,8 +339,8 @@ scan_directory(const char *basedir, const char *subdir, bool sizeonly)
339339if (forkpath != NULL )
340340* forkpath ++ = '\0' ;
341341
342- if (only_relfilenode && strcmp (only_relfilenode ,fnonly )!= 0 )
343- /*Relfilenode not to be included */
342+ if (only_filenode && strcmp (only_filenode ,fnonly )!= 0 )
343+ /*filenode not to be included */
344344continue ;
345345
346346dirsize += st .st_size ;
@@ -371,6 +371,7 @@ main(int argc, char *argv[])
371371{"pgdata" ,required_argument ,NULL ,'D' },
372372{"disable" ,no_argument ,NULL ,'d' },
373373{"enable" ,no_argument ,NULL ,'e' },
374+ {"filenode" ,required_argument ,NULL ,'f' },
374375{"no-sync" ,no_argument ,NULL ,'N' },
375376{"progress" ,no_argument ,NULL ,'P' },
376377{"verbose" ,no_argument ,NULL ,'v' },
@@ -400,7 +401,7 @@ main(int argc, char *argv[])
400401}
401402}
402403
403- while ((c = getopt_long (argc ,argv ,"cD:deNPr :v" ,long_options ,& option_index ))!= -1 )
404+ while ((c = getopt_long (argc ,argv ,"cD:deNPf :v" ,long_options ,& option_index ))!= -1 )
404405{
405406switch (c )
406407{
@@ -413,6 +414,14 @@ main(int argc, char *argv[])
413414case 'e' :
414415mode = PG_MODE_ENABLE ;
415416break ;
417+ case 'f' :
418+ if (atoi (optarg )== 0 )
419+ {
420+ pg_log_error ("invalid filenode specification, must be numeric: %s" ,optarg );
421+ exit (1 );
422+ }
423+ only_filenode = pstrdup (optarg );
424+ break ;
416425case 'N' :
417426do_sync = false;
418427break ;
@@ -422,14 +431,6 @@ main(int argc, char *argv[])
422431case 'D' :
423432DataDir = optarg ;
424433break ;
425- case 'r' :
426- if (atoi (optarg )== 0 )
427- {
428- pg_log_error ("invalid relfilenode specification, must be numeric: %s" ,optarg );
429- exit (1 );
430- }
431- only_relfilenode = pstrdup (optarg );
432- break ;
433434case 'P' :
434435showprogress = true;
435436break ;
@@ -465,10 +466,10 @@ main(int argc, char *argv[])
465466exit (1 );
466467}
467468
468- /*Relfilenode checking only works in --check mode */
469- if (mode != PG_MODE_CHECK && only_relfilenode )
469+ /*filenode checking only works in --check mode */
470+ if (mode != PG_MODE_CHECK && only_filenode )
470471{
471- pg_log_error ("relfilenode option only possible with --check" );
472+ pg_log_error ("--filenode option only possible with --check" );
472473fprintf (stderr ,_ ("Try \"%s --help\" for more information.\n" ),
473474progname );
474475exit (1 );