From 7fc2f84345684d162a86a2c7d1fb7889f880cc06 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 9 Aug 2010 21:17:11 +1000 Subject: [PATCH] Add 'filesys' arg to lafs_new_inode This allows it to be called with dir == NULL - when creating an inode that isn't in a directory. Signed-off-by: NeilBrown --- dir.c | 12 ++++++++---- inode.c | 7 +++---- lafs.h | 3 ++- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/dir.c b/dir.c index 9a70280..35ca7df 100644 --- 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 6ff15cb..0151b2d 100644 --- 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 71a40eb..51e3b3f 100644 --- 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); -- 2.39.5