Commit b28852a5 authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: hoist xfs_trans_add_item calls to defer ops functions

Remove even more repeated boilerplate.
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 3e0958be
......@@ -26,6 +26,7 @@
#include "xfs_da_format.h"
#include "xfs_da_btree.h"
#include "xfs_attr.h"
#include "xfs_trans_priv.h"
static struct kmem_cache *xfs_defer_pending_cache;
......@@ -213,6 +214,7 @@ xfs_defer_create_done(
return;
tp->t_flags |= XFS_TRANS_HAS_INTENT_DONE;
xfs_trans_add_item(tp, lip);
set_bit(XFS_LI_DIRTY, &lip->li_flags);
dfp->dfp_done = lip;
}
......@@ -241,6 +243,7 @@ xfs_defer_create_intent(
return PTR_ERR(lip);
tp->t_flags |= XFS_TRANS_DIRTY;
xfs_trans_add_item(tp, lip);
set_bit(XFS_LI_DIRTY, &lip->li_flags);
dfp->dfp_intent = lip;
return 1;
......@@ -506,8 +509,10 @@ xfs_defer_relog(
xfs_defer_create_done(*tpp, dfp);
lip = xfs_trans_item_relog(dfp->dfp_intent, dfp->dfp_done,
*tpp);
if (lip)
if (lip) {
xfs_trans_add_item(*tpp, lip);
set_bit(XFS_LI_DIRTY, &lip->li_flags);
}
dfp->dfp_done = NULL;
dfp->dfp_intent = lip;
}
......
......@@ -375,7 +375,6 @@ xfs_attr_create_intent(
}
attrip = xfs_attri_init(mp, attr->xattri_nameval);
xfs_trans_add_item(tp, &attrip->attri_item);
xfs_attr_log_item(tp, attrip, attr);
return &attrip->attri_item;
......@@ -654,8 +653,6 @@ xfs_attri_item_relog(
new_attrp->alfi_name_len = old_attrp->alfi_name_len;
new_attrp->alfi_attr_filter = old_attrp->alfi_attr_filter;
xfs_trans_add_item(tp, &new_attrip->attri_item);
return &new_attrip->attri_item;
}
......@@ -753,7 +750,6 @@ xfs_trans_get_attrd(struct xfs_trans *tp,
attrdp->attrd_attrip = attrip;
attrdp->attrd_format.alfd_alf_id = attrip->attri_format.alfi_id;
xfs_trans_add_item(tp, &attrdp->attrd_item);
return attrdp;
}
......
......@@ -234,7 +234,6 @@ xfs_trans_get_bud(
budp->bud_buip = buip;
budp->bud_format.bud_bui_id = buip->bui_format.bui_id;
xfs_trans_add_item(tp, &budp->bud_item);
return budp;
}
......@@ -315,7 +314,6 @@ xfs_bmap_update_create_intent(
ASSERT(count == XFS_BUI_MAX_FAST_EXTENTS);
xfs_trans_add_item(tp, &buip->bui_item);
if (sort)
list_sort(mp, items, xfs_bmap_update_diff_items);
list_for_each_entry(bi, items, bi_list)
......@@ -585,7 +583,6 @@ xfs_bui_item_relog(
buip = xfs_bui_init(tp->t_mountp);
memcpy(buip->bui_format.bui_extents, map, count * sizeof(*map));
atomic_set(&buip->bui_next_extent, count);
xfs_trans_add_item(tp, &buip->bui_item);
return &buip->bui_item;
}
......
......@@ -332,7 +332,6 @@ xfs_trans_get_efd(
efdp->efd_format.efd_nextents = nextents;
efdp->efd_format.efd_efi_id = efip->efi_format.efi_id;
xfs_trans_add_item(tp, &efdp->efd_item);
return efdp;
}
......@@ -415,7 +414,6 @@ xfs_extent_free_create_intent(
ASSERT(count > 0);
xfs_trans_add_item(tp, &efip->efi_item);
if (sort)
list_sort(mp, items, xfs_extent_free_diff_items);
list_for_each_entry(xefi, items, xefi_list)
......@@ -708,7 +706,6 @@ xfs_efi_item_relog(
efip = xfs_efi_init(tp->t_mountp, count);
memcpy(efip->efi_format.efi_extents, extp, count * sizeof(*extp));
atomic_set(&efip->efi_next_extent, count);
xfs_trans_add_item(tp, &efip->efi_item);
return &efip->efi_item;
}
......
......@@ -240,7 +240,6 @@ xfs_trans_get_cud(
cudp->cud_cuip = cuip;
cudp->cud_format.cud_cui_id = cuip->cui_format.cui_id;
xfs_trans_add_item(tp, &cudp->cud_item);
return cudp;
}
......@@ -315,7 +314,6 @@ xfs_refcount_update_create_intent(
ASSERT(count > 0);
xfs_trans_add_item(tp, &cuip->cui_item);
if (sort)
list_sort(mp, items, xfs_refcount_update_diff_items);
list_for_each_entry(ri, items, ri_list)
......@@ -546,7 +544,6 @@ xfs_cui_item_relog(
cuip = xfs_cui_init(tp->t_mountp, count);
memcpy(cuip->cui_format.cui_extents, pmap, count * sizeof(*pmap));
atomic_set(&cuip->cui_next_extent, count);
xfs_trans_add_item(tp, &cuip->cui_item);
return &cuip->cui_item;
}
......
......@@ -238,7 +238,6 @@ xfs_trans_get_rud(
rudp->rud_ruip = ruip;
rudp->rud_format.rud_rui_id = ruip->rui_format.rui_id;
xfs_trans_add_item(tp, &rudp->rud_item);
return rudp;
}
......@@ -340,7 +339,6 @@ xfs_rmap_update_create_intent(
ASSERT(count > 0);
xfs_trans_add_item(tp, &ruip->rui_item);
if (sort)
list_sort(mp, items, xfs_rmap_update_diff_items);
list_for_each_entry(ri, items, ri_list)
......@@ -599,7 +597,6 @@ xfs_rui_item_relog(
ruip = xfs_rui_init(tp->t_mountp, count);
memcpy(ruip->rui_format.rui_extents, map, count * sizeof(*map));
atomic_set(&ruip->rui_next_extent, count);
xfs_trans_add_item(tp, &ruip->rui_item);
return &ruip->rui_item;
}
......
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