[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH] mkfs: optimization and code cleanup



On 12/14/2011 12:29 AM, Wanlong Gao wrote:
Optimizations by reducing the STREQ operations and do some
code cleanup.

Signed-off-by: Wanlong Gao<gaowanlong cn fujitsu com>
---
  daemon/mkfs.c |   29 +++++++++++++----------------
  1 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/daemon/mkfs.c b/daemon/mkfs.c
index a2c2366..7757623 100644
--- a/daemon/mkfs.c
+++ b/daemon/mkfs.c

@@ -77,16 +78,13 @@ do_mkfs_opts (const char *fstype, const char *device, int blocksize,

    /* mkfs.reiserfs produces annoying interactive prompts unless you
     * tell it to be quiet.
+   * mkfs.jfs as the same

s/as/is/

+   * mkfs.xfs must force to make xfs filesystem when the device already
+   * has a filesystem on it
     */
-  if (STREQ (fstype, "reiserfs"))
-    ADD_ARG (argv, i, "-f");
-
-  /* Same for JFS. */
-  if (STREQ (fstype, "jfs"))
-    ADD_ARG (argv, i, "-f");
-
-  if (STREQ (fstype, "xfs"))
-    ADD_ARG (argv, i, "-f");
+  if (STREQ(fstype, "reiserfs") || STREQ(fstype, "jfs") ||
+      STREQ(fstype, "xfs"))
+    ADD_ARG(argv, i, "-f");

    /* For GFS, GFS2, assume a single node. */
    if (STREQ (fstype, "gfs") || STREQ (fstype, "gfs2")) {

Seems like an obvious improvement. ACK.

Matt
--
Matthew Booth, RHCA, RHCSS
Red Hat Engineering, Virtualisation Team

GPG ID:  D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]