]> git.neil.brown.name Git - LaFS.git/commitdiff
Add 'filesys' arg to lafs_new_inode
authorNeilBrown <neilb@suse.de>
Mon, 9 Aug 2010 11:17:11 +0000 (21:17 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 9 Aug 2010 11:17:11 +0000 (21:17 +1000)
This allows it to be called with dir == NULL - when creating an inode
that isn't in a directory.

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

diff --git a/dir.c b/dir.c
index 9a70280c2b16ed2320fc91940acf275a427a38c5..35ca7df59ac059e72d6846aead5b1217703ecf80 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -607,7 +607,8 @@ lafs_create(struct inode *dir, struct dentry *de, int mode,
 /* Need to allocate an inode and space in the directory */
        struct fs *fs = fs_from_inode(dir);
        struct datablock *db;
-       struct inode *ino = lafs_new_inode(fs, dir, TypeFile, 0, mode, &db);
+       struct inode *ino = lafs_new_inode(fs, LAFSI(dir)->filesys,
+                                          dir, TypeFile, 0, mode, &db);
        struct dirop_handle doh;
        struct update_handle uh;
        int err;
@@ -893,7 +894,8 @@ lafs_symlink(struct inode *dir, struct dentry *de,
        if (l > fs->blocksize-1)
                return -ENAMETOOLONG;
 
-       ino = lafs_new_inode(fs, dir, TypeSymlink, 0, 0666, &inodb);
+       ino = lafs_new_inode(fs, LAFSI(dir)->filesys, dir,
+                            TypeSymlink, 0, 0666, &inodb);
        if (IS_ERR(ino))
                return PTR_ERR(ino);
        b = lafs_get_block(ino, 0, NULL, GFP_KERNEL, MKREF(symlink));
@@ -971,7 +973,8 @@ lafs_mkdir(struct inode *dir, struct dentry *de, int mode)
        if (dir->i_nlink >= LAFS_MAX_LINKS)
                return -EMLINK;
 
-       ino = lafs_new_inode(fs, dir, TypeDir, 0, mode, &inodb);
+       ino = lafs_new_inode(fs, LAFSI(dir)->filesys, dir,
+                            TypeDir, 0, mode, &inodb);
        if (IS_ERR(ino))
                return PTR_ERR(ino);
 
@@ -1047,7 +1050,8 @@ lafs_mknod(struct inode *dir, struct dentry *de, int mode,
        default:
                return -EINVAL;
        }
-       ino = lafs_new_inode(fs, dir, type, 0, mode, &inodb);
+       ino = lafs_new_inode(fs, LAFSI(dir)->filesys, dir,
+                            type, 0, mode, &inodb);
        if (IS_ERR(ino))
                return PTR_ERR(ino);
        init_special_inode(ino, ino->i_mode, rdev);
diff --git a/inode.c b/inode.c
index 6ff15cbe7b564c203624a105cc333af57e0427c0..0151b2d3998f01a2abeb12b3202fb7b90e464b0a 100644 (file)
--- a/inode.c
+++ b/inode.c
@@ -1439,8 +1439,8 @@ inode_map_new_abort(struct inode_map_new_info *imni)
 }
 
 struct inode *
-lafs_new_inode(struct fs *fs, struct inode *dir, int type, int inum, int mode,
-              struct datablock **inodbp)
+lafs_new_inode(struct fs *fs, struct inode *filesys, struct inode *dir,
+              int type, int inum, int mode, struct datablock **inodbp)
 {
        /* allocate and instantiate a new inode.  If inum is non-zero,
         * choose any number, otherwise we are creating a special inode
@@ -1451,7 +1451,6 @@ lafs_new_inode(struct fs *fs, struct inode *dir, int type, int inum, int mode,
         * successfully created
         *
         */
-       struct inode *filesys = LAFSI(dir)->filesys;
        struct inode *ino;
        struct datablock *b;
        struct inode_map_new_info imni;
@@ -1486,7 +1485,7 @@ retry:
        lafs_iounlock_block(&b->b);
 
        inode_map_new_commit(&imni);
-       ino = lafs_iget(dir->i_sb, b->b.fileaddr, SYNC);
+       ino = lafs_iget(filesys->i_sb, b->b.fileaddr, SYNC);
        if (IS_ERR(ino)) {
                lafs_cluster_update_abort(&ui);
                LAFS_BUG(1, &b->b);
diff --git a/lafs.h b/lafs.h
index 71a40eb10347c627224beeea1f7e520eaf15c39c..51e3b3f353554c2255792e588e767a24201b7b63 100644 (file)
--- a/lafs.h
+++ b/lafs.h
@@ -144,7 +144,8 @@ void lafs_clear_inode(struct inode *ino);
 void lafs_delete_inode(struct inode *ino);
 void lafs_dirty_inode(struct inode *ino);
 int lafs_sync_inode(struct inode *ino, int wait);
-struct inode *lafs_new_inode(struct fs *fs, struct inode *dir, int type,
+struct inode *lafs_new_inode(struct fs *fs, struct inode *filesys,
+                            struct inode *dir, int type,
                             int inum, int mode, struct datablock **inodbp);
 int lafs_lock_inode(struct inode *ino);
 void lafs_inode_fillblock(struct inode *ino);