diff options
author | Brian Foster <bfoster@redhat.com> | 2014-11-27 22:00:16 -0500 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-11-27 22:00:16 -0500 |
commit | 062647a8b41928f4fb97f967b24092be68f5f0f0 (patch) | |
tree | 0ab56939442dbf4112638c48e8d77948df9f9c44 /fs | |
parent | 78c931b8be75456562b55ed4e27878f1519e1367 (diff) |
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: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/xfs_inode.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 8ed049d1e332..2ffb80267e37 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -1082,7 +1082,7 @@ xfs_create( | |||
1082 | struct xfs_dquot *udqp = NULL; | 1082 | struct xfs_dquot *udqp = NULL; |
1083 | struct xfs_dquot *gdqp = NULL; | 1083 | struct xfs_dquot *gdqp = NULL; |
1084 | struct xfs_dquot *pdqp = NULL; | 1084 | struct xfs_dquot *pdqp = NULL; |
1085 | struct xfs_trans_res tres; | 1085 | struct xfs_trans_res *tres; |
1086 | uint resblks; | 1086 | uint resblks; |
1087 | 1087 | ||
1088 | trace_xfs_create(dp, name); | 1088 | trace_xfs_create(dp, name); |
@@ -1105,13 +1105,11 @@ xfs_create( | |||
1105 | if (is_dir) { | 1105 | if (is_dir) { |
1106 | rdev = 0; | 1106 | rdev = 0; |
1107 | resblks = XFS_MKDIR_SPACE_RES(mp, name->len); | 1107 | resblks = XFS_MKDIR_SPACE_RES(mp, name->len); |
1108 | tres.tr_logres = M_RES(mp)->tr_mkdir.tr_logres; | 1108 | tres = &M_RES(mp)->tr_mkdir; |
1109 | tres.tr_logcount = XFS_MKDIR_LOG_COUNT; | ||
1110 | tp = xfs_trans_alloc(mp, XFS_TRANS_MKDIR); | 1109 | tp = xfs_trans_alloc(mp, XFS_TRANS_MKDIR); |
1111 | } else { | 1110 | } else { |
1112 | resblks = XFS_CREATE_SPACE_RES(mp, name->len); | 1111 | resblks = XFS_CREATE_SPACE_RES(mp, name->len); |
1113 | tres.tr_logres = M_RES(mp)->tr_create.tr_logres; | 1112 | tres = &M_RES(mp)->tr_create; |
1114 | tres.tr_logcount = XFS_CREATE_LOG_COUNT; | ||
1115 | tp = xfs_trans_alloc(mp, XFS_TRANS_CREATE); | 1113 | tp = xfs_trans_alloc(mp, XFS_TRANS_CREATE); |
1116 | } | 1114 | } |
1117 | 1115 | ||
@@ -1123,17 +1121,16 @@ xfs_create( | |||
1123 | * the case we'll drop the one we have and get a more | 1121 | * the case we'll drop the one we have and get a more |
1124 | * appropriate transaction later. | 1122 | * appropriate transaction later. |
1125 | */ | 1123 | */ |
1126 | tres.tr_logflags = XFS_TRANS_PERM_LOG_RES; | 1124 | error = xfs_trans_reserve(tp, tres, resblks, 0); |
1127 | error = xfs_trans_reserve(tp, &tres, resblks, 0); | ||
1128 | if (error == -ENOSPC) { | 1125 | if (error == -ENOSPC) { |
1129 | /* flush outstanding delalloc blocks and retry */ | 1126 | /* flush outstanding delalloc blocks and retry */ |
1130 | xfs_flush_inodes(mp); | 1127 | xfs_flush_inodes(mp); |
1131 | error = xfs_trans_reserve(tp, &tres, resblks, 0); | 1128 | error = xfs_trans_reserve(tp, tres, resblks, 0); |
1132 | } | 1129 | } |
1133 | if (error == -ENOSPC) { | 1130 | if (error == -ENOSPC) { |
1134 | /* No space at all so try a "no-allocation" reservation */ | 1131 | /* No space at all so try a "no-allocation" reservation */ |
1135 | resblks = 0; | 1132 | resblks = 0; |
1136 | error = xfs_trans_reserve(tp, &tres, 0, 0); | 1133 | error = xfs_trans_reserve(tp, tres, 0, 0); |
1137 | } | 1134 | } |
1138 | if (error) { | 1135 | if (error) { |
1139 | cancel_flags = 0; | 1136 | cancel_flags = 0; |