summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/libxfs')
-rw-r--r--fs/xfs/libxfs/xfs_attr.c9
-rw-r--r--fs/xfs/libxfs/xfs_attr_remote.c2
-rw-r--r--fs/xfs/libxfs/xfs_bmap.c8
-rw-r--r--fs/xfs/libxfs/xfs_defer.c59
-rw-r--r--fs/xfs/libxfs/xfs_defer.h1
5 files changed, 21 insertions, 58 deletions
diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
index 227887bee00d..3190dfc21b60 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.c
@@ -320,7 +320,6 @@ xfs_attr_set(
* buffer and run into problems with the write verifier.
*/
xfs_trans_bhold(args.trans, leaf_bp);
- xfs_defer_ijoin(args.trans->t_dfops, dp);
error = xfs_defer_finish(&args.trans);
if (error)
goto out;
@@ -589,7 +588,6 @@ xfs_attr_leaf_addname(
error = xfs_attr3_leaf_to_node(args);
if (error)
goto out_defer_cancel;
- xfs_defer_ijoin(args->trans->t_dfops, dp);
error = xfs_defer_finish(&args->trans);
if (error)
goto out_defer_cancel;
@@ -678,7 +676,6 @@ xfs_attr_leaf_addname(
/* bp is gone due to xfs_da_shrink_inode */
if (error)
goto out_defer_cancel;
- xfs_defer_ijoin(args->trans->t_dfops, dp);
error = xfs_defer_finish(&args->trans);
if (error)
goto out_defer_cancel;
@@ -742,7 +739,6 @@ xfs_attr_leaf_removename(
/* bp is gone due to xfs_da_shrink_inode */
if (error)
goto out_defer_cancel;
- xfs_defer_ijoin(args->trans->t_dfops, dp);
error = xfs_defer_finish(&args->trans);
if (error)
goto out_defer_cancel;
@@ -869,7 +865,6 @@ restart:
error = xfs_attr3_leaf_to_node(args);
if (error)
goto out_defer_cancel;
- xfs_defer_ijoin(args->trans->t_dfops, dp);
error = xfs_defer_finish(&args->trans);
if (error)
goto out_defer_cancel;
@@ -894,7 +889,6 @@ restart:
error = xfs_da3_split(state);
if (error)
goto out_defer_cancel;
- xfs_defer_ijoin(args->trans->t_dfops, dp);
error = xfs_defer_finish(&args->trans);
if (error)
goto out_defer_cancel;
@@ -991,7 +985,6 @@ restart:
error = xfs_da3_join(state);
if (error)
goto out_defer_cancel;
- xfs_defer_ijoin(args->trans->t_dfops, dp);
error = xfs_defer_finish(&args->trans);
if (error)
goto out_defer_cancel;
@@ -1115,7 +1108,6 @@ xfs_attr_node_removename(
error = xfs_da3_join(state);
if (error)
goto out_defer_cancel;
- xfs_defer_ijoin(args->trans->t_dfops, dp);
error = xfs_defer_finish(&args->trans);
if (error)
goto out_defer_cancel;
@@ -1147,7 +1139,6 @@ xfs_attr_node_removename(
/* bp is gone due to xfs_da_shrink_inode */
if (error)
goto out_defer_cancel;
- xfs_defer_ijoin(args->trans->t_dfops, dp);
error = xfs_defer_finish(&args->trans);
if (error)
goto out_defer_cancel;
diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c
index 77ca38586913..f52552313773 100644
--- a/fs/xfs/libxfs/xfs_attr_remote.c
+++ b/fs/xfs/libxfs/xfs_attr_remote.c
@@ -486,7 +486,6 @@ xfs_attr_rmtval_set(
&nmap);
if (error)
goto out_defer_cancel;
- xfs_defer_ijoin(args->trans->t_dfops, dp);
error = xfs_defer_finish(&args->trans);
if (error)
goto out_defer_cancel;
@@ -627,7 +626,6 @@ xfs_attr_rmtval_remove(
XFS_BMAPI_ATTRFORK, 1, &done);
if (error)
goto out_defer_cancel;
- xfs_defer_ijoin(args->trans->t_dfops, args->dp);
error = xfs_defer_finish(&args->trans);
if (error)
goto out_defer_cancel;
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 71687d805f79..5cd490dc891a 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -1119,7 +1119,6 @@ xfs_bmap_add_attrfork(
xfs_log_sb(tp);
}
- xfs_defer_ijoin(tp->t_dfops, ip);
error = xfs_trans_commit(tp);
xfs_iunlock(ip, XFS_ILOCK_EXCL);
return error;
@@ -5987,7 +5986,6 @@ __xfs_bmap_add(
int whichfork,
struct xfs_bmbt_irec *bmap)
{
- int error;
struct xfs_bmap_intent *bi;
trace_xfs_bmap_defer(mp,
@@ -6006,12 +6004,6 @@ __xfs_bmap_add(
bi->bi_whichfork = whichfork;
bi->bi_bmap = *bmap;
- error = xfs_defer_ijoin(dfops, bi->bi_owner);
- if (error) {
- kmem_free(bi);
- return error;
- }
-
xfs_defer_add(dfops, XFS_DEFER_OPS_TYPE_BMAP, &bi->bi_list);
return 0;
}
diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c
index e9b7671d289a..1e7073252a5e 100644
--- a/fs/xfs/libxfs/xfs_defer.c
+++ b/fs/xfs/libxfs/xfs_defer.c
@@ -15,6 +15,8 @@
#include "xfs_defer.h"
#include "xfs_trans.h"
#include "xfs_buf_item.h"
+#include "xfs_inode.h"
+#include "xfs_inode_item.h"
#include "xfs_trace.h"
/*
@@ -230,16 +232,14 @@ xfs_defer_trans_roll(
{
struct xfs_defer_ops *dop = (*tp)->t_dfops;
struct xfs_buf_log_item *bli;
+ struct xfs_inode_log_item *ili;
struct xfs_log_item *lip;
struct xfs_buf *bplist[XFS_DEFER_OPS_NR_BUFS];
- int bpcount = 0;
+ struct xfs_inode *iplist[XFS_DEFER_OPS_NR_INODES];
+ int bpcount = 0, ipcount = 0;
int i;
int error;
- /* Log all the joined inodes. */
- for (i = 0; i < XFS_DEFER_OPS_NR_INODES && dop->dop_inodes[i]; i++)
- xfs_trans_log_inode(*tp, dop->dop_inodes[i], XFS_ILOG_CORE);
-
list_for_each_entry(lip, &(*tp)->t_items, li_trans) {
switch (lip->li_type) {
case XFS_LI_BUF:
@@ -254,6 +254,19 @@ xfs_defer_trans_roll(
bplist[bpcount++] = bli->bli_buf;
}
break;
+ case XFS_LI_INODE:
+ ili = container_of(lip, struct xfs_inode_log_item,
+ ili_item);
+ if (ili->ili_lock_flags == 0) {
+ if (ipcount >= XFS_DEFER_OPS_NR_INODES) {
+ ASSERT(0);
+ return -EFSCORRUPTED;
+ }
+ xfs_trans_log_inode(*tp, ili->ili_inode,
+ XFS_ILOG_CORE);
+ iplist[ipcount++] = ili->ili_inode;
+ }
+ break;
default:
break;
}
@@ -271,8 +284,8 @@ xfs_defer_trans_roll(
}
/* Rejoin the joined inodes. */
- for (i = 0; i < XFS_DEFER_OPS_NR_INODES && dop->dop_inodes[i]; i++)
- xfs_trans_ijoin(*tp, dop->dop_inodes[i], 0);
+ for (i = 0; i < ipcount; i++)
+ xfs_trans_ijoin(*tp, iplist[i], 0);
/* Rejoin the buffers and dirty them so the log moves forward. */
for (i = 0; i < bpcount; i++) {
@@ -292,41 +305,13 @@ xfs_defer_has_unfinished_work(
}
/*
- * Add this inode to the deferred op. Each joined inode is relogged
- * each time we roll the transaction.
- */
-int
-xfs_defer_ijoin(
- struct xfs_defer_ops *dop,
- struct xfs_inode *ip)
-{
- int i;
-
- for (i = 0; i < XFS_DEFER_OPS_NR_INODES; i++) {
- if (dop->dop_inodes[i] == ip)
- return 0;
- else if (dop->dop_inodes[i] == NULL) {
- dop->dop_inodes[i] = ip;
- return 0;
- }
- }
-
- ASSERT(0);
- return -EFSCORRUPTED;
-}
-
-/*
* Reset an already used dfops after finish.
*/
static void
xfs_defer_reset(
struct xfs_trans *tp)
{
- struct xfs_defer_ops *dop = tp->t_dfops;
-
- ASSERT(!xfs_defer_has_unfinished_work(dop));
-
- memset(dop->dop_inodes, 0, sizeof(dop->dop_inodes));
+ ASSERT(!xfs_defer_has_unfinished_work(tp->t_dfops));
/*
* Low mode state transfers across transaction rolls to mirror dfops
@@ -588,8 +573,6 @@ xfs_defer_move(
list_splice_init(&src->dop_intake, &dst->dop_intake);
list_splice_init(&src->dop_pending, &dst->dop_pending);
- memcpy(dst->dop_inodes, src->dop_inodes, sizeof(dst->dop_inodes));
-
/*
* Low free space mode was historically controlled by a dfops field.
* This meant that low mode state potentially carried across multiple
diff --git a/fs/xfs/libxfs/xfs_defer.h b/fs/xfs/libxfs/xfs_defer.h
index 4a8bb838adf2..bf1e9f78561e 100644
--- a/fs/xfs/libxfs/xfs_defer.h
+++ b/fs/xfs/libxfs/xfs_defer.h
@@ -42,7 +42,6 @@ int xfs_defer_finish(struct xfs_trans **tp);
void xfs_defer_cancel(struct xfs_trans *);
void xfs_defer_init(struct xfs_trans *tp, struct xfs_defer_ops *dop);
bool xfs_defer_has_unfinished_work(struct xfs_defer_ops *dop);
-int xfs_defer_ijoin(struct xfs_defer_ops *dop, struct xfs_inode *ip);
void xfs_defer_move(struct xfs_trans *dtp, struct xfs_trans *stp);
/* Description of a deferred type. */