Also convert to using kvm for testing - much faster.
Signed-off-by: NeilBrown <neilb@suse.de>
else
KERNELDIR := /home/src/lafs-2.6.27
+KERNELDIR := /home/src/lafs-2.6.34/OBJ
all::
$(MAKE) -C $(KERNELDIR) ARCH=i386 M=`pwd`
nm lafs.o | grep ' T ' | grep -v lafs_
#include "lafs.h"
#include <linux/buffer_head.h> /* for try_to_release_page */
+#include <linux/slab.h>
/*
* Data blocks are stored in a regular address space for the
* relevant file. A page may have multiple datablocks, but
* addressing for 2^16 entries, which is probably more than we need
*/
-#include "lafs.h"
-#include <linux/random.h>
+#include "lafs.h"
+#include <linux/random.h>
+#include <linux/slab.h>
static void cluster_flush(struct fs *fs, int cnum);
*/
#include "lafs.h"
+#include <linux/slab.h>
#define S_SHIFT 12
if (!b0 || redirty)
return 0;
- if (wbc->for_writepages && LAFSI(ino)->depth == 0) {
+ if (LAFSI(ino)->depth == 0) {
/* We really want the data to be safe soon, not just
* the page to be clean. And the data is in the inode.
* So write the inode.
#include "lafs.h"
#include <linux/types.h>
#include <linux/hash.h>
+#include <linux/slab.h>
/*
* For each index-block there is an 'indexblock' data structure,
* and a 'block' of memory, which is a page or part there-of.
len -= target*6;
len -= 6;
next++;
- *nextp = ~0UL;
+ *nextp = 0xffffffff;
while (len >= 6) {
p2 = decode48(buf);
if (p2) {
if (nextp) {
if (lo == len/12)
- *nextp = ~0UL; /* next extent */
+ *nextp = 0xffffffff; /* next extent */
else {
u64 p2;
p2 = decode48(cp);
elen = decode16(cp);
addr = decode32(cp);
if (elen == 0)
- *nextp = ~0UL; /* no more meaningful
+ *nextp = 0xffffffff; /* no more meaningful
extents*/
else
*nextp = addr;
struct timespec now = CURRENT_TIME;
l->flags = cpu_to_le16(0);
- l->userid = cpu_to_le32(current->fsuid);
+ l->userid = cpu_to_le32(current->cred->fsuid);
if (dir && (dir->i_mode & S_ISGID)) {
l->groupid = cpu_to_le32(dir->i_gid);
if (type == TypeDir)
mode |= S_ISGID;
} else
- l->groupid = cpu_to_le32(current->fsgid);
+ l->groupid = cpu_to_le32(current->cred->fsgid);
if (LAFSI(dir)->md.file.treeid)
l->treeid = cpu_to_le32(LAFSI(dir)->md.file.treeid);
else
struct completion event;
int ret;
- rw |= (1 << BIO_RW_SYNC);
+ rw |= (1 << BIO_RW_UNPLUG);
bio->bi_bdev = bdev;
bio->bi_sector = sector;
{
struct bio *bio = bio_alloc(GFP_NOIO, 1);
- rw |= (1 << BIO_RW_SYNC);
+ rw |= (1 << BIO_RW_UNPLUG);
bio->bi_bdev = bdev;
bio->bi_sector = sector;
lafs_super_write(struct fs *fs, int dev, u64 addr, char *buf, int size)
{
struct bio *bio = bio_alloc(GFP_NOIO, 1);
- int rw = WRITE | (1 << BIO_RW_SYNC);
+ int rw = WRITE | (1 << BIO_RW_UNPLUG);
bio->bi_bdev = fs->devs[dev].sb->s_bdev;
bio->bi_sector = addr;
? add_extent : add_indirect,
&layout);
break;
+ default: BUG();
}
- dprintk("walk_leaf only got as far as %d\n", (int)next);
+ dprintk("walk_leaf only got as far as %d\n", (int)layout.nextaddr);
// print_index(ibuf+offset, ib->b.fileaddr, len);
if (ok) {
/* it all fit perfectly.
if (slen && layout.data > sbuf) {
printk("slen=%d ld-sb=%d layout.data=%p sbuf=%p "
"buf=%p ibuf=%p len=%d\n",
- slen, layout.data-sbuf, layout.data, sbuf,
+ slen, (int)(layout.data-sbuf), layout.data, sbuf,
buf, ibuf, len);
}
LAFS_BUG(slen && layout.data > sbuf, &ib->b);
*/
#include "lafs.h"
+#include <linux/slab.h>
static int
roll_valid(struct fs *fs, struct cluster_head *ch, unsigned long long addr)
* on the segment summary block through this structure
*/
-#include "lafs.h"
-#include <linux/hash.h>
-#include <linux/random.h>
+#include "lafs.h"
+#include <linux/hash.h>
+#include <linux/random.h>
+#include <linux/slab.h>
struct segsum {
u32 segnum;
#include <linux/statfs.h>
#include <linux/mount.h>
#include <linux/exportfs.h>
+#include <linux/slab.h>
static struct super_operations lafs_sops;
static const struct export_operations lafs_export_ops;
BUG_ON(dv->devblock);
BUG_ON(dv->stateblock);
- n = queue_hardsect_size(sb->s_bdev->bd_disk->queue);
+ n = queue_logical_block_size(sb->s_bdev->bd_disk->queue);
if (n < LAFS_DEVBLK_SIZE)
n = LAFS_DEVBLK_SIZE;
BUG_ON(n > PAGE_SIZE);
*/
n = le32_to_cpu(1<<dv->devblock->statebits);
if ((n & (n-1)) ||
- n < queue_hardsect_size(sb->s_bdev->bd_disk->queue) ||
+ n < queue_logical_block_size(sb->s_bdev->bd_disk->queue) ||
n > 128*1024) {
printk(KERN_ERR "LaFS: statesize of %u not acceptable.\n", n);
err = -EINVAL;
{
ino_t inum = LAFSI(child->d_inode)->md.file.parent;
struct inode *inode = lafs_iget(child->d_inode->i_sb, inum, SYNC);
- struct dentry *parent;
if (IS_ERR(inode))
return ERR_CAST(inode);
- parent = d_alloc_anon(inode);
- if (!parent) {
- iput(inode);
- parent = ERR_PTR(-ENOMEM);
- }
- return parent;
+ return d_obtain_alias(inode);
}
static const struct export_operations lafs_export_ops = {
return strlen(buffer);
}
-module_param_call(dump, do_dump, get_dump, 0, 0775);
+int arg;
+module_param_call(dump, do_dump, get_dump, &arg, 0775);
#endif
rmmod lafs.ko
tftp 10.0.2.2 -m binary -c get /lafs.ko
insmod lafs.ko lafs_trace=0
-#mount -r -t lafs -o 'dev=/dev/hdc' /dev/hdb /mnt/1
-mount -t lafs /dev/hdb /mnt/1
+#mount -r -t lafs -o 'dev=/dev/sdc' /dev/sdb /mnt/1
+mount -t lafs /dev/sdb /mnt/1
#mount -r -t lafs_snap -o snapshot=first /mnt/1 /mnt/2
#mount -r -t lafs_snap -o snapshot=second /mnt/1 /mnt/3
#mount -r -t lafs -o 'snapshot=first /mnt/1 /mnt/2
ls /mnt/1;
ls -ia /mnt/1
-#mount /dev/hdb /mnt/2
+#mount /dev/sdb /mnt/2
#cat /mnt/1/17
md5sum /mnt/1/afile
echo 'db53....4f6a'
ln -s $dir /tmp/tftp
# -serial stdio or -nographic
# change tty choice in 'go' too.
-qemu -hda hda -hdb $dir/../../code2/fred -hdc $dir/../../code2/frog \
+kvm -hda hda -hdb $dir/../../code2/fred -hdc $dir/../../code2/frog \
-no-reboot \
-net nic,model=ne2k_pci -net user \
-m 256 -nographic \
- -kernel /home/src/lafs-2.6.27/arch/i386/boot/bzImage \
- -append "root=/dev/hda1 console=ttyS0" -tftp /tmp/tftp
+ -kernel /home/src/lafs-2.6.34/OBJ/arch/x86/boot/bzImage \
+ -append "root=/dev/sda1 console=ttyS0" -tftp /tmp/tftp