-
Notifications
You must be signed in to change notification settings - Fork 94
/
cmd_data.c
48 lines (38 loc) · 1017 Bytes
/
cmd_data.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#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 <[email protected]>");
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,
});
}