[Pkg-libvirt-commits] [libguestfs] 105/384: New API: btrfs_quota_rescan

Hilko Bengen bengen at moszumanska.debian.org
Sun Mar 29 16:55:53 UTC 2015


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch experimental
in repository libguestfs.

commit 4e145bb44d5d58a70fc4cc8b0c199c6c29e6482e
Author: Hu Tao <hutao at cn.fujitsu.com>
Date:   Fri Dec 12 15:03:27 2014 +0800

    New API: btrfs_quota_rescan
    
    btrfs_quota_rescan trashs all qgroup numbers and scans the metadata
    again with the current config.
    
    Signed-off-by: Hu Tao <hutao at cn.fujitsu.com>
---
 daemon/btrfs.c       | 33 +++++++++++++++++++++++++++++++++
 generator/actions.ml | 21 +++++++++++++++++++++
 src/MAX_PROC_NR      |  2 +-
 3 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 2cc20b6..4eef131 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -1052,3 +1052,36 @@ error:
     return -1;
   return r;
 }
+
+int
+do_btrfs_quota_rescan (const mountable_t *fs)
+{
+  const size_t MAX_ARGS = 64;
+  const char *argv[MAX_ARGS];
+  size_t i = 0;
+  char *fs_buf = NULL;
+  CLEANUP_FREE char *err = NULL;
+  CLEANUP_FREE char *out = NULL;
+  int r = -1;
+
+  fs_buf = mount (fs);
+  if (fs_buf == NULL)
+    goto error;
+
+  ADD_ARG (argv, i, str_btrfs);
+  ADD_ARG (argv, i, "quota");
+  ADD_ARG (argv, i, "rescan");
+  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_buf, err);
+    goto error;
+  }
+
+error:
+  if (fs_buf && umount (fs_buf, fs) != 0)
+    return -1;
+  return r;
+}
diff --git a/generator/actions.ml b/generator/actions.ml
index e3d7434..9c61ff7 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -12110,6 +12110,27 @@ Return detailed information of the subvolume." };
     longdesc = "\
 Enable or disable subvolume quota support for filesystem which contains C<path>." };
 
+  { defaults with
+    name = "btrfs_quota_rescan";
+    style = RErr, [Mountable_or_Path "fs"], [];
+    proc_nr = Some 428;
+    optional = Some "btrfs"; camel_name = "BTRFSQuotaRescan";
+    tests = [
+      InitPartition, Always, TestRun (
+        [["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; "NOARG"; ""; ""];
+         ["btrfs_quota_enable"; "/dev/sda1"; "true"];
+         ["btrfs_quota_rescan"; "/dev/sda1"]]), [];
+      InitPartition, Always, TestRun (
+        [["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; "NOARG"; ""; ""];
+         ["mount"; "/dev/sda1"; "/"];
+         ["btrfs_quota_enable"; "/"; "true"];
+         ["btrfs_quota_rescan"; "/"]]), [];
+    ];
+
+    shortdesc = "trash all qgroup numbers and scan the metadata again with the current config";
+    longdesc = "\
+Trash all qgroup numbers and scan the metadata again with the current config." };
+
 ]
 
 (* Non-API meta-commands available only in guestfish.
diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR
index d2a1e59..43d371a 100644
--- a/src/MAX_PROC_NR
+++ b/src/MAX_PROC_NR
@@ -1 +1 @@
-427
+428

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list