Move the allocation of the inode contents into ffs_vfsops.c rather than

passing malloc types around.
This commit is contained in:
Poul-Henning Kamp 2002-12-27 10:23:03 +00:00
parent 44acbc1adc
commit de6ba7c016
3 changed files with 10 additions and 12 deletions

View File

@ -70,8 +70,7 @@ int ffs_flushfiles(struct mount *, int, struct thread *);
void ffs_fragacct(struct fs *, int, int32_t [], int);
int ffs_freefile(struct fs *, struct vnode *, ino_t, int );
int ffs_isblock(struct fs *, u_char *, ufs1_daddr_t);
void ffs_load_inode(struct buf *, struct inode *, struct malloc_type *,
struct fs *, ino_t);
void ffs_load_inode(struct buf *, struct inode *, struct fs *, ino_t);
int ffs_mountroot(void);
vfs_mount_t ffs_mount;
int ffs_reallocblks(struct vop_reallocblks_args *);

View File

@ -105,18 +105,14 @@ ffs_blkatoff(vp, offset, res, bpp)
* to the incore copy.
*/
void
ffs_load_inode(bp, ip, mtype, fs, ino)
ffs_load_inode(bp, ip, fs, ino)
struct buf *bp;
struct inode *ip;
struct malloc_type *mtype;
struct fs *fs;
ino_t ino;
{
if (ip->i_ump->um_fstype == UFS1) {
if (mtype != NULL)
MALLOC(ip->i_din1, struct ufs1_dinode *,
sizeof(struct ufs1_dinode), mtype, M_WAITOK);
*ip->i_din1 =
*((struct ufs1_dinode *)bp->b_data + ino_to_fsbo(fs, ino));
ip->i_mode = ip->i_din1->di_mode;
@ -127,9 +123,6 @@ ffs_load_inode(bp, ip, mtype, fs, ino)
ip->i_uid = ip->i_din1->di_uid;
ip->i_gid = ip->i_din1->di_gid;
} else {
if (mtype != NULL)
MALLOC(ip->i_din2, struct ufs2_dinode *,
sizeof(struct ufs2_dinode), mtype, M_WAITOK);
*ip->i_din2 =
*((struct ufs2_dinode *)bp->b_data + ino_to_fsbo(fs, ino));
ip->i_mode = ip->i_din2->di_mode;

View File

@ -522,7 +522,7 @@ loop:
vput(vp);
return (error);
}
ffs_load_inode(bp, ip, NULL, fs, ip->i_number);
ffs_load_inode(bp, ip, fs, ip->i_number);
ip->i_effnlink = ip->i_nlink;
brelse(bp);
vput(vp);
@ -1303,7 +1303,13 @@ ffs_vget(mp, ino, flags, vpp)
*vpp = NULL;
return (error);
}
ffs_load_inode(bp, ip, M_FFSNODE, fs, ino);
if (ip->i_ump->um_fstype == UFS1)
MALLOC(ip->i_din1, struct ufs1_dinode *,
sizeof(struct ufs1_dinode), M_FFSNODE, M_WAITOK);
else
MALLOC(ip->i_din2, struct ufs2_dinode *,
sizeof(struct ufs2_dinode), M_FFSNODE, M_WAITOK);
ffs_load_inode(bp, ip, fs, ino);
if (DOINGSOFTDEP(vp))
softdep_load_inodeblock(ip);
else