]> git.neil.brown.name Git - LaFS.git/commitdiff
Add 'filesys' pointer to lafs_inode
authorNeilBrown <neilb@suse.de>
Mon, 7 Mar 2011 05:48:37 +0000 (16:48 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 7 Mar 2011 05:48:37 +0000 (16:48 +1100)
This is the first patch in a series to switch from having one
struct super_block for each subset filesystem, to only having one
for each snapshot.  i.e. one which is writable and some number
which are read-only snapshots.
The struct super_block described the primary filesystem and
all of the subset filesystems.

Signed-off-by: NeilBrown <neilb@suse.de>
inode.c
roll.c
snapshot.c
state.h
super.c

diff --git a/inode.c b/inode.c
index 9948edeba6322692a3bc866b2da8cd766cbd6121..e385afe425e1a8df5913a6d6591975beed6f1434 100644 (file)
--- a/inode.c
+++ b/inode.c
@@ -149,6 +149,8 @@ lafs_iget(struct super_block *sb, ino_t inum, int async)
                return ERR_PTR(-ENOENT);
        }
 
+       LAFSI(ino)->filesys = igrab(inodefile);
+
        /* surprisingly the inode bdi does not default to the
         * super_blocks bdi...
         */
diff --git a/roll.c b/roll.c
index 664884bb22da131ed538f9cb618450484960870c..f1dd2696503cbee09ffa96bdcbcefb242857cf0e 100644 (file)
--- a/roll.c
+++ b/roll.c
@@ -793,6 +793,7 @@ lafs_mount(struct fs *fs)
 
        fs->rolled = 0;
        fs->ss[0].root = ino = iget_locked(fs->prime_sb, 0);
+       LAFSI(ino)->filesys = ino;
        k->root = ino;
 
        err = -ENOMEM;
index 1bdeb976063a97408b109170d3c1997d0ba13228..4489ed396ade63627e00ece3701629579d42f0b6 100644 (file)
@@ -168,6 +168,7 @@ lafs_snap_get_sb(struct file_system_type *fstype,
                atomic_inc(&fs->prime_sb->s_active);
 
                fs->ss[s].root = sk->k.root = iget_locked(sb, 0);
+               LAFSI(fs->ss[s].root)->filesys = fs->ss[s].root;
                b = lafs_get_block(fs->ss[s].root, 0, NULL, GFP_KERNEL,
                                   MKREF(snap));
                b->b.physaddr = fs->ss[s].root_addr;
diff --git a/state.h b/state.h
index 8f278411bfc8b378d862861c853eeafca4ba2396..903682a1a5f9ec131e546b4383b5bdedee4e5aa3 100644 (file)
--- a/state.h
+++ b/state.h
@@ -554,6 +554,7 @@ enum {
 /* indexing info stays in the block, not in the inode */
 struct lafs_inode {
        struct inode    vfs_inode;
+       struct inode    *filesys;       /* Inode of containing TypeInodeFile */
        struct indexblock       *iblock;
        struct datablock        *dblock;
        long    cblocks, /* data blocks which are commited to this file */
diff --git a/super.c b/super.c
index 68f0c35d2a7d76a2cf02038fff9560da41a4abd7..3137913258c8641b3932aa67da09019a79047150 100644 (file)
--- a/super.c
+++ b/super.c
@@ -1336,6 +1336,7 @@ static void kfree_inode(struct rcu_head *head)
 void lafs_destroy_inode(struct inode *inode)
 {
        struct datablock *db;
+       struct inode *fsys = LAFSI(inode)->filesys;
 
        BUG_ON(!list_empty(&inode->i_sb_list));
        // Cannot test i_list as dispose_list just does list_del
@@ -1345,6 +1346,10 @@ void lafs_destroy_inode(struct inode *inode)
                set_bit(I_Destroyed, &LAFSI(inode)->iflags);
                putdref(db, MKREF(destroy));
        } else {
+               if (fsys != inode)
+                       iput(fsys);
+               LAFSI(inode)->filesys = NULL;
+
                spin_lock(&inode->i_data.private_lock);
                if (LAFSI(inode)->iblock)
                        LAFS_BUG(atomic_read(&LAFSI(inode)->iblock->b.refcnt),