Re: Network block device... some questions

Pavel Machek (pavel@bug.ucw.cz)
Fri, 4 Dec 1998 22:05:49 +0100


Hi!

> Furtheron we intended to use Your NBD to create a distributed Raid 5
> system over several cluster nodes (a crazy idea but why not
> using the clusternodes also for a "distributed, reliable, high
> perfomance and fault tolerant" filesystem. (by the way saving the
> investments for
> expensive Raid-Hardware).
> OK, this idea based on a discussion in the Linux-Raid newsgroup with
> serveral coments sounding like: "it should work"...

Ook, try this patch. With it, I was able to create and run raid5 for a
short while (then it deadlocked - it is bad idea to write to
loopback-mounted device). Please test.

Pavel

PS: See my prev. mails into linux-raid for small oops-fix and why
raidtools need fixing a bit.

--- clean//drivers/block/nbd.c Fri Sep 11 20:54:23 1998
+++ linux/drivers/block/nbd.c Fri Dec 4 21:22:28 1998
@@ -44,8 +44,9 @@

#define LO_MAGIC 0x68797548

-static int nbd_blksizes[MAX_NBD] = {1024, 1024,};
-static int nbd_sizes[MAX_NBD] = {0x7fffffff, 0x7fffffff,};
+static int nbd_blksizes[MAX_NBD];
+static int nbd_sizes[MAX_NBD];
+static int nbd_bytesizes[MAX_NBD];

static struct nbd_device nbd_dev[MAX_NBD];

@@ -382,9 +383,11 @@
if ((arg & 511) || (arg > PAGE_SIZE))
return -EINVAL;
nbd_blksizes[dev] = arg;
+ nbd_sizes[dev] = arg/nbd_blksizes[dev];
return 0;
case NBD_SET_SIZE:
- nbd_sizes[dev] = arg;
+ nbd_bytesizes[dev] = arg;
+ nbd_sizes[dev] = arg/nbd_blksizes[dev];
return 0;
case NBD_DO_IT:
if (!lo->file)
@@ -400,6 +403,8 @@
dev, (long) lo->head, (long) lo->tail, requests_in, requests_out);
return 0;
#endif
+ case BLKGETSIZE:
+ return put_user(nbd_bytesizes[dev]/512, (long *) arg);
}
return -EINVAL;
}
@@ -472,6 +477,9 @@
nbd_dev[i].file = NULL;
nbd_dev[i].magic = LO_MAGIC;
nbd_dev[i].flags = 0;
+ nbd_blksizes[i] = 1024;
+ nbd_bytesizes[i] = 0x7fffffff;
+ nbd_sizes[i] = nbd_bytesizes[i]/nbd_blksizes[i];
}
return 0;
}

-- 
I'm really pavel@atrey.karlin.mff.cuni.cz. 	   Pavel
Look at http://atrey.karlin.mff.cuni.cz/~pavel/ ;-).

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/