aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r--fs/xfs/xfs_inode.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 8ed049d1e332..41f804e740d7 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -23,9 +23,7 @@
23#include "xfs_format.h" 23#include "xfs_format.h"
24#include "xfs_log_format.h" 24#include "xfs_log_format.h"
25#include "xfs_trans_resv.h" 25#include "xfs_trans_resv.h"
26#include "xfs_inum.h"
27#include "xfs_sb.h" 26#include "xfs_sb.h"
28#include "xfs_ag.h"
29#include "xfs_mount.h" 27#include "xfs_mount.h"
30#include "xfs_inode.h" 28#include "xfs_inode.h"
31#include "xfs_da_format.h" 29#include "xfs_da_format.h"
@@ -1082,7 +1080,7 @@ xfs_create(
1082 struct xfs_dquot *udqp = NULL; 1080 struct xfs_dquot *udqp = NULL;
1083 struct xfs_dquot *gdqp = NULL; 1081 struct xfs_dquot *gdqp = NULL;
1084 struct xfs_dquot *pdqp = NULL; 1082 struct xfs_dquot *pdqp = NULL;
1085 struct xfs_trans_res tres; 1083 struct xfs_trans_res *tres;
1086 uint resblks; 1084 uint resblks;
1087 1085
1088 trace_xfs_create(dp, name); 1086 trace_xfs_create(dp, name);
@@ -1105,13 +1103,11 @@ xfs_create(
1105 if (is_dir) { 1103 if (is_dir) {
1106 rdev = 0; 1104 rdev = 0;
1107 resblks = XFS_MKDIR_SPACE_RES(mp, name->len); 1105 resblks = XFS_MKDIR_SPACE_RES(mp, name->len);
1108 tres.tr_logres = M_RES(mp)->tr_mkdir.tr_logres; 1106 tres = &M_RES(mp)->tr_mkdir;
1109 tres.tr_logcount = XFS_MKDIR_LOG_COUNT;
1110 tp = xfs_trans_alloc(mp, XFS_TRANS_MKDIR); 1107 tp = xfs_trans_alloc(mp, XFS_TRANS_MKDIR);
1111 } else { 1108 } else {
1112 resblks = XFS_CREATE_SPACE_RES(mp, name->len); 1109 resblks = XFS_CREATE_SPACE_RES(mp, name->len);
1113 tres.tr_logres = M_RES(mp)->tr_create.tr_logres; 1110 tres = &M_RES(mp)->tr_create;
1114 tres.tr_logcount = XFS_CREATE_LOG_COUNT;
1115 tp = xfs_trans_alloc(mp, XFS_TRANS_CREATE); 1111 tp = xfs_trans_alloc(mp, XFS_TRANS_CREATE);
1116 } 1112 }
1117 1113
@@ -1123,17 +1119,16 @@ xfs_create(
1123 * the case we'll drop the one we have and get a more 1119 * the case we'll drop the one we have and get a more
1124 * appropriate transaction later. 1120 * appropriate transaction later.
1125 */ 1121 */
1126 tres.tr_logflags = XFS_TRANS_PERM_LOG_RES; 1122 error = xfs_trans_reserve(tp, tres, resblks, 0);
1127 error = xfs_trans_reserve(tp, &tres, resblks, 0);
1128 if (error == -ENOSPC) { 1123 if (error == -ENOSPC) {
1129 /* flush outstanding delalloc blocks and retry */ 1124 /* flush outstanding delalloc blocks and retry */
1130 xfs_flush_inodes(mp); 1125 xfs_flush_inodes(mp);
1131 error = xfs_trans_reserve(tp, &tres, resblks, 0); 1126 error = xfs_trans_reserve(tp, tres, resblks, 0);
1132 } 1127 }
1133 if (error == -ENOSPC) { 1128 if (error == -ENOSPC) {
1134 /* No space at all so try a "no-allocation" reservation */ 1129 /* No space at all so try a "no-allocation" reservation */
1135 resblks = 0; 1130 resblks = 0;
1136 error = xfs_trans_reserve(tp, &tres, 0, 0); 1131 error = xfs_trans_reserve(tp, tres, 0, 0);
1137 } 1132 }
1138 if (error) { 1133 if (error) {
1139 cancel_flags = 0; 1134 cancel_flags = 0;
@@ -2488,9 +2483,7 @@ xfs_remove(
2488 xfs_fsblock_t first_block; 2483 xfs_fsblock_t first_block;
2489 int cancel_flags; 2484 int cancel_flags;
2490 int committed; 2485 int committed;
2491 int link_zero;
2492 uint resblks; 2486 uint resblks;
2493 uint log_count;
2494 2487
2495 trace_xfs_remove(dp, name); 2488 trace_xfs_remove(dp, name);
2496 2489
@@ -2505,13 +2498,10 @@ xfs_remove(
2505 if (error) 2498 if (error)
2506 goto std_return; 2499 goto std_return;
2507 2500
2508 if (is_dir) { 2501 if (is_dir)
2509 tp = xfs_trans_alloc(mp, XFS_TRANS_RMDIR); 2502 tp = xfs_trans_alloc(mp, XFS_TRANS_RMDIR);
2510 log_count = XFS_DEFAULT_LOG_COUNT; 2503 else
2511 } else {
2512 tp = xfs_trans_alloc(mp, XFS_TRANS_REMOVE); 2504 tp = xfs_trans_alloc(mp, XFS_TRANS_REMOVE);
2513 log_count = XFS_REMOVE_LOG_COUNT;
2514 }
2515 cancel_flags = XFS_TRANS_RELEASE_LOG_RES; 2505 cancel_flags = XFS_TRANS_RELEASE_LOG_RES;
2516 2506
2517 /* 2507 /*
@@ -2579,9 +2569,6 @@ xfs_remove(
2579 if (error) 2569 if (error)
2580 goto out_trans_cancel; 2570 goto out_trans_cancel;
2581 2571
2582 /* Determine if this is the last link while the inode is locked */
2583 link_zero = (ip->i_d.di_nlink == 0);
2584
2585 xfs_bmap_init(&free_list, &first_block); 2572 xfs_bmap_init(&free_list, &first_block);
2586 error = xfs_dir_removename(tp, dp, name, ip->i_ino, 2573 error = xfs_dir_removename(tp, dp, name, ip->i_ino,
2587 &first_block, &free_list, resblks); 2574 &first_block, &free_list, resblks);