[PATCH 1/2] TODO: add note for libblkid
Add the note about compatible in TODO for libblkid. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> --- TODO | 3 +++ 1 file changed, 3 insertions(+) diff --git a/TODO b/TODO index 3955552..d604d10 100644 --- a/TODO +++ b/TODO @@ -192,6 +192,9 @@ would make more sense to just use libblkid for this. There are some places where we call out to the 'blkid' program. This might be replaced by direct use of the library (if this is easier). +But it is very hard to be compatible between RHEL6 and RHEL5 when +using direct library. + Visualization ------------- -- 1.7.10
Add the NEW API btrfs-tune to support the seeding-device feature for btrfs. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> --- daemon/btrfs.c | 19 +++++++++++++++++++ generator/generator_actions.ml | 10 ++++++++++ src/MAX_PROC_NR | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index b0218bc..c5dfd48 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -600,3 +600,22 @@ do_btrfs_device_delete (char *const *devices, const char *fs) return 0; } + +int +do_btrfs_tune (int svalue, const char *device) +{ + char *err; + int r; + + const char *s_value = svalue ? "1" : "0"; + + r = commandr (NULL, &err, "btrfstune", "-S", s_value, device, NULL); + if (r == -1) { + reply_with_error ("%s: %s", device, err); + free (err); + return -1; + } + + free (err); + return r; +} diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml index 6948dab..b898c7a 100644 --- a/generator/generator_actions.ml +++ b/generator/generator_actions.ml @@ -7222,6 +7222,16 @@ mounted at C<fs>. If C<devices> is an empty list, this does nothing."); Remove the C<devices> from the btrfs filesystem mounted at C<fs>. If C<devices> is an empty list, this does nothing."); + ("btrfs_tune", (RErr, [Bool "svalue"; Device "device"], []), 331, [], + [InitPartition, IfAvailable "btrfs", TestRun ( + [["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; "NOARG"; ""; ""]; + ["btrfs_tune"; "true"; "/dev/sda1"]; + ["btrfs_tune"; "false"; "/dev/sda1"]])], + "enable/disable seeding feature of device", + "\ +Enable or disable the seeding feature of device which with btrfs +filesystem on it."); + ] let all_functions = non_daemon_functions @ daemon_functions diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index db2cef5..ec6cab0 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -330 +331 -- 1.7.10
On Mon, May 14, 2012 at 06:38:25PM +0800, Wanlong Gao wrote:
Add the NEW API btrfs-tune to support the seeding-device feature for btrfs.
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> --- daemon/btrfs.c | 19 +++++++++++++++++++ generator/generator_actions.ml | 10 ++++++++++ src/MAX_PROC_NR | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c index b0218bc..c5dfd48 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -600,3 +600,22 @@ do_btrfs_device_delete (char *const *devices, const char *fs)
return 0; } + +int +do_btrfs_tune (int svalue, const char *device) +{ + char *err; + int r; + + const char *s_value = svalue ? "1" : "0"; + + r = commandr (NULL, &err, "btrfstune", "-S", s_value, device, NULL); + if (r == -1) { + reply_with_error ("%s: %s", device, err); + free (err); + return -1; + } + + free (err); + return r; +} diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml index 6948dab..b898c7a 100644 --- a/generator/generator_actions.ml +++ b/generator/generator_actions.ml @@ -7222,6 +7222,16 @@ mounted at C<fs>. If C<devices> is an empty list, this does nothing."); Remove the C<devices> from the btrfs filesystem mounted at C<fs>. If C<devices> is an empty list, this does nothing.");
+ ("btrfs_tune", (RErr, [Bool "svalue"; Device "device"], []), 331, [], + [InitPartition, IfAvailable "btrfs", TestRun ( + [["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; "NOARG"; ""; ""]; + ["btrfs_tune"; "true"; "/dev/sda1"]; + ["btrfs_tune"; "false"; "/dev/sda1"]])], + "enable/disable seeding feature of device", + "\ +Enable or disable the seeding feature of device which with btrfs +filesystem on it."); + ]
let all_functions = non_daemon_functions @ daemon_functions diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index db2cef5..ec6cab0 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -330 +331
Thanks. This is fine and I will push it shortly. However I made a few small changes: * I renamed it 'btrfs-set-seeding', since the 'btrfstune' program doesn't have any other options, and we may want to add a 'btrfs-get-seeding' function in future. * I changed the order of the parameters: device, boolean Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v
On 05/14/2012 08:18 PM, Richard W.M. Jones wrote:
On Mon, May 14, 2012 at 06:38:25PM +0800, Wanlong Gao wrote:
Add the NEW API btrfs-tune to support the seeding-device feature for btrfs.
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> --- daemon/btrfs.c | 19 +++++++++++++++++++ generator/generator_actions.ml | 10 ++++++++++ src/MAX_PROC_NR | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c index b0218bc..c5dfd48 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -600,3 +600,22 @@ do_btrfs_device_delete (char *const *devices, const char *fs)
return 0; } + +int +do_btrfs_tune (int svalue, const char *device) +{ + char *err; + int r; + + const char *s_value = svalue ? "1" : "0"; + + r = commandr (NULL, &err, "btrfstune", "-S", s_value, device, NULL); + if (r == -1) { + reply_with_error ("%s: %s", device, err); + free (err); + return -1; + } + + free (err); + return r; +} diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml index 6948dab..b898c7a 100644 --- a/generator/generator_actions.ml +++ b/generator/generator_actions.ml @@ -7222,6 +7222,16 @@ mounted at C<fs>. If C<devices> is an empty list, this does nothing."); Remove the C<devices> from the btrfs filesystem mounted at C<fs>. If C<devices> is an empty list, this does nothing.");
+ ("btrfs_tune", (RErr, [Bool "svalue"; Device "device"], []), 331, [], + [InitPartition, IfAvailable "btrfs", TestRun ( + [["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; "NOARG"; ""; ""]; + ["btrfs_tune"; "true"; "/dev/sda1"]; + ["btrfs_tune"; "false"; "/dev/sda1"]])], + "enable/disable seeding feature of device", + "\ +Enable or disable the seeding feature of device which with btrfs +filesystem on it."); + ]
let all_functions = non_daemon_functions @ daemon_functions diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index db2cef5..ec6cab0 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -330 +331
Thanks. This is fine and I will push it shortly.
However I made a few small changes:
* I renamed it 'btrfs-set-seeding', since the 'btrfstune' program doesn't have any other options, and we may want to add a 'btrfs-get-seeding' function in future.
* I changed the order of the parameters: device, boolean
Yeah, it seems better, thank you. ;) Wanlong Gao
Rich.
On Mon, May 14, 2012 at 06:38:24PM +0800, Wanlong Gao wrote:
Add the note about compatible in TODO for libblkid.
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> --- TODO | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/TODO b/TODO index 3955552..d604d10 100644 --- a/TODO +++ b/TODO @@ -192,6 +192,9 @@ would make more sense to just use libblkid for this. There are some places where we call out to the 'blkid' program. This might be replaced by direct use of the library (if this is easier).
+But it is very hard to be compatible between RHEL6 and RHEL5 when +using direct library. + Visualization -------------
-- 1.7.10
Pushed, thanks. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top
participants (2)
-
Richard W.M. Jones -
Wanlong Gao