]> git.neil.brown.name Git - LaFS.git/commitdiff
Use inline to map sb to fs
authorNeil Brown <neilb@nbeee.brown>
Mon, 19 Jul 2010 08:27:09 +0000 (18:27 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 9 Aug 2010 01:58:11 +0000 (11:58 +1000)
because we are about to make the conversion slightly
more complex

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

diff --git a/inode.c b/inode.c
index 8b9d9cfdaf7d5c110d9ceca149b7e856e06270da..47412793fb0b0b7820d25c8c2a8a80e0ded24bda 100644 (file)
--- a/inode.c
+++ b/inode.c
@@ -77,8 +77,7 @@ lafs_iget(struct super_block *sb, ino_t inum, int async)
                /* FIXME always use this branch?
                 * FIXME is this OK for all sub-filesystems?
                 */
-               struct fs *fs =  sb->s_fs_info;
-               inodefile = fs->ss[0].root;
+               inodefile = fs_from_sb(sb)->ss[0].root;
        }
 
        if (async) {
@@ -181,9 +180,8 @@ lafs_iget(struct super_block *sb, ino_t inum, int async)
        unlock_new_inode(ino);
 out:
        if (b && test_and_clear_bit(B_Async, &b->b.flags)) {
-               struct fs *fs =  sb->s_fs_info;
                putdref(b, MKREF(async));
-               lafs_wake_cleaner(fs);
+               lafs_wake_cleaner(fs_from_sb(sb));
        }
        putdref(b, MKREF(iget));
        return ino;
diff --git a/lafs.h b/lafs.h
index 6ee9f19bb1d4bd3875158bae4470f64ccebdf1ba..9f6249ec44d34d639a7a057ae247368c4bfcba7c 100644 (file)
--- a/lafs.h
+++ b/lafs.h
@@ -331,12 +331,17 @@ static inline u64 encode_time(struct timespec *ts)
        return t | tn;
 }
 
-static inline struct fs *fs_from_inode(struct inode *ino)
+static inline struct fs *fs_from_sb(struct super_block *sb)
 {
-       struct fs *fs = ino->i_sb->s_fs_info;
+       struct fs *fs = sb->s_fs_info;
        return fs;
 }
 
+static inline struct fs *fs_from_inode(struct inode *ino)
+{
+       return fs_from_sb(ino->i_sb);
+}
+
 static inline int set_phase(struct block *b, int ph)
 {
        if (b->inode->i_ino == 0 && b->fileaddr == 0)
index 3930ba47820be684bd97f2c5a4f7ac5d8c79c26c..920455751ecd558db3cd108ba05b273cdbcb7f68 100644 (file)
@@ -98,7 +98,7 @@ lafs_snap_get_sb(struct file_system_type *fstype,
        err = -EINVAL;
        if (sb->s_type != &lafs_fs_type)
                goto fail;
-       fs = sb->s_fs_info;
+       fs = fs_from_sb(sb);
 
        for (s = 1; s < fs->maxsnapshot; s++) {
                struct datablock *b;
@@ -174,7 +174,7 @@ fail:
 
 static void lafs_snap_kill_sb(struct super_block *sb)
 {
-       struct fs *fs = sb->s_fs_info;
+       struct fs *fs = fs_from_sb(sb);
 
        printk("Generic_shutdown_super being called....\n");
        generic_shutdown_super(sb);
diff --git a/super.c b/super.c
index 4b0ddbe3f4b6ccd9ceb9c3c00d38fbf429505b09..5e3ecd51a12b614c80f8571ef7a564422738c0ed 100644 (file)
--- a/super.c
+++ b/super.c
@@ -641,7 +641,7 @@ static int show_orphans(struct fs *fs)
 
 static void lafs_kill_sb(struct super_block *sb)
 {
-       struct fs *fs = sb->s_fs_info;
+       struct fs *fs = fs_from_sb(sb);
        /* Release the 'struct fs' */
        int i;
 
@@ -713,7 +713,7 @@ static void lafs_kill_sb(struct super_block *sb)
 static void
 lafs_put_super(struct super_block *sb)
 {
-       struct fs *fs = sb->s_fs_info;
+       struct fs *fs = fs_from_sb(sb);
        int ss;
        struct lafs_inode *li;
 
@@ -835,7 +835,7 @@ lafs_get_sb(struct file_system_type *fs_type,
        }
 
        /* So they seem to be the same - better create our
-        * s_fs_info structure and fill it in
+        * 'fs' structure and fill it in
         */
        err = lafs_load(fs, &op, newest);
        if (err)
@@ -1000,12 +1000,11 @@ void lafs_destroy_inode(struct inode *inode)
 
 static int lafs_sync_fs(struct super_block *sb, int wait)
 {
-       struct fs *fs = sb->s_fs_info;
        if (!wait)
                /* We only reach here if s_dirt was set, so it
                 * is reasonable to force a checkpoint.
                 */
-               lafs_checkpoint_start(fs);
+               lafs_checkpoint_start(fs_from_sb(sb));
        else
                printk("FIXME I should wait for the checkpoint to finish\n");
        return 0;