Author: adrian.chadd
Date: Wed Jul 15 23:58:51 2009
New Revision: 14195

Modified:
    playpen/LUSCA_HEAD_storework/app/coss_newfs/coss_newfs.c

Log:
Fiddle some more with the coss newfs stuff.



Modified: playpen/LUSCA_HEAD_storework/app/coss_newfs/coss_newfs.c
==============================================================================
--- playpen/LUSCA_HEAD_storework/app/coss_newfs/coss_newfs.c    (original)
+++ playpen/LUSCA_HEAD_storework/app/coss_newfs/coss_newfs.c    Wed Jul 15  
23:58:51 2009
@@ -16,9 +16,7 @@
  int shutting_down = 0;        /* needed for debug routines for now */

  /*
- * Args: /path/to/cossdir <size> <stripesize>
- *
- * All arguments are in megabytes for now.
+ * Args: /path/to/cossdir <number of stripes> <stripesize>
   */
  int
  main(int argc, const char *argv[])
@@ -28,12 +26,16 @@
        size_t i;
        int fd;
        char buf[256];
-       int r;
+       off_t r;
+
+        /* Setup the debugging library */
+        _db_init("ALL,1");
+        _db_set_stderr_debug(1);

-       path = argv[1];

-       sz = atoi(argv[2]) * 1024;
-       stripe_sz = atoi(argv[3]) * 1024;
+       path = argv[1];
+       sz = atoi(argv[2]);
+       stripe_sz = atoi(argv[3]);

        /*
         * For now, just write 256 bytes of NUL's into the beginning of
@@ -42,22 +44,24 @@
         * -should- be enough to trick the rebuild process into treating
         * the rest of that stripe as empty.
         */
-       fd = open(path, O_WRONLY | O_CREAT);
+       fd = open(path, O_WRONLY | O_CREAT, 0644);
        if (fd < 0) {
                perror("open");
                exit(127);
        }
        bzero(buf, sizeof(buf));

-       for (i = 0; i < sz; i += stripe_sz) {
-               r = lseek(fd, i, SEEK_SET);
+       for (i = 0; i < sz; i += 1) {
+               getCurrentTime();
+               debug(85, 5) ("seeking to stripe %d\n", i);
+               r = lseek(fd, (off_t) i * (off_t) stripe_sz, SEEK_SET);
                if (r < 0) {
                        perror("lseek");
                        exit(127);
                }
                r = write(fd, buf, sizeof(buf));
                if (r < 0) {
-                       perror("lseek");
+                       perror("write");
                        exit(127);
                }
        }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to