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

xfs: turn dfp_intent into a xfs_log_item

All defer op instance place their own extension of the log item into
the dfp_intent field.  Replace that with a xfs_log_item to improve type
safety and make the code easier to follow.
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 d367a868
...@@ -28,7 +28,7 @@ enum xfs_defer_ops_type { ...@@ -28,7 +28,7 @@ enum xfs_defer_ops_type {
struct xfs_defer_pending { struct xfs_defer_pending {
struct list_head dfp_list; /* pending items */ struct list_head dfp_list; /* pending items */
struct list_head dfp_work; /* work items */ struct list_head dfp_work; /* work items */
void *dfp_intent; /* log intent item */ struct xfs_log_item *dfp_intent; /* log intent item */
void *dfp_done; /* log done item */ void *dfp_done; /* log done item */
unsigned int dfp_count; /* # extent items */ unsigned int dfp_count; /* # extent items */
enum xfs_defer_ops_type dfp_type; enum xfs_defer_ops_type dfp_type;
...@@ -43,14 +43,15 @@ void xfs_defer_move(struct xfs_trans *dtp, struct xfs_trans *stp); ...@@ -43,14 +43,15 @@ void xfs_defer_move(struct xfs_trans *dtp, struct xfs_trans *stp);
/* Description of a deferred type. */ /* Description of a deferred type. */
struct xfs_defer_op_type { struct xfs_defer_op_type {
void (*abort_intent)(void *); struct xfs_log_item *(*create_intent)(struct xfs_trans *tp,
void *(*create_done)(struct xfs_trans *, void *, unsigned int); struct list_head *items, unsigned int count, bool sort);
void (*abort_intent)(struct xfs_log_item *intent);
void *(*create_done)(struct xfs_trans *tp, struct xfs_log_item *intent,
unsigned int count);
int (*finish_item)(struct xfs_trans *, struct list_head *, void *, int (*finish_item)(struct xfs_trans *, struct list_head *, void *,
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 *);
void *(*create_intent)(struct xfs_trans *tp, struct list_head *items,
unsigned int count, bool sort);
unsigned int max_items; unsigned int max_items;
}; };
......
...@@ -330,7 +330,7 @@ xfs_bmap_update_log_item( ...@@ -330,7 +330,7 @@ xfs_bmap_update_log_item(
bmap->bi_bmap.br_state); bmap->bi_bmap.br_state);
} }
STATIC void * static struct xfs_log_item *
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,
...@@ -348,17 +348,17 @@ xfs_bmap_update_create_intent( ...@@ -348,17 +348,17 @@ xfs_bmap_update_create_intent(
list_sort(mp, items, xfs_bmap_update_diff_items); 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->bui_item;
} }
/* Get an BUD so we can process all the deferred rmap updates. */ /* Get an BUD so we can process all the deferred rmap updates. */
STATIC void * STATIC void *
xfs_bmap_update_create_done( xfs_bmap_update_create_done(
struct xfs_trans *tp, struct xfs_trans *tp,
void *intent, struct xfs_log_item *intent,
unsigned int count) unsigned int count)
{ {
return xfs_trans_get_bud(tp, intent); return xfs_trans_get_bud(tp, BUI_ITEM(intent));
} }
/* Process a deferred rmap update. */ /* Process a deferred rmap update. */
...@@ -394,9 +394,9 @@ xfs_bmap_update_finish_item( ...@@ -394,9 +394,9 @@ xfs_bmap_update_finish_item(
/* Abort all pending BUIs. */ /* Abort all pending BUIs. */
STATIC void STATIC void
xfs_bmap_update_abort_intent( xfs_bmap_update_abort_intent(
void *intent) struct xfs_log_item *intent)
{ {
xfs_bui_release(intent); xfs_bui_release(BUI_ITEM(intent));
} }
/* Cancel a deferred rmap update. */ /* Cancel a deferred rmap update. */
......
...@@ -437,7 +437,7 @@ xfs_extent_free_log_item( ...@@ -437,7 +437,7 @@ xfs_extent_free_log_item(
extp->ext_len = free->xefi_blockcount; extp->ext_len = free->xefi_blockcount;
} }
STATIC void * static struct xfs_log_item *
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,
...@@ -455,17 +455,17 @@ xfs_extent_free_create_intent( ...@@ -455,17 +455,17 @@ xfs_extent_free_create_intent(
list_sort(mp, items, xfs_extent_free_diff_items); 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->efi_item;
} }
/* Get an EFD so we can process all the free extents. */ /* Get an EFD so we can process all the free extents. */
STATIC void * STATIC void *
xfs_extent_free_create_done( xfs_extent_free_create_done(
struct xfs_trans *tp, struct xfs_trans *tp,
void *intent, struct xfs_log_item *intent,
unsigned int count) unsigned int count)
{ {
return xfs_trans_get_efd(tp, intent, count); return xfs_trans_get_efd(tp, EFI_ITEM(intent), count);
} }
/* Process a free extent. */ /* Process a free extent. */
...@@ -491,9 +491,9 @@ xfs_extent_free_finish_item( ...@@ -491,9 +491,9 @@ xfs_extent_free_finish_item(
/* Abort all pending EFIs. */ /* Abort all pending EFIs. */
STATIC void STATIC void
xfs_extent_free_abort_intent( xfs_extent_free_abort_intent(
void *intent) struct xfs_log_item *intent)
{ {
xfs_efi_release(intent); xfs_efi_release(EFI_ITEM(intent));
} }
/* Cancel a free extent. */ /* Cancel a free extent. */
......
...@@ -329,7 +329,7 @@ xfs_refcount_update_log_item( ...@@ -329,7 +329,7 @@ xfs_refcount_update_log_item(
xfs_trans_set_refcount_flags(ext, refc->ri_type); xfs_trans_set_refcount_flags(ext, refc->ri_type);
} }
STATIC void * static struct xfs_log_item *
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,
...@@ -347,17 +347,17 @@ xfs_refcount_update_create_intent( ...@@ -347,17 +347,17 @@ xfs_refcount_update_create_intent(
list_sort(mp, items, xfs_refcount_update_diff_items); 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->cui_item;
} }
/* Get an CUD so we can process all the deferred refcount updates. */ /* Get an CUD so we can process all the deferred refcount updates. */
STATIC void * STATIC void *
xfs_refcount_update_create_done( xfs_refcount_update_create_done(
struct xfs_trans *tp, struct xfs_trans *tp,
void *intent, struct xfs_log_item *intent,
unsigned int count) unsigned int count)
{ {
return xfs_trans_get_cud(tp, intent); return xfs_trans_get_cud(tp, CUI_ITEM(intent));
} }
/* Process a deferred refcount update. */ /* Process a deferred refcount update. */
...@@ -407,9 +407,9 @@ xfs_refcount_update_finish_cleanup( ...@@ -407,9 +407,9 @@ xfs_refcount_update_finish_cleanup(
/* Abort all pending CUIs. */ /* Abort all pending CUIs. */
STATIC void STATIC void
xfs_refcount_update_abort_intent( xfs_refcount_update_abort_intent(
void *intent) struct xfs_log_item *intent)
{ {
xfs_cui_release(intent); xfs_cui_release(CUI_ITEM(intent));
} }
/* Cancel a deferred refcount update. */ /* Cancel a deferred refcount update. */
......
...@@ -381,7 +381,7 @@ xfs_rmap_update_log_item( ...@@ -381,7 +381,7 @@ xfs_rmap_update_log_item(
rmap->ri_bmap.br_state); rmap->ri_bmap.br_state);
} }
STATIC void * static struct xfs_log_item *
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,
...@@ -399,17 +399,17 @@ xfs_rmap_update_create_intent( ...@@ -399,17 +399,17 @@ xfs_rmap_update_create_intent(
list_sort(mp, items, xfs_rmap_update_diff_items); 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->rui_item;
} }
/* Get an RUD so we can process all the deferred rmap updates. */ /* Get an RUD so we can process all the deferred rmap updates. */
STATIC void * STATIC void *
xfs_rmap_update_create_done( xfs_rmap_update_create_done(
struct xfs_trans *tp, struct xfs_trans *tp,
void *intent, struct xfs_log_item *intent,
unsigned int count) unsigned int count)
{ {
return xfs_trans_get_rud(tp, intent); return xfs_trans_get_rud(tp, RUI_ITEM(intent));
} }
/* Process a deferred rmap update. */ /* Process a deferred rmap update. */
...@@ -451,9 +451,9 @@ xfs_rmap_update_finish_cleanup( ...@@ -451,9 +451,9 @@ xfs_rmap_update_finish_cleanup(
/* Abort all pending RUIs. */ /* Abort all pending RUIs. */
STATIC void STATIC void
xfs_rmap_update_abort_intent( xfs_rmap_update_abort_intent(
void *intent) struct xfs_log_item *intent)
{ {
xfs_rui_release(intent); xfs_rui_release(RUI_ITEM(intent));
} }
/* Cancel a deferred rmap update. */ /* Cancel a deferred rmap update. */
......
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