Skip to content

Commit

Permalink
orangefs: call op_release sooner when creating inodes
Browse files Browse the repository at this point in the history
Prevents holding an unnecessary op while the kernel processes another op
and yields the CPU.

Signed-off-by: Martin Brandenburg <martin@omnibond.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
  • Loading branch information
Martin Brandenburg authored and Mike Marshall committed Nov 13, 2017
1 parent a55f2d8 commit db0267e
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions fs/orangefs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ static int orangefs_create(struct inode *dir,
{
struct orangefs_inode_s *parent = ORANGEFS_I(dir);
struct orangefs_kernel_op_s *new_op;
struct orangefs_object_kref ref;
struct inode *inode;
struct iattr iattr;
int ret;
Expand Down Expand Up @@ -56,8 +57,10 @@ static int orangefs_create(struct inode *dir,
if (ret < 0)
goto out;

inode = orangefs_new_inode(dir->i_sb, dir, S_IFREG | mode, 0,
&new_op->downcall.resp.create.refn);
ref = new_op->downcall.resp.create.refn;
op_release(new_op);

inode = orangefs_new_inode(dir->i_sb, dir, S_IFREG | mode, 0, &ref);
if (IS_ERR(inode)) {
gossip_err("%s: Failed to allocate inode for file :%pd:\n",
__func__,
Expand Down Expand Up @@ -90,7 +93,6 @@ static int orangefs_create(struct inode *dir,
mark_inode_dirty_sync(dir);
ret = 0;
out:
op_release(new_op);
gossip_debug(GOSSIP_NAME_DEBUG,
"%s: %pd: returning %d\n",
__func__,
Expand Down Expand Up @@ -272,6 +274,7 @@ static int orangefs_symlink(struct inode *dir,
{
struct orangefs_inode_s *parent = ORANGEFS_I(dir);
struct orangefs_kernel_op_s *new_op;
struct orangefs_object_kref ref;
struct inode *inode;
struct iattr iattr;
int mode = 755;
Expand Down Expand Up @@ -314,8 +317,10 @@ static int orangefs_symlink(struct inode *dir,
goto out;
}

inode = orangefs_new_inode(dir->i_sb, dir, S_IFLNK | mode, 0,
&new_op->downcall.resp.sym.refn);
ref = new_op->downcall.resp.sym.refn;
op_release(new_op);

inode = orangefs_new_inode(dir->i_sb, dir, S_IFLNK | mode, 0, &ref);
if (IS_ERR(inode)) {
gossip_err
("*** Failed to allocate orangefs symlink inode\n");
Expand Down Expand Up @@ -345,14 +350,14 @@ static int orangefs_symlink(struct inode *dir,
mark_inode_dirty_sync(dir);
ret = 0;
out:
op_release(new_op);
return ret;
}

static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
{
struct orangefs_inode_s *parent = ORANGEFS_I(dir);
struct orangefs_kernel_op_s *new_op;
struct orangefs_object_kref ref;
struct inode *inode;
struct iattr iattr;
int ret;
Expand Down Expand Up @@ -383,8 +388,10 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
goto out;
}

inode = orangefs_new_inode(dir->i_sb, dir, S_IFDIR | mode, 0,
&new_op->downcall.resp.mkdir.refn);
ref = new_op->downcall.resp.mkdir.refn;
op_release(new_op);

inode = orangefs_new_inode(dir->i_sb, dir, S_IFDIR | mode, 0, &ref);
if (IS_ERR(inode)) {
gossip_err("*** Failed to allocate orangefs dir inode\n");
ret = PTR_ERR(inode);
Expand Down Expand Up @@ -416,7 +423,6 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
orangefs_inode_setattr(dir, &iattr);
mark_inode_dirty_sync(dir);
out:
op_release(new_op);
return ret;
}

Expand Down

0 comments on commit db0267e

Please sign in to comment.