summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Schmidt <list.btrfs@jan-o-sch.net>2011-07-18 14:37:21 +0200
committerChris Mason <chris.mason@oracle.com>2011-10-25 09:18:59 -0400
commit19011f9ab6f9f9d05bde16761cd5613e1f815525 (patch)
treee4ce423ce23e0486ccae184039ff0567462f2bf9
parentd8e974fb4c81c35ee25cd2a45b8e1d50db7def9a (diff)
btrfs-progs: commands added
- scrub commands added - open_file_or_dir no longer static (needed by scrub.c) Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
-rw-r--r--Makefile4
-rw-r--r--btrfs.c23
-rw-r--r--btrfs_cmds.c2
-rw-r--r--btrfs_cmds.h5
4 files changed, 31 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 22bae25f..edee1a0e 100644
--- a/Makefile
+++ b/Makefile
@@ -35,8 +35,8 @@ all: version $(progs) manpages
version:
bash version.sh
-btrfs: $(objects) btrfs.o btrfs_cmds.o
- $(CC) -lpthread $(CFLAGS) -o btrfs btrfs.o btrfs_cmds.o \
+btrfs: $(objects) btrfs.o btrfs_cmds.o scrub.o
+ $(CC) -lpthread $(CFLAGS) -o btrfs btrfs.o btrfs_cmds.o scrub.o \
$(objects) $(LDFLAGS) $(LIBS)
btrfsctl: $(objects) btrfsctl.o
diff --git a/btrfs.c b/btrfs.c
index a8553646..a3f9a01d 100644
--- a/btrfs.c
+++ b/btrfs.c
@@ -127,6 +127,29 @@ static struct Command commands[] = {
"If <newlabel> is passed, set the filesystem label to <newlabel>.\n"
"The filesystem must be unmounted.\n"
},
+ { do_scrub_start, -1,
+ "scrub start", "[-Bdqr] <path>|<device>\n"
+ "Start a new scrub.",
+ "\n-B do not background\n"
+ "-d stats per device (-B only)\n"
+ "-q quiet\n"
+ "-r read only mode\n"
+ },
+ { do_scrub_cancel, 1,
+ "scrub cancel", "<path>|<device>\n"
+ "Cancel a running scrub.",
+ NULL
+ },
+ { do_scrub_resume, -1,
+ "scrub resume", "[-Bdqr] <path>|<device>\n"
+ "Resume previously canceled or interrupted scrub.",
+ NULL
+ },
+ { do_scrub_status, -1,
+ "scrub status", "[-d] <path>|<device>\n"
+ "Show status of running or finished scrub.",
+ NULL
+ },
{ do_scan, 999,
"device scan", "[<device>...]\n"
"Scan all device for or the passed device for a btrfs\n"
diff --git a/btrfs_cmds.c b/btrfs_cmds.c
index 72129d98..d91bccd5 100644
--- a/btrfs_cmds.c
+++ b/btrfs_cmds.c
@@ -91,7 +91,7 @@ static int test_isdir(char *path)
}
-static int open_file_or_dir(const char *fname)
+int open_file_or_dir(const char *fname)
{
int ret;
struct stat st;
diff --git a/btrfs_cmds.h b/btrfs_cmds.h
index 12902d8b..3e171dac 100644
--- a/btrfs_cmds.h
+++ b/btrfs_cmds.h
@@ -23,6 +23,10 @@ int do_defrag(int argc, char **argv);
int do_show_filesystem(int nargs, char **argv);
int do_add_volume(int nargs, char **args);
int do_balance(int nargs, char **argv);
+int do_scrub_start(int nargs, char **argv);
+int do_scrub_status(int argc, char **argv);
+int do_scrub_resume(int argc, char **argv);
+int do_scrub_cancel(int nargs, char **argv);
int do_remove_volume(int nargs, char **args);
int do_scan(int nargs, char **argv);
int do_resize(int nargs, char **argv);
@@ -33,3 +37,4 @@ int do_df_filesystem(int nargs, char **argv);
int find_updated_files(int fd, u64 root_id, u64 oldest_gen);
int do_find_newer(int argc, char **argv);
int do_change_label(int argc, char **argv);
+int open_file_or_dir(const char *fname);