]> git.neil.brown.name Git - LaFS.git/commitdiff
Forward port to 2.6.34
authorNeilBrown <neilb@suse.de>
Fri, 16 Jul 2010 09:00:39 +0000 (11:00 +0200)
committerNeilBrown <neilb@suse.de>
Sun, 25 Jul 2010 05:34:27 +0000 (15:34 +1000)
Also convert to using kvm for testing - much faster.

Signed-off-by: NeilBrown <neilb@suse.de>
14 files changed:
Makefile
block.c
cluster.c
dir.c
file.c
index.c
inode.c
io.c
modify.c
roll.c
segments.c
super.c
test/go
test/runtty

index 1c3f1220bbe59ff6327f283e7e701ff9eeda5df4..11c5ad189ae35b6300965d847f19821a01e50abc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,7 @@ lafs-y := super.o io.o roll.o dir.o inode.o index.o block.o file.o link.o dir-av
 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_
diff --git a/block.c b/block.c
index 80e7299f3906ea4e2a85e5625ce6ee6f6cb81cbe..529db5e4fb199d6425c5d02152dca17e2e823a1d 100644 (file)
--- a/block.c
+++ b/block.c
@@ -9,6 +9,7 @@
 
 #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
index 528193d3d41ffbc9a88e626e0709b2238cc8780b..826be74d9f18a9b871330c974bafdf7898dcadf2 100644 (file)
--- a/cluster.c
+++ b/cluster.c
@@ -41,8 +41,9 @@
  * 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);
 
diff --git a/dir.c b/dir.c
index 409ecc2c9b2ca101343d57cb4d610dd726aad920..a4f862d828251cccd44dea054fd4b56c241437e8 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -9,6 +9,7 @@
  */
 
 #include       "lafs.h"
+#include       <linux/slab.h>
 
 #define S_SHIFT 12
 
diff --git a/file.c b/file.c
index d88bcfe62f268a375a24f2285820a0e29ccd5460..2442b4334da44640848209af0a245a050eae74c6 100644 (file)
--- a/file.c
+++ b/file.c
@@ -342,7 +342,7 @@ lafs_writepage(struct page *page, struct writeback_control *wbc)
        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.
diff --git a/index.c b/index.c
index 3ddc39b98431d6622232405ba96f03dfdaffd3c2..517b3f23467287415ef85ae64c39f255e8a8bcfd 100644 (file)
--- a/index.c
+++ b/index.c
@@ -10,6 +10,7 @@
 #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.
@@ -1202,7 +1203,7 @@ leaf_lookup(void *bf, int len, u32 startaddr, u32 target, u32 *nextp)
                        len -= target*6;
                        len -= 6;
                        next++;
-                       *nextp = ~0UL;
+                       *nextp = 0xffffffff;
                        while (len >= 6) {
                                p2 = decode48(buf);
                                if (p2) {
@@ -1252,14 +1253,14 @@ leaf_lookup(void *bf, int len, u32 startaddr, u32 target, u32 *nextp)
 
                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;
diff --git a/inode.c b/inode.c
index 234aa8e8601d6079690d1118431aaa3ba0d6ab5f..2bc79e02ff9d56eb8891cc411c7e8fafe98cc09e 100644 (file)
--- a/inode.c
+++ b/inode.c
@@ -527,13 +527,13 @@ void lafs_inode_init(struct datablock *b, int type, int mode, struct inode *dir)
                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
diff --git a/io.c b/io.c
index 19571137cda94968cef75d7ff1b357acdba28f8b..abecfa843548b50dbbaf43b569c60a7bb74bb135 100644 (file)
--- a/io.c
+++ b/io.c
@@ -55,7 +55,7 @@ lafs_sync_page_io(struct block_device *bdev, sector_t sector,
        struct completion event;
        int ret;
 
-       rw |= (1 << BIO_RW_SYNC);
+       rw |= (1 << BIO_RW_UNPLUG);
 
        bio->bi_bdev = bdev;
        bio->bi_sector = sector;
@@ -110,7 +110,7 @@ async_page_io(struct block_device *bdev, sector_t sector, int offset, int size,
 {
        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;
@@ -165,7 +165,7 @@ void
 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;
index 0a03df8555d190fcf55e307565c18f2c24fdab85..ef0010f5f5258bcd991eea54848d04fc29b666cd 100644 (file)
--- a/modify.c
+++ b/modify.c
@@ -1228,8 +1228,9 @@ static int do_incorporate_leaf(struct fs *fs, struct indexblock *ib,
                                 ? 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.
@@ -1368,7 +1369,7 @@ static int do_incorporate_leaf(struct fs *fs, struct indexblock *ib,
        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);
diff --git a/roll.c b/roll.c
index 42882c77ca95e96783f587bf5650a47d29d019c0..3417129bc552a53ce9f239c51ea4248df4aacbbc 100644 (file)
--- a/roll.c
+++ b/roll.c
@@ -9,6 +9,7 @@
  */
 
 #include       "lafs.h"
+#include       <linux/slab.h>
 
 static int
 roll_valid(struct fs *fs, struct cluster_head *ch, unsigned long long addr)
index d0e40ca864f37c4ad83e9ebb0df205c75043af23..eb07c77db0585ebeac873cb7dfb50cdec31c1259 100644 (file)
  * 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;
diff --git a/super.c b/super.c
index 6179855413f0b58f3039ba99077c8d408e401add..3fc68e50faae95fa41bda93949c46074a7bf6d32 100644 (file)
--- a/super.c
+++ b/super.c
@@ -12,6 +12,7 @@
 #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;
@@ -304,7 +305,7 @@ lafs_fill_super(struct super_block *sb, void *opv, int silent)
        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);
@@ -366,7 +367,7 @@ lafs_fill_super(struct super_block *sb, void *opv, int silent)
         */
        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;
@@ -973,15 +974,9 @@ static struct dentry *lafs_get_parent(struct dentry *child)
 {
        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 = {
@@ -1166,5 +1161,6 @@ static int get_dump(char *buffer, struct kernel_param *kp)
        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
diff --git a/test/go b/test/go
index 13bf6a182cfc1a246fe0298e16ebcd9fa94f3146..a49f49c888d5e3e953bd97c3c8a787ce2a53bde1 100644 (file)
--- a/test/go
+++ b/test/go
@@ -12,15 +12,15 @@ rm -f lafs.ko
 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'
index 77e3b79ca1ad66e148326c7d4ae7c6fea3eb5533..b92439fb7c70f86a47ca2948552872b3c517fdc8 100644 (file)
@@ -13,9 +13,9 @@ rm -f /tmp/tftp
 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