static void pending(struct store *store, struct io *io)
{
+ if (verbose)
+ log_io("pending", io);
io->req->state = XS_PENDING;
pending_io(store, io);
}
}
if (!io && !accepted)
- xseg_wait_signal(xseg, portno, 10000);
+ xseg_wait_signal(xseg, 10000);
}
return 0;
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,
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;
}
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;
}
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);
}
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;
}
return -1;
}
*/
- if (xseg_initialize("posix")) {
+ if (xseg_initialize()) {
printf("cannot initialize library\n");
return -1;
}
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 {
function unload_all {
unload_module "xsegbd"
rm "${CHRDEV_NAME}"
- unload_module "xsegdev"
+ unload_module "xseg_segdev"
+ unload_module "segdev"
unload_module "xseg"
}
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
}