Commit 062647a8 authored by Brian Foster's avatar Brian Foster Committed by Dave Chinner

xfs: replace on-stack xfs_trans_res with pointer in xfs_create()

There's no need to store a full struct xfs_trans_res on the stack in
xfs_create() and copy the fields. Use a pointer to the appropriate
structures embedded in the xfs_mount.
Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 78c931b8
...@@ -1082,7 +1082,7 @@ xfs_create( ...@@ -1082,7 +1082,7 @@ xfs_create(
struct xfs_dquot *udqp = NULL; struct xfs_dquot *udqp = NULL;
struct xfs_dquot *gdqp = NULL; struct xfs_dquot *gdqp = NULL;
struct xfs_dquot *pdqp = NULL; struct xfs_dquot *pdqp = NULL;
struct xfs_trans_res tres; struct xfs_trans_res *tres;
uint resblks; uint resblks;
trace_xfs_create(dp, name); trace_xfs_create(dp, name);
...@@ -1105,13 +1105,11 @@ xfs_create( ...@@ -1105,13 +1105,11 @@ xfs_create(
if (is_dir) { if (is_dir) {
rdev = 0; rdev = 0;
resblks = XFS_MKDIR_SPACE_RES(mp, name->len); resblks = XFS_MKDIR_SPACE_RES(mp, name->len);
tres.tr_logres = M_RES(mp)->tr_mkdir.tr_logres; tres = &M_RES(mp)->tr_mkdir;
tres.tr_logcount = XFS_MKDIR_LOG_COUNT;
tp = xfs_trans_alloc(mp, XFS_TRANS_MKDIR); tp = xfs_trans_alloc(mp, XFS_TRANS_MKDIR);
} else { } else {
resblks = XFS_CREATE_SPACE_RES(mp, name->len); resblks = XFS_CREATE_SPACE_RES(mp, name->len);
tres.tr_logres = M_RES(mp)->tr_create.tr_logres; tres = &M_RES(mp)->tr_create;
tres.tr_logcount = XFS_CREATE_LOG_COUNT;
tp = xfs_trans_alloc(mp, XFS_TRANS_CREATE); tp = xfs_trans_alloc(mp, XFS_TRANS_CREATE);
} }
...@@ -1123,17 +1121,16 @@ xfs_create( ...@@ -1123,17 +1121,16 @@ xfs_create(
* the case we'll drop the one we have and get a more * the case we'll drop the one we have and get a more
* appropriate transaction later. * appropriate transaction later.
*/ */
tres.tr_logflags = XFS_TRANS_PERM_LOG_RES; error = xfs_trans_reserve(tp, tres, resblks, 0);
error = xfs_trans_reserve(tp, &tres, resblks, 0);
if (error == -ENOSPC) { if (error == -ENOSPC) {
/* flush outstanding delalloc blocks and retry */ /* flush outstanding delalloc blocks and retry */
xfs_flush_inodes(mp); xfs_flush_inodes(mp);
error = xfs_trans_reserve(tp, &tres, resblks, 0); error = xfs_trans_reserve(tp, tres, resblks, 0);
} }
if (error == -ENOSPC) { if (error == -ENOSPC) {
/* No space at all so try a "no-allocation" reservation */ /* No space at all so try a "no-allocation" reservation */
resblks = 0; resblks = 0;
error = xfs_trans_reserve(tp, &tres, 0, 0); error = xfs_trans_reserve(tp, tres, 0, 0);
} }
if (error) { if (error) {
cancel_flags = 0; cancel_flags = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment