Skip to content

Commit

Permalink
ocfs2: split out inode alloc code from ocfs2_mknod_locked
Browse files Browse the repository at this point in the history
Do this by splitting the bulk of the function away from the inode allocation
code at the very tom of ocfs2_mknod_locked(). Existing callers don't need to
change and won't see any difference. The new function created,
__ocfs2_mknod_locked() will be used shortly.

Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: Tao Ma <tao.ma@oracle.com>
  • Loading branch information
Mark Fasheh authored and Tao Ma committed Sep 8, 2010
1 parent 81c8c82 commit 021960c
Showing 1 changed file with 37 additions and 18 deletions.
55 changes: 37 additions & 18 deletions fs/ocfs2/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,32 +472,23 @@ static int ocfs2_mknod(struct inode *dir,
return status;
}

static int ocfs2_mknod_locked(struct ocfs2_super *osb,
struct inode *dir,
struct inode *inode,
dev_t dev,
struct buffer_head **new_fe_bh,
struct buffer_head *parent_fe_bh,
handle_t *handle,
struct ocfs2_alloc_context *inode_ac)
static int __ocfs2_mknod_locked(struct inode *dir,
struct inode *inode,
dev_t dev,
struct buffer_head **new_fe_bh,
struct buffer_head *parent_fe_bh,
handle_t *handle,
struct ocfs2_alloc_context *inode_ac,
u64 fe_blkno, u64 suballoc_loc, u16 suballoc_bit)
{
int status = 0;
struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
struct ocfs2_dinode *fe = NULL;
struct ocfs2_extent_list *fel;
u64 suballoc_loc, fe_blkno = 0;
u16 suballoc_bit;
u16 feat;

*new_fe_bh = NULL;

status = ocfs2_claim_new_inode(handle, dir, parent_fe_bh,
inode_ac, &suballoc_loc,
&suballoc_bit, &fe_blkno);
if (status < 0) {
mlog_errno(status);
goto leave;
}

/* populate as many fields early on as possible - many of
* these are used by the support functions here and in
* callers. */
Expand Down Expand Up @@ -591,6 +582,34 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
return status;
}

static int ocfs2_mknod_locked(struct ocfs2_super *osb,
struct inode *dir,
struct inode *inode,
dev_t dev,
struct buffer_head **new_fe_bh,
struct buffer_head *parent_fe_bh,
handle_t *handle,
struct ocfs2_alloc_context *inode_ac)
{
int status = 0;
u64 suballoc_loc, fe_blkno = 0;
u16 suballoc_bit;

*new_fe_bh = NULL;

status = ocfs2_claim_new_inode(handle, dir, parent_fe_bh,
inode_ac, &suballoc_loc,
&suballoc_bit, &fe_blkno);
if (status < 0) {
mlog_errno(status);
return status;
}

return __ocfs2_mknod_locked(dir, inode, dev, new_fe_bh,
parent_fe_bh, handle, inode_ac,
fe_blkno, suballoc_loc, suballoc_bit);
}

static int ocfs2_mkdir(struct inode *dir,
struct dentry *dentry,
int mode)
Expand Down

0 comments on commit 021960c

Please sign in to comment.