Author: adrian.chadd
Date: Mon Jul 13 05:28:16 2009
New Revision: 14191
Added:
playpen/LUSCA_HEAD_storework/app/coss_newfs/
playpen/LUSCA_HEAD_storework/app/coss_newfs/coss_newfs.c
playpen/LUSCA_HEAD_storework/app/coss_rebuild/
playpen/LUSCA_HEAD_storework/app/coss_rebuild/coss_build_dir.c
playpen/LUSCA_HEAD_storework/app/coss_rebuild/coss_build_log.c
playpen/LUSCA_HEAD_storework/app/coss_rebuild/coss_rebuild.c
Modified:
playpen/LUSCA_HEAD_storework/app/Makefile.am
playpen/LUSCA_HEAD_storework/configure.in
Log:
Begin fleshing out some placeholder programs for COSS.
I'll implement the "cachedir" COSS rebuild bit purely because it'll be a
complete,
verbatim rip from the current COSS storedir code.
Fixing up the COSS code to rebuild from a logfile will take a little more
effort.
Modified: playpen/LUSCA_HEAD_storework/app/Makefile.am
==============================================================================
--- playpen/LUSCA_HEAD_storework/app/Makefile.am (original)
+++ playpen/LUSCA_HEAD_storework/app/Makefile.am Mon Jul 13 05:28:16 2009
@@ -3,6 +3,6 @@
# $Id: Makefile.am 12826 2008-06-08 13:51:32Z adrian.chadd $
#
-DIST_SUBDIRS = tcptest ufs_rebuild ufs_newfs
-SUBDIRS = tcptest ufs_rebuild ufs_newfs
+DIST_SUBDIRS = tcptest ufs_rebuild ufs_newfs coss_newfs coss_rebuild
+SUBDIRS = tcptest ufs_rebuild ufs_newfs coss_newfs coss_rebuild
Added: playpen/LUSCA_HEAD_storework/app/coss_newfs/coss_newfs.c
==============================================================================
--- (empty file)
+++ playpen/LUSCA_HEAD_storework/app/coss_newfs/coss_newfs.c Mon Jul 13
05:28:16 2009
@@ -0,0 +1,66 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "include/config.h"
+#include "include/util.h"
+
+#include "libcore/tools.h"
+#include "libcore/varargs.h"
+#include "libsqdebug/debug.h"
+
+int shutting_down = 0; /* needed for debug routines for now */
+
+/*
+ * Args: /path/to/cossdir <size> <stripesize>
+ *
+ * All arguments are in megabytes for now.
+ */
+int
+main(int argc, const char *argv[])
+{
+ size_t sz, stripe_sz;
+ const char *path;
+ size_t i;
+ int fd;
+ char buf[256];
+ int r;
+
+ path = argv[1];
+
+ sz = atoi(argv[2]) * 1024;
+ stripe_sz = atoi(argv[3]) * 1024;
+
+ /*
+ * For now, just write 256 bytes of NUL's into the beginning of
+ * each stripe. COSS doesn't really have an on-disk format
+ * that leads itself to anything newfs-y quite yet. The NULs
+ * -should- be enough to trick the rebuild process into treating
+ * the rest of that stripe as empty.
+ */
+ fd = open(path, O_WRONLY | O_CREAT);
+ 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);
+ if (r < 0) {
+ perror("lseek");
+ exit(127);
+ }
+ r = write(fd, buf, sizeof(buf));
+ if (r < 0) {
+ perror("lseek");
+ exit(127);
+ }
+ }
+
+ close(fd);
+
+ exit(0);
+}
Added: playpen/LUSCA_HEAD_storework/app/coss_rebuild/coss_build_dir.c
==============================================================================
Added: playpen/LUSCA_HEAD_storework/app/coss_rebuild/coss_build_log.c
==============================================================================
Added: playpen/LUSCA_HEAD_storework/app/coss_rebuild/coss_rebuild.c
==============================================================================
Modified: playpen/LUSCA_HEAD_storework/configure.in
==============================================================================
--- playpen/LUSCA_HEAD_storework/configure.in (original)
+++ playpen/LUSCA_HEAD_storework/configure.in Mon Jul 13 05:28:16 2009
@@ -3311,6 +3311,8 @@
AC_OUTPUT([\
Makefile \
app/Makefile \
+ app/coss_newfs/Makefile \
+ app/coss_rebuild/Makefile \
app/ufs_rebuild/Makefile \
app/ufs_newfs/Makefile \
app/tcptest/Makefile \
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---