Merge remote branch 'origin/xseg' into demo
authorStratos Psomadakis <psomas@grnet.gr>
Fri, 23 Mar 2012 11:53:58 +0000 (13:53 +0200)
committerStratos Psomadakis <psomas@grnet.gr>
Fri, 23 Mar 2012 11:53:58 +0000 (13:53 +0200)
Conflicts:
xseg/tools/vlmc-blockd.py [trivial]

1  2 
xseg/peers/user/blockd.c
xseg/peers/user/filed.c
xseg/tools/helpers.sh

diff --combined xseg/peers/user/blockd.c
@@@ -134,8 -134,6 +134,8 @@@ static void fail(struct store *store, s
  
  static void pending(struct store *store, struct io *io)
  {
 +      if (verbose)
 +              log_io("pending", io);
        io->req->state = XS_PENDING;
        pending_io(store, io);
  }
@@@ -301,7 -299,7 +301,7 @@@ static int blockd_loop(struct store *st
                }
  
                if (!io && !accepted) 
-                       xseg_wait_signal(xseg, portno, 10000);
+                       xseg_wait_signal(xseg, 10000);
        }
  
        return 0;
@@@ -313,12 -311,12 +313,12 @@@ static struct xseg *join(char *spec
        struct xseg *xseg;
  
        (void)xseg_parse_spec(spec, &config);
-       xseg = xseg_join(config.type, config.name);
+       xseg = xseg_join(config.type, config.name, "posix", NULL);
        if (xseg)
                return xseg;
  
        (void)xseg_create(&config);
-       return xseg_join(config.type, config.name);
+       return xseg_join(config.type, config.name, "posix", NULL);
  }
  
  static int blockd(char *path, off_t size, uint32_t nr_ops,
@@@ -407,7 -405,7 +407,7 @@@ malloc_fail
        xq_init_seq(&store->free_ops, nr_ops, nr_ops, store->free_bufs);
        xq_init_empty(&store->pending_ops, nr_ops, store->pending_bufs);
  
-       if (xseg_initialize("posix")) {
+       if (xseg_initialize()) {
                printf("cannot initialize library\n");
                return -1;
        }
diff --combined xseg/peers/user/filed.c
@@@ -433,11 -433,8 +433,11 @@@ static void handle_accepted(struct stor
  static struct io* wake_up_next_iothread(struct store *store)
  {
        struct io *io = alloc_io(store);
 +
        if (io){        
 +              pthread_mutex_lock(&io->lock);
                pthread_cond_signal(&io->cond);
 +              pthread_mutex_unlock(&io->lock);
        }
        return io;
  }
@@@ -459,8 -456,8 +459,8 @@@ void *io_loop(void *arg
                        handle_accepted(store, io);
                }
                else {
 -                      free_io(store, io);
                        pthread_mutex_lock(&io->lock);
 +                      free_io(store, io);
                        pthread_cond_wait(&io->cond, &io->lock);
                        pthread_mutex_unlock(&io->lock);
                }
@@@ -475,13 -472,13 +475,13 @@@ static struct xseg *join(char *spec
        struct xseg *xseg;
  
        (void)xseg_parse_spec(spec, &config);
-       xseg = xseg_join(config.type, config.name);
+       xseg = xseg_join(config.type, config.name, "posix", NULL);
        if (xseg)
                return xseg;
  
        fprintf(stderr, "Failed to join xseg, creating it...\n");
        (void)xseg_create(&config);
-       return xseg_join(config.type, config.name);
+       return xseg_join(config.type, config.name, "posix", NULL);
  }
  
  static int filed_loop(struct store *store)
        for (;;) {
                io = wake_up_next_iothread(store);
                xseg_prepare_wait(xseg, portno);
-               xseg_wait_signal(xseg, portno, 10000);
+               xseg_wait_signal(xseg, 10000);
        }
        return 0;
  }
@@@ -590,7 -587,7 +590,7 @@@ malloc_fail
                return -1;
        }
  */
-       if (xseg_initialize("posix")) {
+       if (xseg_initialize()) {
                printf("cannot initialize library\n");
                return -1;
        }
diff --combined xseg/tools/helpers.sh
@@@ -13,27 -13,21 +13,27 @@@ function pretty_print 
        echo "======================="
  }
  
 +function fail {
 +      echo "${1}"
 +      exit 1
 +}
 +
  function parse_config {
        [ -e ~/.xsegrc ] && source ~/.xsegrc
  
        [ -n "${XSEG_HOME}" ] || XSEG_HOME="/root/archip/xseg/"
        [ -n "${MODULES_DIR}" ] || MODULES_DIR="${XSEG_HOME}/sys/"
-       [ -n "${SPEC}" ] || SPEC="xsegdev:xsegbd:128:8192:64:1024:12"
+       [ -n "${SPEC}" ] || SPEC="segdev:xsegbd:128:8192:64:1024:12"
        [ -n "${REQS}" ] || REQS=128
        [ -n "${PORTS}" ] || PORTS=128
        [ -n "${FILED_PORT}" ] || FILED_PORT=0
 -      [ -n "${IMAGES}" ] || IMAGES="/srv/pithos/archip-data/images/"
 +      [ -n "${IMAGES}" ] || IMAGES="/srv/archip/images/"
        [ -n "${BLOCKD_LOGS}" ] || BLOCKD_LOGS="/root/logs/"
        [ -n "${DEVICE_PREFIX}" ] || DEVICE_PREFIX="/dev/xsegbd"
        [ -n "${XSEGBD_SYSFS}" ] || XSEGBD_SYSFS="/sys/bus/xsegbd"
-       [ -n "${CHRDEV_NAME}" ] || CHRDEV_NAME="/dev/xsegdev"
+       [ -n "${CHRDEV_NAME}" ] || CHRDEV_NAME="/dev/segdev"
        [ -n "${CHRDEV_MAJOR}" ] || CHRDEV_MAJOR=60
 +      [ -n "${NR_OPS}" ] || NR_OPS=16
  }
  
  function unload_module {
@@@ -43,7 -37,8 +43,8 @@@
  function unload_all {
        unload_module "xsegbd"
        rm "${CHRDEV_NAME}"
-       unload_module "xsegdev"
+       unload_module "xseg_segdev"
+       unload_module "segdev"
        unload_module "xseg"
  }
  
@@@ -58,7 -53,8 +59,8 @@@ function mk_chardev 
  
  function load_all {
        load_module "xseg"
-       load_module "xsegdev"
+       load_module "segdev"
+       load_module "xseg_segdev"
        mk_chardev
        load_module "xsegbd" "spec=$SPEC"
  }
  # @param $1           target/volume name
  # @param $2           xseg port
  function spawn_blockd {
 -      "${XSEG_HOME}peers/blockd" "$1" -p "$2" -g "$SPEC" &> "${BLOCKD_LOGS}/$1"
 +      "${XSEG_HOME}peers/blockd" "$1" -p "$2" -g "$SPEC" -n ${NR_OPS} &> "${BLOCKD_LOGS}/$1" || fail "blockd"
  }
  
  function spawn_filed {
 -      "${XSEG_HOME}peers/filed" "$1" -p "$2" -g "${SPEC}" &> "${BLOCKD_LOGS}/filed-${HOSTNAME}" &
 +      "${XSEG_HOME}peers/filed" "$1" -p "$2" -g "${SPEC}" -n ${NR_OPS} &> "${BLOCKD_LOGS}/filed-${HOSTNAME}" &
  }
  
  # map_volume - Map a volume to an xsegbd device
  # @param $2           src port
  # @param $3           dst port
  function map_volume {
 -      echo "$1 $2:$3:${REQS}" > "${XSEGBD_SYSFS}add"
 +      echo "$1 $2:$3:${REQS}" > "${XSEGBD_SYSFS}add" || exit 1
  }
  
  # unmap_device - Unmap an xsegbd device/volume
  #
  # @param $1           xsegbd device id
  function unmap_device {
 -      echo "$1" > "${XSEGBD_SYSFS}remove"
 +      echo "$1" > "${XSEGBD_SYSFS}remove" || exit 1
  }