mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-01-23 00:07:07 +03:00
49 lines
1017 B
C
49 lines
1017 B
C
|
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <sys/ioctl.h>
|
||
|
|
||
|
#include "libbcachefs/bcachefs_ioctl.h"
|
||
|
|
||
|
#include "cmds.h"
|
||
|
#include "libbcachefs.h"
|
||
|
|
||
|
static void data_rereplicate_usage(void)
|
||
|
{
|
||
|
puts("bcachefs data rereplicate\n"
|
||
|
"Usage: bcachefs data rereplicate filesystem\n"
|
||
|
"\n"
|
||
|
"Walks existing data in a filesystem, writing additional copies\n"
|
||
|
"of any degraded data\n"
|
||
|
"\n"
|
||
|
"Options:\n"
|
||
|
" -h, --help display this help and exit\n"
|
||
|
"Report bugs to <linux-bcache@vger.kernel.org>");
|
||
|
exit(EXIT_SUCCESS);
|
||
|
}
|
||
|
|
||
|
int cmd_data_rereplicate(int argc, char *argv[])
|
||
|
{
|
||
|
int opt;
|
||
|
|
||
|
while ((opt = getopt(argc, argv, "h")) != -1)
|
||
|
switch (opt) {
|
||
|
case 'h':
|
||
|
data_rereplicate_usage();
|
||
|
}
|
||
|
args_shift(optind);
|
||
|
|
||
|
char *fs_path = arg_pop();
|
||
|
if (!fs_path)
|
||
|
die("Please supply a filesystem");
|
||
|
|
||
|
if (argc)
|
||
|
die("too many arguments");
|
||
|
|
||
|
return bchu_data(bcache_fs_open(fs_path), (struct bch_ioctl_data) {
|
||
|
.op = BCH_DATA_OP_REREPLICATE,
|
||
|
.start = POS_MIN,
|
||
|
.end = POS_MAX,
|
||
|
});
|
||
|
}
|