From patchwork Sat Mar 12 18:31:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Schmidt X-Patchwork-Id: 630121 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2CId63p032246 for ; Sat, 12 Mar 2011 18:43:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754911Ab1CLSjK (ORCPT ); Sat, 12 Mar 2011 13:39:10 -0500 Received: from mort.rzone.de ([81.169.144.234]:42605 "EHLO mort.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754680Ab1CLSjJ (ORCPT ); Sat, 12 Mar 2011 13:39:09 -0500 Received: from gargravarr.store (gargravarr.store [192.168.42.236]) by mort.rzone.de (Postfix) with ESMTP id 9E5BFF0C; Sat, 12 Mar 2011 19:31:35 +0100 (MET) Received: by gargravarr.store (Postfix, from userid 32566) id 8F1EF44C12; Sat, 12 Mar 2011 19:31:35 +0100 (CET) From: Jan Schmidt To: chris.mason@oracle.com, linux-btrfs@vger.kernel.org Subject: [PATCH v1 1/3] commands added Date: Sat, 12 Mar 2011 19:31:33 +0100 Message-Id: <266902baf1febfc393678f81844b92b911f111ea.1299954564.git.list.btrfs@jan-o-sch.net> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 12 Mar 2011 18:43:59 +0000 (UTC) diff --git a/Makefile b/Makefile index 6e6f6c6..6630887 100644 --- a/Makefile +++ b/Makefile @@ -37,8 +37,8 @@ all: version $(progs) manpages version: bash version.sh -btrfs: $(objects) btrfs.o btrfs_cmds.o - gcc $(CFLAGS) -o btrfs btrfs.o btrfs_cmds.o \ +btrfs: $(objects) btrfs.o btrfs_cmds.o scrub.o + gcc -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 46314cf..e874777 100644 --- a/btrfs.c +++ b/btrfs.c @@ -95,6 +95,18 @@ static struct Command commands[] = { "filesystem balance", "\n" "Balance the chunks across the device." }, + { do_scrub_start, -1, + "filesystem scrub start", "[-D] [-w] \n" + "Check the underlying media for errors." + }, + { do_scrub_cancel, 1, + "filesystem scrub cancel", "\n" + "Cancel a running scrub." + }, + { do_scrub_status, -1, + "filesystem scrub status", "[-r] \n" + "Show status of running or finished scrub." + }, { do_scan, 999, "device scan", "[ [..]\n" "Scan all device for or the passed device for a btrfs\n" diff --git a/btrfs_cmds.c b/btrfs_cmds.c index 8031c58..39f84a8 100644 --- a/btrfs_cmds.c +++ b/btrfs_cmds.c @@ -90,7 +90,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; @@ -776,6 +776,7 @@ int do_balance(int argc, char **argv) } return 0; } + int do_remove_volume(int nargs, char **args) { diff --git a/btrfs_cmds.h b/btrfs_cmds.h index 7bde191..f925970 100644 --- a/btrfs_cmds.h +++ b/btrfs_cmds.h @@ -23,6 +23,9 @@ 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_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); @@ -32,3 +35,4 @@ int list_subvols(int fd); 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 open_file_or_dir(const char *fname);