Commit d367a868 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong

xfs: merge the ->diff_items defer op into ->create_intent

This avoids a per-item indirect call, and also simplifies the interface
a bit.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent c1f09188
...@@ -186,11 +186,8 @@ xfs_defer_create_intent( ...@@ -186,11 +186,8 @@ xfs_defer_create_intent(
{ {
const struct xfs_defer_op_type *ops = defer_op_types[dfp->dfp_type]; const struct xfs_defer_op_type *ops = defer_op_types[dfp->dfp_type];
if (sort)
list_sort(tp->t_mountp, &dfp->dfp_work, ops->diff_items);
dfp->dfp_intent = ops->create_intent(tp, &dfp->dfp_work, dfp->dfp_intent = ops->create_intent(tp, &dfp->dfp_work,
dfp->dfp_count); dfp->dfp_count, sort);
} }
/* /*
......
...@@ -49,9 +49,8 @@ struct xfs_defer_op_type { ...@@ -49,9 +49,8 @@ struct xfs_defer_op_type {
void **); void **);
void (*finish_cleanup)(struct xfs_trans *, void *, int); void (*finish_cleanup)(struct xfs_trans *, void *, int);
void (*cancel_item)(struct list_head *); void (*cancel_item)(struct list_head *);
int (*diff_items)(void *, struct list_head *, struct list_head *);
void *(*create_intent)(struct xfs_trans *tp, struct list_head *items, void *(*create_intent)(struct xfs_trans *tp, struct list_head *items,
unsigned int count); unsigned int count, bool sort);
unsigned int max_items; unsigned int max_items;
}; };
......
...@@ -334,14 +334,18 @@ STATIC void * ...@@ -334,14 +334,18 @@ STATIC void *
xfs_bmap_update_create_intent( xfs_bmap_update_create_intent(
struct xfs_trans *tp, struct xfs_trans *tp,
struct list_head *items, struct list_head *items,
unsigned int count) unsigned int count,
bool sort)
{ {
struct xfs_bui_log_item *buip = xfs_bui_init(tp->t_mountp); struct xfs_mount *mp = tp->t_mountp;
struct xfs_bui_log_item *buip = xfs_bui_init(mp);
struct xfs_bmap_intent *bmap; struct xfs_bmap_intent *bmap;
ASSERT(count == XFS_BUI_MAX_FAST_EXTENTS); ASSERT(count == XFS_BUI_MAX_FAST_EXTENTS);
xfs_trans_add_item(tp, &buip->bui_item); xfs_trans_add_item(tp, &buip->bui_item);
if (sort)
list_sort(mp, items, xfs_bmap_update_diff_items);
list_for_each_entry(bmap, items, bi_list) list_for_each_entry(bmap, items, bi_list)
xfs_bmap_update_log_item(tp, buip, bmap); xfs_bmap_update_log_item(tp, buip, bmap);
return buip; return buip;
...@@ -408,7 +412,6 @@ xfs_bmap_update_cancel_item( ...@@ -408,7 +412,6 @@ xfs_bmap_update_cancel_item(
const struct xfs_defer_op_type xfs_bmap_update_defer_type = { const struct xfs_defer_op_type xfs_bmap_update_defer_type = {
.max_items = XFS_BUI_MAX_FAST_EXTENTS, .max_items = XFS_BUI_MAX_FAST_EXTENTS,
.diff_items = xfs_bmap_update_diff_items,
.create_intent = xfs_bmap_update_create_intent, .create_intent = xfs_bmap_update_create_intent,
.abort_intent = xfs_bmap_update_abort_intent, .abort_intent = xfs_bmap_update_abort_intent,
.create_done = xfs_bmap_update_create_done, .create_done = xfs_bmap_update_create_done,
......
...@@ -441,7 +441,8 @@ STATIC void * ...@@ -441,7 +441,8 @@ STATIC void *
xfs_extent_free_create_intent( xfs_extent_free_create_intent(
struct xfs_trans *tp, struct xfs_trans *tp,
struct list_head *items, struct list_head *items,
unsigned int count) unsigned int count,
bool sort)
{ {
struct xfs_mount *mp = tp->t_mountp; struct xfs_mount *mp = tp->t_mountp;
struct xfs_efi_log_item *efip = xfs_efi_init(mp, count); struct xfs_efi_log_item *efip = xfs_efi_init(mp, count);
...@@ -450,6 +451,8 @@ xfs_extent_free_create_intent( ...@@ -450,6 +451,8 @@ xfs_extent_free_create_intent(
ASSERT(count > 0); ASSERT(count > 0);
xfs_trans_add_item(tp, &efip->efi_item); xfs_trans_add_item(tp, &efip->efi_item);
if (sort)
list_sort(mp, items, xfs_extent_free_diff_items);
list_for_each_entry(free, items, xefi_list) list_for_each_entry(free, items, xefi_list)
xfs_extent_free_log_item(tp, efip, free); xfs_extent_free_log_item(tp, efip, free);
return efip; return efip;
...@@ -506,7 +509,6 @@ xfs_extent_free_cancel_item( ...@@ -506,7 +509,6 @@ xfs_extent_free_cancel_item(
const struct xfs_defer_op_type xfs_extent_free_defer_type = { const struct xfs_defer_op_type xfs_extent_free_defer_type = {
.max_items = XFS_EFI_MAX_FAST_EXTENTS, .max_items = XFS_EFI_MAX_FAST_EXTENTS,
.diff_items = xfs_extent_free_diff_items,
.create_intent = xfs_extent_free_create_intent, .create_intent = xfs_extent_free_create_intent,
.abort_intent = xfs_extent_free_abort_intent, .abort_intent = xfs_extent_free_abort_intent,
.create_done = xfs_extent_free_create_done, .create_done = xfs_extent_free_create_done,
...@@ -571,7 +573,6 @@ xfs_agfl_free_finish_item( ...@@ -571,7 +573,6 @@ xfs_agfl_free_finish_item(
/* sub-type with special handling for AGFL deferred frees */ /* sub-type with special handling for AGFL deferred frees */
const struct xfs_defer_op_type xfs_agfl_free_defer_type = { const struct xfs_defer_op_type xfs_agfl_free_defer_type = {
.max_items = XFS_EFI_MAX_FAST_EXTENTS, .max_items = XFS_EFI_MAX_FAST_EXTENTS,
.diff_items = xfs_extent_free_diff_items,
.create_intent = xfs_extent_free_create_intent, .create_intent = xfs_extent_free_create_intent,
.abort_intent = xfs_extent_free_abort_intent, .abort_intent = xfs_extent_free_abort_intent,
.create_done = xfs_extent_free_create_done, .create_done = xfs_extent_free_create_done,
......
...@@ -333,7 +333,8 @@ STATIC void * ...@@ -333,7 +333,8 @@ STATIC void *
xfs_refcount_update_create_intent( xfs_refcount_update_create_intent(
struct xfs_trans *tp, struct xfs_trans *tp,
struct list_head *items, struct list_head *items,
unsigned int count) unsigned int count,
bool sort)
{ {
struct xfs_mount *mp = tp->t_mountp; struct xfs_mount *mp = tp->t_mountp;
struct xfs_cui_log_item *cuip = xfs_cui_init(mp, count); struct xfs_cui_log_item *cuip = xfs_cui_init(mp, count);
...@@ -342,6 +343,8 @@ xfs_refcount_update_create_intent( ...@@ -342,6 +343,8 @@ xfs_refcount_update_create_intent(
ASSERT(count > 0); ASSERT(count > 0);
xfs_trans_add_item(tp, &cuip->cui_item); xfs_trans_add_item(tp, &cuip->cui_item);
if (sort)
list_sort(mp, items, xfs_refcount_update_diff_items);
list_for_each_entry(refc, items, ri_list) list_for_each_entry(refc, items, ri_list)
xfs_refcount_update_log_item(tp, cuip, refc); xfs_refcount_update_log_item(tp, cuip, refc);
return cuip; return cuip;
...@@ -422,7 +425,6 @@ xfs_refcount_update_cancel_item( ...@@ -422,7 +425,6 @@ xfs_refcount_update_cancel_item(
const struct xfs_defer_op_type xfs_refcount_update_defer_type = { const struct xfs_defer_op_type xfs_refcount_update_defer_type = {
.max_items = XFS_CUI_MAX_FAST_EXTENTS, .max_items = XFS_CUI_MAX_FAST_EXTENTS,
.diff_items = xfs_refcount_update_diff_items,
.create_intent = xfs_refcount_update_create_intent, .create_intent = xfs_refcount_update_create_intent,
.abort_intent = xfs_refcount_update_abort_intent, .abort_intent = xfs_refcount_update_abort_intent,
.create_done = xfs_refcount_update_create_done, .create_done = xfs_refcount_update_create_done,
......
...@@ -385,7 +385,8 @@ STATIC void * ...@@ -385,7 +385,8 @@ STATIC void *
xfs_rmap_update_create_intent( xfs_rmap_update_create_intent(
struct xfs_trans *tp, struct xfs_trans *tp,
struct list_head *items, struct list_head *items,
unsigned int count) unsigned int count,
bool sort)
{ {
struct xfs_mount *mp = tp->t_mountp; struct xfs_mount *mp = tp->t_mountp;
struct xfs_rui_log_item *ruip = xfs_rui_init(mp, count); struct xfs_rui_log_item *ruip = xfs_rui_init(mp, count);
...@@ -394,6 +395,8 @@ xfs_rmap_update_create_intent( ...@@ -394,6 +395,8 @@ xfs_rmap_update_create_intent(
ASSERT(count > 0); ASSERT(count > 0);
xfs_trans_add_item(tp, &ruip->rui_item); xfs_trans_add_item(tp, &ruip->rui_item);
if (sort)
list_sort(mp, items, xfs_rmap_update_diff_items);
list_for_each_entry(rmap, items, ri_list) list_for_each_entry(rmap, items, ri_list)
xfs_rmap_update_log_item(tp, ruip, rmap); xfs_rmap_update_log_item(tp, ruip, rmap);
return ruip; return ruip;
...@@ -466,7 +469,6 @@ xfs_rmap_update_cancel_item( ...@@ -466,7 +469,6 @@ xfs_rmap_update_cancel_item(
const struct xfs_defer_op_type xfs_rmap_update_defer_type = { const struct xfs_defer_op_type xfs_rmap_update_defer_type = {
.max_items = XFS_RUI_MAX_FAST_EXTENTS, .max_items = XFS_RUI_MAX_FAST_EXTENTS,
.diff_items = xfs_rmap_update_diff_items,
.create_intent = xfs_rmap_update_create_intent, .create_intent = xfs_rmap_update_create_intent,
.abort_intent = xfs_rmap_update_abort_intent, .abort_intent = xfs_rmap_update_abort_intent,
.create_done = xfs_rmap_update_create_done, .create_done = xfs_rmap_update_create_done,
......
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