Whamcloud - gitweb
- missed BKLs in ext3_ext_new_extent_cb()
[fs/lustre-release.git] / lustre / utils / lfs.c
index 4d3900e..71095ab 100644 (file)
@@ -41,6 +41,7 @@
 
 /* all functions */
 static int lfs_setstripe(int argc, char **argv);
+static int lfs_dirstripe(int argc, char **argv);
 static int lfs_find(int argc, char **argv);
 static int lfs_getstripe(int argc, char **argv);
 static int lfs_osts(int argc, char **argv);
@@ -55,7 +56,12 @@ command_t cmdlist[] = {
          "usage: setstripe <filename|dirname> <stripe size> <stripe start> <stripe count>\n"
          "\tstripe size:  Number of bytes in each stripe (0 default)\n"
          "\tstripe start: OST index of first stripe (-1 default)\n"
-         "\tstripe count: Number of OSTs to stripe over (0 default, -1 all)"},
+         "\tstripe count: Number of OSTs to stripe over (0 default)"},
+        {"dirstripe", lfs_dirstripe, 0,
+         "To create a new dir with a specific striping pattern.\n"
+         "usage: dirstripe <dirname> <stripe count> [<mds idx list>]\n"
+         "\tstripe count: Number of MDSes to stripe over (0 default)\n"
+         "\tmds idx list: List of MDS servers to contain the dir (not implemented)"},
         {"find", lfs_find, 0,
          "To list the extended attributes for a given filename or files in a\n"
          "directory or recursively for all files in a directory tree.\n"
@@ -120,6 +126,31 @@ static int lfs_setstripe(int argc, char **argv)
         return result;
 }
 
+static int lfs_dirstripe(int argc, char **argv)
+{
+        int result;
+        int st_count;
+        char *end;
+
+        if (argc != 3)
+                return CMD_HELP;
+
+        // get the stripe size
+        st_count = strtoul(argv[2], &end, 0);
+        if (*end != '\0') {
+                fprintf(stderr, "error: %s: bad count '%s'\n",
+                                argv[0], argv[2]);
+                return CMD_HELP;
+        }
+
+        result = op_create_dir(argv[1], st_count);
+        if (result)
+                fprintf(stderr, "error: %s: create stripe dir failed\n",
+                                argv[0]);
+
+        return result;
+}
+
 static int lfs_find(int argc, char **argv)
 {
         struct option long_opts[] = {