Hu Tao
2015-Jan-16 02:23 UTC
[Libguestfs] [PATCH 00/16] btrfs: add support to btrfs scrub, balance, rescue and inspect
Hi, This series adds new APIs to support btrfs scrub, balance, rescue and inspect. Some of them don't have tests because: - btrfs_scrub and btrfs_balance completes too early before we can test btrfs_scrub_cancel, btrfs_scrub_resume, btrfs_scrub_status, btrfs_balance_pause, btrfs_balance_cancel, btrfs_balance_resume and btrfs_balance_status. - can't determine a valid logical address for test btrfs_inspect_logical_resolve. Thank you very much for review! Regards, Hu Hu Tao (16): New API: btrfs_scrub New API: btrfs_scrub_cancel New API: btrfs_scrub_resume btrfs: replace "btrfs filesystem balance" with "btrfs balance" New API: btrfs_balance_pause New API: btrfs_balance_cancel New API: btrfs_balance_resume New API: btrfs_balance_status New API: btrfs_scrub_status New API: add btrfs_filesystem_defragment New API: add btrfs_rescue_chunk_recover New API: add btrfs_rescue_super_recover New API: btrfs_inspect_rootid New API: btrfs_inspect_subvolid_resolve New API: btrfs_inspect_inode_resolve New API: btrfs_inspect_logical_resolve daemon/btrfs.c | 519 ++++++++++++++++++++++++++++++++++++++++++++++++++- generator/actions.ml | 198 ++++++++++++++++++++ gobject/Makefile.inc | 4 +- java/Makefile.inc | 2 +- po/POTFILES | 1 + src/MAX_PROC_NR | 2 +- 6 files changed, 722 insertions(+), 4 deletions(-) -- 2.1.0
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> --- daemon/btrfs.c | 32 ++++++++++++++++++++++++++++++++ generator/actions.ml | 17 +++++++++++++++++ gobject/Makefile.inc | 2 +- java/Makefile.inc | 2 +- src/MAX_PROC_NR | 2 +- 5 files changed, 52 insertions(+), 3 deletions(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 150c089..f215cc4 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1343,3 +1343,35 @@ do_btrfs_qgroup_remove (const char *src, const char *dst, const char *path) return 0; } + +int +do_btrfs_scrub_start (const char *path) +{ + const size_t MAX_ARGS = 64; + const char *argv[MAX_ARGS]; + size_t i = 0; + CLEANUP_FREE char *path_buf = NULL; + CLEANUP_FREE char *err = NULL; + CLEANUP_FREE char *out = NULL; + int r; + + path_buf = sysroot_path (path); + if (path_buf == NULL) { + reply_with_perror ("malloc"); + return -1; + } + + ADD_ARG (argv, i, str_btrfs); + ADD_ARG (argv, i, "scrub"); + ADD_ARG (argv, i, "start"); + ADD_ARG (argv, i, path_buf); + ADD_ARG (argv, i, NULL); + + r = commandv (&out, &err, argv); + if (r == -1) { + reply_with_error ("%s: %s", path, err); + return -1; + } + + return 0; +} diff --git a/generator/actions.ml b/generator/actions.ml index a6a6dad..11b8425 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -12250,6 +12250,23 @@ several qgroups into a parent qgroup to share common limit." }; longdesc = "\ Remove qgroup C<src> from the parent qgroup C<dst>." }; + { defaults with + name = "btrfs_scrub_start"; + style = RErr, [Pathname "path"], []; + proc_nr = Some 435; + optional = Some "btrfs"; camel_name = "BTRFSScrubStart"; + tests = [ + InitPartition, Always, TestRun ( + [["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; "NOARG"; ""; ""]; + ["mount"; "/dev/sda1"; "/"]; + ["btrfs_scrub_start"; "/"]]), []; + ]; + shortdesc = "read all data from all disks and verify checksums"; + longdesc = "\ +Reads all the data and metadata on the filesystem, and uses checksums +and the duplicate copies from RAID storage to identify and repair any +corrupt data." }; + ] (* Non-API meta-commands available only in guestfish. diff --git a/gobject/Makefile.inc b/gobject/Makefile.inc index 91c4ea6..15bbd21 100644 --- a/gobject/Makefile.inc +++ b/gobject/Makefile.inc @@ -3,7 +3,7 @@ # generator/ *.ml # ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST. # -# Copyright (C) 2009-2014 Red Hat Inc. +# Copyright (C) 2009-2015 Red Hat Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/java/Makefile.inc b/java/Makefile.inc index 34938fb..103010f 100644 --- a/java/Makefile.inc +++ b/java/Makefile.inc @@ -3,7 +3,7 @@ # generator/ *.ml # ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST. # -# Copyright (C) 2009-2014 Red Hat Inc. +# Copyright (C) 2009-2015 Red Hat Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index e828e5d..5910394 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -434 +435 -- 2.1.0
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> --- daemon/btrfs.c | 32 ++++++++++++++++++++++++++++++++ generator/actions.ml | 10 ++++++++++ src/MAX_PROC_NR | 2 +- 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index f215cc4..c32d1bb 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1375,3 +1375,35 @@ do_btrfs_scrub_start (const char *path) return 0; } + +int +do_btrfs_scrub_cancel (const char *path) +{ + const size_t MAX_ARGS = 64; + const char *argv[MAX_ARGS]; + size_t i = 0; + CLEANUP_FREE char *path_buf = NULL; + CLEANUP_FREE char *err = NULL; + CLEANUP_FREE char *out = NULL; + int r; + + path_buf = sysroot_path (path); + if (path_buf == NULL) { + reply_with_perror ("malloc"); + return -1; + } + + ADD_ARG (argv, i, str_btrfs); + ADD_ARG (argv, i, "scrub"); + ADD_ARG (argv, i, "cancel"); + ADD_ARG (argv, i, path_buf); + ADD_ARG (argv, i, NULL); + + r = commandv (&out, &err, argv); + if (r == -1) { + reply_with_error ("%s: %s", path, err); + return -1; + } + + return 0; +} diff --git a/generator/actions.ml b/generator/actions.ml index 11b8425..d1d0e92 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -12267,6 +12267,16 @@ Reads all the data and metadata on the filesystem, and uses checksums and the duplicate copies from RAID storage to identify and repair any corrupt data." }; + { defaults with + name = "btrfs_scrub_cancel"; + style = RErr, [Pathname "path"], []; + proc_nr = Some 436; + optional = Some "btrfs"; camel_name = "BTRFSScrubCancel"; + test_excuse = "test disk isn't large enough that btrfs_scrub_start completes before we can cancel it"; + shortdesc = "cancel a running scrub"; + longdesc = "\ +Cancel a running scrub on a btrfs filesystem." }; + ] (* Non-API meta-commands available only in guestfish. diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index 5910394..246662b 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -435 +436 -- 2.1.0
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> --- daemon/btrfs.c | 32 ++++++++++++++++++++++++++++++++ generator/actions.ml | 10 ++++++++++ src/MAX_PROC_NR | 2 +- 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index c32d1bb..167dd49 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1407,3 +1407,35 @@ do_btrfs_scrub_cancel (const char *path) return 0; } + +int +do_btrfs_scrub_resume (const char *path) +{ + const size_t MAX_ARGS = 64; + const char *argv[MAX_ARGS]; + size_t i = 0; + CLEANUP_FREE char *path_buf = NULL; + CLEANUP_FREE char *err = NULL; + CLEANUP_FREE char *out = NULL; + int r; + + path_buf = sysroot_path (path); + if (path_buf == NULL) { + reply_with_perror ("malloc"); + return -1; + } + + ADD_ARG (argv, i, str_btrfs); + ADD_ARG (argv, i, "scrub"); + ADD_ARG (argv, i, "resume"); + ADD_ARG (argv, i, path_buf); + ADD_ARG (argv, i, NULL); + + r = commandv (&out, &err, argv); + if (r == -1) { + reply_with_error ("%s: %s", path, err); + return -1; + } + + return 0; +} diff --git a/generator/actions.ml b/generator/actions.ml index d1d0e92..c77c250 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -12277,6 +12277,16 @@ corrupt data." }; longdesc = "\ Cancel a running scrub on a btrfs filesystem." }; + { defaults with + name = "btrfs_scrub_resume"; + style = RErr, [Pathname "path"], []; + proc_nr = Some 437; + optional = Some "btrfs"; camel_name = "BTRFSScrubResume"; + test_excuse = "test disk isn't large enough that btrfs_scrub_start completes before we can cancel and resume it"; + shortdesc = "resume a previously canceled or interrupted scrub"; + longdesc = "\ +Resume a previously canceled or interrupted scrub on a btrfs filesystem." }; + ] (* Non-API meta-commands available only in guestfish. diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index 246662b..ce9cd49 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -436 +437 -- 2.1.0
Hu Tao
2015-Jan-16 02:23 UTC
[Libguestfs] [PATCH 04/16] btrfs: replace "btrfs filesystem balance" with "btrfs balance"
"btrfs filesystem balance" is deprecated in favor of "btrfs balance". Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> --- daemon/btrfs.c | 1 - generator/actions.ml | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 167dd49..f525ea2 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -645,7 +645,6 @@ do_btrfs_filesystem_balance (const char *fs) } ADD_ARG (argv, i, str_btrfs); - ADD_ARG (argv, i, "filesystem"); ADD_ARG (argv, i, "balance"); ADD_ARG (argv, i, fs_buf); ADD_ARG (argv, i, NULL); diff --git a/generator/actions.ml b/generator/actions.ml index c77c250..00f04a5 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -10335,6 +10335,7 @@ Force sync on the btrfs filesystem mounted at C<fs>." }; { defaults with name = "btrfs_filesystem_balance"; style = RErr, [Pathname "fs"], []; + fish_alias = ["btrfs-balance"]; proc_nr = Some 328; optional = Some "btrfs"; camel_name = "BTRFSFilesystemBalance"; shortdesc = "balance a btrfs filesystem"; -- 2.1.0
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> --- daemon/btrfs.c | 32 ++++++++++++++++++++++++++++++++ generator/actions.ml | 10 ++++++++++ src/MAX_PROC_NR | 2 +- 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index f525ea2..6dde36d 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1438,3 +1438,35 @@ do_btrfs_scrub_resume (const char *path) return 0; } + +int +do_btrfs_balance_pause (const char *path) +{ + const size_t MAX_ARGS = 64; + const char *argv[MAX_ARGS]; + size_t i = 0; + CLEANUP_FREE char *path_buf = NULL; + CLEANUP_FREE char *err = NULL; + CLEANUP_FREE char *out = NULL; + int r; + + path_buf = sysroot_path (path); + if (path_buf == NULL) { + reply_with_perror ("malloc"); + return -1; + } + + ADD_ARG (argv, i, str_btrfs); + ADD_ARG (argv, i, "balance"); + ADD_ARG (argv, i, "pause"); + ADD_ARG (argv, i, path_buf); + ADD_ARG (argv, i, NULL); + + r = commandv (&out, &err, argv); + if (r == -1) { + reply_with_error ("%s: %s", path, err); + return -1; + } + + return 0; +} diff --git a/generator/actions.ml b/generator/actions.ml index 00f04a5..b0b2f22 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -12288,6 +12288,16 @@ Cancel a running scrub on a btrfs filesystem." }; longdesc = "\ Resume a previously canceled or interrupted scrub on a btrfs filesystem." }; +{ defaults with + name = "btrfs_balance_pause"; + style = RErr, [Pathname "path"], []; + proc_nr = Some 438; + optional = Some "btrfs"; camel_name = "BTRFSBalancePause"; + test_excuse = "test disk isn't large enough to test this thoroughly"; + shortdesc = "pause a running balance"; + longdesc = "\ +Pause a running balance on a btrfs filesystem." }; + ] (* Non-API meta-commands available only in guestfish. diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index ce9cd49..c8eb588 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -437 +438 -- 2.1.0
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> --- daemon/btrfs.c | 32 ++++++++++++++++++++++++++++++++ generator/actions.ml | 10 ++++++++++ src/MAX_PROC_NR | 2 +- 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 6dde36d..1053b98 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1470,3 +1470,35 @@ do_btrfs_balance_pause (const char *path) return 0; } + +int +do_btrfs_balance_cancel (const char *path) +{ + const size_t MAX_ARGS = 64; + const char *argv[MAX_ARGS]; + size_t i = 0; + CLEANUP_FREE char *path_buf = NULL; + CLEANUP_FREE char *err = NULL; + CLEANUP_FREE char *out = NULL; + int r; + + path_buf = sysroot_path (path); + if (path_buf == NULL) { + reply_with_perror ("malloc"); + return -1; + } + + ADD_ARG (argv, i, str_btrfs); + ADD_ARG (argv, i, "balance"); + ADD_ARG (argv, i, "cancel"); + ADD_ARG (argv, i, path_buf); + ADD_ARG (argv, i, NULL); + + r = commandv (&out, &err, argv); + if (r == -1) { + reply_with_error ("%s: %s", path, err); + return -1; + } + + return 0; +} diff --git a/generator/actions.ml b/generator/actions.ml index b0b2f22..17dbd78 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -12298,6 +12298,16 @@ Resume a previously canceled or interrupted scrub on a btrfs filesystem." }; longdesc = "\ Pause a running balance on a btrfs filesystem." }; +{ defaults with + name = "btrfs_balance_cancel"; + style = RErr, [Pathname "path"], []; + proc_nr = Some 439; + optional = Some "btrfs"; camel_name = "BTRFSBalanceCancel"; + test_excuse = "test disk isn't large enough that btrfs_balance completes before we can cancel it"; + shortdesc = "cancel a running or paused balance"; + longdesc = "\ +Cancel a running balance on a btrfs filesystem." }; + ] (* Non-API meta-commands available only in guestfish. diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index c8eb588..99dea3b 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -438 +439 -- 2.1.0
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> --- daemon/btrfs.c | 32 ++++++++++++++++++++++++++++++++ generator/actions.ml | 9 +++++++++ src/MAX_PROC_NR | 2 +- 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 1053b98..cdf3982 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1502,3 +1502,35 @@ do_btrfs_balance_cancel (const char *path) return 0; } + +int +do_btrfs_balance_resume (const char *path) +{ + const size_t MAX_ARGS = 64; + const char *argv[MAX_ARGS]; + size_t i = 0; + CLEANUP_FREE char *path_buf = NULL; + CLEANUP_FREE char *err = NULL; + CLEANUP_FREE char *out = NULL; + int r; + + path_buf = sysroot_path (path); + if (path_buf == NULL) { + reply_with_perror ("malloc"); + return -1; + } + + ADD_ARG (argv, i, str_btrfs); + ADD_ARG (argv, i, "balance"); + ADD_ARG (argv, i, "resume"); + ADD_ARG (argv, i, path_buf); + ADD_ARG (argv, i, NULL); + + r = commandv (&out, &err, argv); + if (r == -1) { + reply_with_error ("%s: %s", path, err); + return -1; + } + + return 0; +} diff --git a/generator/actions.ml b/generator/actions.ml index 17dbd78..df083a1 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -12308,6 +12308,15 @@ Pause a running balance on a btrfs filesystem." }; longdesc = "\ Cancel a running balance on a btrfs filesystem." }; +{ defaults with + name = "btrfs_balance_resume"; + style = RErr, [Pathname "path"], []; + proc_nr = Some 440; + optional = Some "btrfs"; camel_name = "BTRFSBalanceResume"; + test_excuse = "test disk isn't large enough that btrfs_balance completes before we can pause and resume it"; + shortdesc = "resume a paused balance"; + longdesc = "\ +Resume a paused balance on a btrfs filesystem." }; ] (* Non-API meta-commands available only in guestfish. diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index 99dea3b..534a21e 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -439 +440 -- 2.1.0
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> --- daemon/btrfs.c | 32 ++++++++++++++++++++++++++++++++ generator/actions.ml | 11 +++++++++++ src/MAX_PROC_NR | 2 +- 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index cdf3982..09ee7dd 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1534,3 +1534,35 @@ do_btrfs_balance_resume (const char *path) return 0; } + +char * +do_btrfs_balance_status (const char *path) +{ + const size_t MAX_ARGS = 64; + const char *argv[MAX_ARGS]; + size_t i = 0; + CLEANUP_FREE char *path_buf = NULL; + CLEANUP_FREE char *err = NULL; + char *out; + int r; + + path_buf = sysroot_path (path); + if (path_buf == NULL) { + reply_with_perror ("malloc"); + return NULL; + } + + ADD_ARG (argv, i, str_btrfs); + ADD_ARG (argv, i, "balance"); + ADD_ARG (argv, i, "status"); + ADD_ARG (argv, i, path_buf); + ADD_ARG (argv, i, NULL); + + r = commandv (&out, &err, argv); + if (r == -1) { + reply_with_error ("%s: %s", path, err); + return NULL; + } + + return out; +} diff --git a/generator/actions.ml b/generator/actions.ml index df083a1..c777720 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -12317,6 +12317,17 @@ Cancel a running balance on a btrfs filesystem." }; shortdesc = "resume a paused balance"; longdesc = "\ Resume a paused balance on a btrfs filesystem." }; + +{ defaults with + name = "btrfs_balance_status"; + style = RString "status", [Pathname "path"], []; + proc_nr = Some 441; + optional = Some "btrfs"; camel_name = "BTRFSBalanceStatus"; + test_excuse = "test disk isn't large enough that btrfs_balance completes before we can get its status"; + shortdesc = "show the status of a running or paused balance"; + longdesc = "\ +Show the status of a running or paused balance on a btrfs filesystem." }; + ] (* Non-API meta-commands available only in guestfish. diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index 534a21e..54bb288 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -440 +441 -- 2.1.0
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> --- daemon/btrfs.c | 32 ++++++++++++++++++++++++++++++++ generator/actions.ml | 16 ++++++++++++++++ src/MAX_PROC_NR | 2 +- 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 09ee7dd..700af9a 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1566,3 +1566,35 @@ do_btrfs_balance_status (const char *path) return out; } + +char * +do_btrfs_scrub_status (const char *path) +{ + const size_t MAX_ARGS = 64; + const char *argv[MAX_ARGS]; + size_t i = 0; + CLEANUP_FREE char *path_buf = NULL; + CLEANUP_FREE char *err = NULL; + char *out; + int r; + + path_buf = sysroot_path (path); + if (path_buf == NULL) { + reply_with_perror ("malloc"); + return NULL; + } + + ADD_ARG (argv, i, str_btrfs); + ADD_ARG (argv, i, "scrub"); + ADD_ARG (argv, i, "status"); + ADD_ARG (argv, i, path_buf); + ADD_ARG (argv, i, NULL); + + r = commandv (&out, &err, argv); + if (r == -1) { + reply_with_error ("%s: %s", path, err); + return NULL; + } + + return out; +} diff --git a/generator/actions.ml b/generator/actions.ml index c777720..8d8b891 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -12328,6 +12328,22 @@ Resume a paused balance on a btrfs filesystem." }; longdesc = "\ Show the status of a running or paused balance on a btrfs filesystem." }; + { defaults with + name = "btrfs_scrub_status"; + style = RString "status", [Pathname "path"], []; + proc_nr = Some 442; + optional = Some "btrfs"; camel_name = "BTRFSScrubStatus"; + tests = [ + InitPartition, Always, TestRun ( + [["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; "NOARG"; ""; ""]; + ["mount"; "/dev/sda1"; "/"]; + ["btrfs_scrub_start"; "/"]; + ["btrfs_scrub_status"; "/"]]), []; + ]; + shortdesc = "show status of running or finished scrub"; + longdesc = "\ +Show status of running or finished scrub on a btrfs filesystem." }; + ] (* Non-API meta-commands available only in guestfish. diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index 54bb288..18e1dd6 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -441 +442 -- 2.1.0
Hu Tao
2015-Jan-16 02:23 UTC
[Libguestfs] [PATCH 10/16] New API: add btrfs_filesystem_defragment
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> --- daemon/btrfs.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ generator/actions.ml | 20 ++++++++++++++++++++ gobject/Makefile.inc | 2 ++ po/POTFILES | 1 + src/MAX_PROC_NR | 2 +- 5 files changed, 73 insertions(+), 1 deletion(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 700af9a..a17d656 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1598,3 +1598,52 @@ do_btrfs_scrub_status (const char *path) return out; } + +/* Takes optional arguments, consult optargs_bitmask. */ +int +do_btrfs_filesystem_defragment (const char *path, int flush, const char *compress) +{ + const size_t MAX_ARGS = 64; + const char *argv[MAX_ARGS]; + size_t i = 0; + CLEANUP_FREE char *path_buf = NULL; + CLEANUP_FREE char *err = NULL; + CLEANUP_FREE char *out = NULL; + int r; + + path_buf = sysroot_path (path); + if (path_buf == NULL) { + reply_with_perror ("malloc"); + return -1; + } + + ADD_ARG (argv, i, str_btrfs); + ADD_ARG (argv, i, "filesystem"); + ADD_ARG (argv, i, "defragment"); + ADD_ARG (argv, i, "-r"); + + /* Optional arguments. */ + if ((optargs_bitmask & GUESTFS_BTRFS_FILESYSTEM_DEFRAGMENT_FLUSH_BITMASK) && flush) + ADD_ARG (argv, i, "-f"); + if (optargs_bitmask & GUESTFS_BTRFS_FILESYSTEM_DEFRAGMENT_COMPRESS_BITMASK) { + if (STREQ(compress, "zlib")) + ADD_ARG (argv, i, "-czlib"); + else if (STREQ(compress, "lzo")) + ADD_ARG (argv, i, "-clzo"); + else { + reply_with_error ("unknown compress method: %s", compress); + return -1; + } + } + + ADD_ARG (argv, i, path_buf); + ADD_ARG (argv, i, NULL); + + r = commandv (&out, &err, argv); + if (r == -1) { + reply_with_error ("%s: %s", path, err); + return -1; + } + + return 0; +} diff --git a/generator/actions.ml b/generator/actions.ml index 8d8b891..2774336 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -12344,6 +12344,26 @@ Show the status of a running or paused balance on a btrfs filesystem." }; longdesc = "\ Show status of running or finished scrub on a btrfs filesystem." }; + { defaults with + name = "btrfs_filesystem_defragment"; + style = RErr, [Pathname "path"], [OBool "flush"; OString "compress"]; + proc_nr = Some 443; + optional = Some "btrfs"; camel_name = "BTRFSFilesystemDefragment"; + tests = [ + InitPartition, Always, TestRun ( + [["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; "NOARG"; ""; ""]; + ["mount"; "/dev/sda1"; "/"]; + ["btrfs_filesystem_defragment"; "/"; "true"; "lzo"]]), []; + InitPartition, Always, TestRun ( + [["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; "NOARG"; ""; ""]; + ["mount"; "/dev/sda1"; "/"]; + ["touch"; "/hello"]; + ["btrfs_filesystem_defragment"; "/hello"; ""; "zlib"]]), []; + ]; + shortdesc = "defragment a file or directory"; + longdesc = "\ +Defragment a file or directory on a btrfs filesystem. compress is one of zlib or lzo." }; + ] (* Non-API meta-commands available only in guestfish. diff --git a/gobject/Makefile.inc b/gobject/Makefile.inc index 15bbd21..e0c0a5f 100644 --- a/gobject/Makefile.inc +++ b/gobject/Makefile.inc @@ -49,6 +49,7 @@ guestfs_gobject_headers= \ include/guestfs-gobject/optargs-add_drive.h \ include/guestfs-gobject/optargs-add_drive_scratch.h \ include/guestfs-gobject/optargs-add_libvirt_dom.h \ + include/guestfs-gobject/optargs-btrfs_filesystem_defragment.h \ include/guestfs-gobject/optargs-btrfs_filesystem_resize.h \ include/guestfs-gobject/optargs-btrfs_fsck.h \ include/guestfs-gobject/optargs-btrfs_subvolume_create.h \ @@ -131,6 +132,7 @@ guestfs_gobject_sources= \ src/optargs-add_drive.c \ src/optargs-add_drive_scratch.c \ src/optargs-add_libvirt_dom.c \ + src/optargs-btrfs_filesystem_defragment.c \ src/optargs-btrfs_filesystem_resize.c \ src/optargs-btrfs_fsck.c \ src/optargs-btrfs_subvolume_create.c \ diff --git a/po/POTFILES b/po/POTFILES index b18895b..4194e5f 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -174,6 +174,7 @@ gobject/src/optargs-add_domain.c gobject/src/optargs-add_drive.c gobject/src/optargs-add_drive_scratch.c gobject/src/optargs-add_libvirt_dom.c +gobject/src/optargs-btrfs_filesystem_defragment.c gobject/src/optargs-btrfs_filesystem_resize.c gobject/src/optargs-btrfs_fsck.c gobject/src/optargs-btrfs_subvolume_create.c diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index 18e1dd6..6a13cf6 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -442 +443 -- 2.1.0
Hu Tao
2015-Jan-16 02:23 UTC
[Libguestfs] [PATCH 11/16] New API: add btrfs_rescue_chunk_recover
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> --- daemon/btrfs.c | 26 ++++++++++++++++++++++++++ generator/actions.ml | 14 ++++++++++++++ src/MAX_PROC_NR | 2 +- 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index a17d656..78c5498 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1647,3 +1647,29 @@ do_btrfs_filesystem_defragment (const char *path, int flush, const char *compres return 0; } + +int +do_btrfs_rescue_chunk_recover (const char *device) +{ + const size_t MAX_ARGS = 64; + const char *argv[MAX_ARGS]; + size_t i = 0; + CLEANUP_FREE char *err = NULL; + CLEANUP_FREE char *out = NULL; + int r; + + ADD_ARG (argv, i, str_btrfs); + ADD_ARG (argv, i, "rescue"); + ADD_ARG (argv, i, "chunk-recover"); + ADD_ARG (argv, i, "-y"); + ADD_ARG (argv, i, device); + ADD_ARG (argv, i, NULL); + + r = commandv (&out, &err, argv); + if (r == -1) { + reply_with_error ("%s: %s", device, err); + return -1; + } + + return 0; +} diff --git a/generator/actions.ml b/generator/actions.ml index 2774336..eef764c 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -12364,6 +12364,20 @@ Show status of running or finished scrub on a btrfs filesystem." }; longdesc = "\ Defragment a file or directory on a btrfs filesystem. compress is one of zlib or lzo." }; + { defaults with + name = "btrfs_rescue_chunk_recover"; + style = RErr, [Device "device"], []; + proc_nr = Some 444; + optional = Some "btrfs"; camel_name = "BTRFSRescueChunkRecover"; + tests = [ + InitPartition, Always, TestRun ( + [["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; "NOARG"; ""; ""]; + ["btrfs_rescue_chunk_recover"; "/dev/sda1"]]), []; + ]; + shortdesc = "recover the chunk tree of btrfs filesystem"; + longdesc = "\ +Recover the chunk tree of btrfs filesystem by scannning the devices one by one." }; + ] (* Non-API meta-commands available only in guestfish. diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index 6a13cf6..1e6fd03 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -443 +444 -- 2.1.0
Hu Tao
2015-Jan-16 02:23 UTC
[Libguestfs] [PATCH 12/16] New API: add btrfs_rescue_super_recover
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> --- daemon/btrfs.c | 26 ++++++++++++++++++++++++++ generator/actions.ml | 14 ++++++++++++++ src/MAX_PROC_NR | 2 +- 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 78c5498..e9b6f26 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1673,3 +1673,29 @@ do_btrfs_rescue_chunk_recover (const char *device) return 0; } + +int +do_btrfs_rescue_super_recover (const char *device) +{ + const size_t MAX_ARGS = 64; + const char *argv[MAX_ARGS]; + size_t i = 0; + CLEANUP_FREE char *err = NULL; + CLEANUP_FREE char *out = NULL; + int r; + + ADD_ARG (argv, i, str_btrfs); + ADD_ARG (argv, i, "rescue"); + ADD_ARG (argv, i, "super-recover"); + ADD_ARG (argv, i, "-y"); + ADD_ARG (argv, i, device); + ADD_ARG (argv, i, NULL); + + r = commandv (&out, &err, argv); + if (r == -1) { + reply_with_error ("%s: %s", device, err); + return -1; + } + + return 0; +} diff --git a/generator/actions.ml b/generator/actions.ml index eef764c..be55a68 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -12378,6 +12378,20 @@ Defragment a file or directory on a btrfs filesystem. compress is one of zlib or longdesc = "\ Recover the chunk tree of btrfs filesystem by scannning the devices one by one." }; + { defaults with + name = "btrfs_rescue_super_recover"; + style = RErr, [Device "device"], []; + proc_nr = Some 445; + optional = Some "btrfs"; camel_name = "BTRFSRescueSuperRecover"; + tests = [ + InitPartition, Always, TestRun ( + [["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; "NOARG"; ""; ""]; + ["btrfs_rescue_super_recover"; "/dev/sda1"]]), []; + ]; + shortdesc = "recover bad superblocks from good copies"; + longdesc = "\ +Recover bad superblocks from good copies." }; + ] (* Non-API meta-commands available only in guestfish. diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index 1e6fd03..e5a135a 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -444 +445 -- 2.1.0
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> --- daemon/btrfs.c | 38 ++++++++++++++++++++++++++++++++++++++ generator/actions.ml | 15 +++++++++++++++ src/MAX_PROC_NR | 2 +- 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index e9b6f26..c6ca3c3 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1699,3 +1699,41 @@ do_btrfs_rescue_super_recover (const char *device) return 0; } + +int64_t +do_btrfs_inspect_rootid (const char *path) +{ + const size_t MAX_ARGS = 64; + const char *argv[MAX_ARGS]; + size_t i = 0; + CLEANUP_FREE char *path_buf = NULL; + CLEANUP_FREE char *err = NULL; + CLEANUP_FREE char *out = NULL; + int r; + int64_t ret; + + path_buf = sysroot_path (path); + if (path_buf == NULL) { + reply_with_perror ("malloc"); + return -1; + } + + ADD_ARG (argv, i, str_btrfs); + ADD_ARG (argv, i, "inspect"); + ADD_ARG (argv, i, "rootid"); + ADD_ARG (argv, i, path_buf); + ADD_ARG (argv, i, NULL); + + r = commandv (&out, &err, argv); + if (r == -1) { + reply_with_error ("%s: %s", path, err); + return -1; + } + + if (sscanf (out, "%" SCNi64, &ret) != 1) { + reply_with_error ("%s: could not parse rootid: %s.", argv[0], out); + return -1; + } + + return ret; +} diff --git a/generator/actions.ml b/generator/actions.ml index be55a68..f5c4c68 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -12392,6 +12392,21 @@ Recover the chunk tree of btrfs filesystem by scannning the devices one by one." longdesc = "\ Recover bad superblocks from good copies." }; + { defaults with + name = "btrfs_inspect_rootid"; + style = RInt64 "id", [Pathname "path"], []; + proc_nr = Some 446; + optional = Some "btrfs"; camel_name = "BTRFSInspectRootid"; + tests = [ + InitPartition, Always, TestRun ( + [["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; "NOARG"; ""; ""]; + ["mount"; "/dev/sda1"; "/"]; + ["btrfs_inspect_rootid"; "/"]]), []; + ]; + shortdesc = "get tree ID of the containing subvolume of path"; + longdesc = "\ +Get tree ID of the containing subvolume of path." }; + ] (* Non-API meta-commands available only in guestfish. diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index e5a135a..0187835 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -445 +446 -- 2.1.0
Hu Tao
2015-Jan-16 02:23 UTC
[Libguestfs] [PATCH 14/16] New API: btrfs_inspect_subvolid_resolve
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> --- daemon/btrfs.c | 41 +++++++++++++++++++++++++++++++++++++++++ generator/actions.ml | 16 ++++++++++++++++ src/MAX_PROC_NR | 2 +- 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index c6ca3c3..4a6871c 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1737,3 +1737,44 @@ do_btrfs_inspect_rootid (const char *path) return ret; } + +char * +do_btrfs_inspect_subvolid_resolve (int64_t id, const char *fs) +{ + const size_t MAX_ARGS = 64; + const char *argv[MAX_ARGS]; + size_t i = 0; + CLEANUP_FREE char *fs_buf = NULL; + CLEANUP_FREE char *err = NULL; + char *out; + size_t len; + int r; + char id_str[32]; + + fs_buf = sysroot_path (fs); + if (fs_buf == NULL) { + reply_with_perror ("malloc"); + return NULL; + } + + ADD_ARG (argv, i, str_btrfs); + ADD_ARG (argv, i, "inspect"); + ADD_ARG (argv, i, "subvolid-resolve"); + snprintf (id_str, sizeof id_str, "%" PRIi64, id); + ADD_ARG (argv, i, id_str); + ADD_ARG (argv, i, fs_buf); + ADD_ARG (argv, i, NULL); + + r = commandv (&out, &err, argv); + if (r == -1) { + reply_with_error ("%s: %s", fs, err); + return NULL; + } + + /* Trim trailing '\n' */ + len = strlen (out); + if (len > 0 && out[len-1] == '\n') + out[len-1] = '\0'; + + return out; +} diff --git a/generator/actions.ml b/generator/actions.ml index f5c4c68..56071cc 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -12407,6 +12407,22 @@ Recover bad superblocks from good copies." }; longdesc = "\ Get tree ID of the containing subvolume of path." }; + { defaults with + name = "btrfs_inspect_subvolid_resolve"; + style = RString "path", [Int64 "id"; Pathname "fs"], []; + proc_nr = Some 447; + optional = Some "btrfs"; camel_name = "BTRFSInspectSubvolIdResolve"; + tests = [ + InitPartition, Always, TestRun ( + [["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; "NOARG"; ""; ""]; + ["mount"; "/dev/sda1"; "/"]; + ["btrfs_subvolume_create"; "/sub1"; "NOARG"]; + ["btrfs_inspect_subvolid_resolve"; "256"; "/"]]), []; + ]; + shortdesc = "get path for the given subvolume ID"; + longdesc = "\ +Get path on a btrfs filesystem for the given subvolume ID." }; + ] (* Non-API meta-commands available only in guestfish. diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index 0187835..e9b7520 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -446 +447 -- 2.1.0
Hu Tao
2015-Jan-16 02:23 UTC
[Libguestfs] [PATCH 15/16] New API: btrfs_inspect_inode_resolve
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> --- daemon/btrfs.c | 41 +++++++++++++++++++++++++++++++++++++++++ generator/actions.ml | 15 +++++++++++++++ src/MAX_PROC_NR | 2 +- 3 files changed, 57 insertions(+), 1 deletion(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 4a6871c..7f06c74 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1778,3 +1778,44 @@ do_btrfs_inspect_subvolid_resolve (int64_t id, const char *fs) return out; } + +char * +do_btrfs_inspect_inode_resolve (int64_t inode, const char *fs) +{ + const size_t MAX_ARGS = 64; + const char *argv[MAX_ARGS]; + size_t i = 0; + CLEANUP_FREE char *fs_buf = NULL; + CLEANUP_FREE char *err = NULL; + char *out; + size_t len; + int r; + char inode_str[32]; + + fs_buf = sysroot_path (fs); + if (fs_buf == NULL) { + reply_with_perror ("malloc"); + return NULL; + } + + ADD_ARG (argv, i, str_btrfs); + ADD_ARG (argv, i, "inspect"); + ADD_ARG (argv, i, "inode-resolve"); + snprintf (inode_str, sizeof inode_str, "%" PRIi64, inode); + ADD_ARG (argv, i, inode_str); + ADD_ARG (argv, i, fs_buf); + ADD_ARG (argv, i, NULL); + + r = commandv (&out, &err, argv); + if (r == -1) { + reply_with_error ("%s: %s", fs, err); + return NULL; + } + + /* Trim trailing '\n' */ + len = strlen (out); + if (len > 0 && out[len-1] == '\n') + out[len-1] = '\0'; + + return out; +} diff --git a/generator/actions.ml b/generator/actions.ml index 56071cc..a194f01 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -12423,6 +12423,21 @@ Get tree ID of the containing subvolume of path." }; longdesc = "\ Get path on a btrfs filesystem for the given subvolume ID." }; + { defaults with + name = "btrfs_inspect_inode_resolve"; + style = RString "path", [Int64 "inode"; Pathname "fs"], []; + proc_nr = Some 448; + optional = Some "btrfs"; camel_name = "BTRFSInspectInodeResolve"; + tests = [ + InitPartition, Always, TestRun ( + [["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; "NOARG"; ""; ""]; + ["mount"; "/dev/sda1"; "/"]; + ["btrfs_inspect_inode_resolve"; "256"; "/"]]), []; + ]; + shortdesc = "get path for the given inode"; + longdesc = "\ +Get path on a btrfs filesystem for the given inode." }; + ] (* Non-API meta-commands available only in guestfish. diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index e9b7520..5379c47 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -447 +448 -- 2.1.0
Hu Tao
2015-Jan-16 02:23 UTC
[Libguestfs] [PATCH 16/16] New API: btrfs_inspect_logical_resolve
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> --- daemon/btrfs.c | 41 +++++++++++++++++++++++++++++++++++++++++ generator/actions.ml | 10 ++++++++++ src/MAX_PROC_NR | 2 +- 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 7f06c74..c19f690 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1819,3 +1819,44 @@ do_btrfs_inspect_inode_resolve (int64_t inode, const char *fs) return out; } + +char * +do_btrfs_inspect_logical_resolve (int64_t logical, const char *fs) +{ + const size_t MAX_ARGS = 64; + const char *argv[MAX_ARGS]; + size_t i = 0; + CLEANUP_FREE char *fs_buf = NULL; + CLEANUP_FREE char *err = NULL; + char *out; + size_t len; + int r; + char logical_str[32]; + + fs_buf = sysroot_path (fs); + if (fs_buf == NULL) { + reply_with_perror ("malloc"); + return NULL; + } + + ADD_ARG (argv, i, str_btrfs); + ADD_ARG (argv, i, "inspect"); + ADD_ARG (argv, i, "logical-resolve"); + snprintf (logical_str, sizeof logical_str, "%" PRIi64, logical); + ADD_ARG (argv, i, logical_str); + ADD_ARG (argv, i, fs_buf); + ADD_ARG (argv, i, NULL); + + r = commandv (&out, &err, argv); + if (r == -1) { + reply_with_error ("%s: %s", fs, err); + return NULL; + } + + /* Trim trailing '\n' */ + len = strlen (out); + if (len > 0 && out[len-1] == '\n') + out[len-1] = '\0'; + + return out; +} diff --git a/generator/actions.ml b/generator/actions.ml index a194f01..4de55d0 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -12438,6 +12438,16 @@ Get path on a btrfs filesystem for the given subvolume ID." }; longdesc = "\ Get path on a btrfs filesystem for the given inode." }; + { defaults with + name = "btrfs_inspect_logical_resolve"; + style = RString "path", [Int64 "logical"; Pathname "fs"], []; + proc_nr = Some 449; + optional = Some "btrfs"; camel_name = "BTRFSInspectLogicalResolve"; + test_excuse = "can't determine a valid logical address for test"; + shortdesc = "get path for the given logical address"; + longdesc = "\ +Get path on a btrfs filesystem for the logical address." }; + ] (* Non-API meta-commands available only in guestfish. diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index 5379c47..2b20fd0 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -448 +449 -- 2.1.0
Richard W.M. Jones
2015-Jan-21 13:58 UTC
Re: [Libguestfs] [PATCH 00/16] btrfs: add support to btrfs scrub, balance, rescue and inspect
On Fri, Jan 16, 2015 at 10:23:35AM +0800, Hu Tao wrote: [...] Thanks for these patches. I will push all of them shortly *except*:> New API: btrfs_balance_status > New API: btrfs_scrub_status- These ones currently dump the status into a string. Generally it's better (although a huge pain) to translate the output of the commands into structures. The reason is that if we don't do this then we end up pushing parsing to every consumer of libguestfs.> New API: btrfs_inspect_rootid > New API: btrfs_inspect_subvolid_resolve > New API: btrfs_inspect_inode_resolve > New API: btrfs_inspect_logical_resolveIn my version of btrfs, 'btrfs inspect' does not exist, but 'btrfs inspect-internal' does exist. This appears to indicate that these APIs are for internal use and not general consumption. But I'm no expert -- if you can point to some official btrfs information which says that these btrfs APIs are OK for general consumption and will be supported for a long time, then we can use them. Thanks, Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
Hu Tao
2015-Jan-27 01:24 UTC
Re: [Libguestfs] [PATCH 00/16] btrfs: add support to btrfs scrub, balance, rescue and inspect
On Wed, Jan 21, 2015 at 01:58:02PM +0000, Richard W.M. Jones wrote:> On Fri, Jan 16, 2015 at 10:23:35AM +0800, Hu Tao wrote: > [...] > > Thanks for these patches. I will push all of them shortly *except*:Thanks!> > > New API: btrfs_balance_status > > New API: btrfs_scrub_status > > - These ones currently dump the status into a string. Generally it's > better (although a huge pain) to translate the output of the commands > into structures. The reason is that if we don't do this then we end > up pushing parsing to every consumer of libguestfs.I'll redo these two.> > > New API: btrfs_inspect_rootid > > New API: btrfs_inspect_subvolid_resolve > > New API: btrfs_inspect_inode_resolve > > New API: btrfs_inspect_logical_resolve > > In my version of btrfs, 'btrfs inspect' does not exist, but 'btrfs > inspect-internal' does exist. This appears to indicate that these > APIs are for internal use and not general consumption. But I'm no > expert -- if you can point to some official btrfs information which > says that these btrfs APIs are OK for general consumption and will be > supported for a long time, then we can use them.Sorry for confusing! 'btrfs inspect' is short for 'btrfs inspect-internal'. I'll resend these patches with the complete command name. Regards, Hu> > Thanks, > Rich. > > -- > Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones > Read my programming and virtualization blog: http://rwmj.wordpress.com > libguestfs lets you edit virtual machines. Supports shell scripting, > bindings from many languages. http://libguestfs.org
Seemingly Similar Threads
- Re: [PATCH 00/16] btrfs: add support to btrfs scrub, balance, rescue and inspect
- Re: [PATCH 00/16] btrfs: add support to btrfs scrub, balance, rescue and inspect
- [PATCH 00/16] btrfs: add support to btrfs scrub, balance, rescue and inspect
- Re: [PATCH 00/16] btrfs: add support to btrfs scrub, balance, rescue and inspect
- [PATCH v5 0/2] add btrfs_balance_status and btrfs_scrub_status