From: Christoph Hellwig Date: Mon, 10 Aug 2020 20:32:04 +0000 (-0400) Subject: xfs: turn dfp_done into a xfs_log_item X-Git-Tag: v5.8.0-rc0~37 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=95e0127470cbc81909feaec9695201463c4eb2ab;p=thirdparty%2Fxfsprogs-dev.git xfs: turn dfp_done into a xfs_log_item Source kernel commit: f09d167c20332ad1298ff82a6f538b4c7ea3fe1b All defer op instance place their own extension of the log item into the dfp_done field. Replace that with a xfs_log_item to improve type safety and make the code easier to follow. Also use the opportunity to improve the ->finish_item calling conventions to place the done log item as the higher level structure before the list_entry used for the individual items. Signed-off-by: Christoph Hellwig Reviewed-by: Brian Foster Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Eric Sandeen --- diff --git a/libxfs/defer_item.c b/libxfs/defer_item.c index 38f289655..bd872d18e 100644 --- a/libxfs/defer_item.c +++ b/libxfs/defer_item.c @@ -58,7 +58,7 @@ xfs_extent_free_create_intent( } /* Get an EFD so we can process all the free extents. */ -STATIC void * +static struct xfs_log_item * xfs_extent_free_create_done( struct xfs_trans *tp, struct xfs_log_item *intent, @@ -71,8 +71,8 @@ xfs_extent_free_create_done( STATIC int xfs_extent_free_finish_item( struct xfs_trans *tp, + struct xfs_log_item *done, struct list_head *item, - void *done_item, void **state) { struct xfs_extent_free_item *free; @@ -119,8 +119,8 @@ const struct xfs_defer_op_type xfs_extent_free_defer_type = { STATIC int xfs_agfl_free_finish_item( struct xfs_trans *tp, + struct xfs_log_item *done, struct list_head *item, - void *done_item, void **state) { struct xfs_mount *mp = tp->t_mountp; @@ -187,7 +187,7 @@ xfs_rmap_update_create_intent( } /* Get an RUD so we can process all the deferred rmap updates. */ -STATIC void * +static struct xfs_log_item * xfs_rmap_update_create_done( struct xfs_trans *tp, struct xfs_log_item *intent, @@ -200,8 +200,8 @@ xfs_rmap_update_create_done( STATIC int xfs_rmap_update_finish_item( struct xfs_trans *tp, + struct xfs_log_item *done, struct list_head *item, - void *done_item, void **state) { struct xfs_rmap_intent *rmap; @@ -294,7 +294,7 @@ xfs_refcount_update_create_intent( } /* Get an CUD so we can process all the deferred refcount updates. */ -STATIC void * +static struct xfs_log_item * xfs_refcount_update_create_done( struct xfs_trans *tp, struct xfs_log_item *intent, @@ -307,8 +307,8 @@ xfs_refcount_update_create_done( STATIC int xfs_refcount_update_finish_item( struct xfs_trans *tp, + struct xfs_log_item *done, struct list_head *item, - void *done_item, void **state) { struct xfs_refcount_intent *refc; @@ -407,7 +407,7 @@ xfs_bmap_update_create_intent( } /* Get an BUD so we can process all the deferred rmap updates. */ -STATIC void * +static struct xfs_log_item * xfs_bmap_update_create_done( struct xfs_trans *tp, struct xfs_log_item *intent, @@ -420,8 +420,8 @@ xfs_bmap_update_create_done( STATIC int xfs_bmap_update_finish_item( struct xfs_trans *tp, + struct xfs_log_item *done, struct list_head *item, - void *done_item, void **state) { struct xfs_bmap_intent *bmap; diff --git a/libxfs/xfs_defer.c b/libxfs/xfs_defer.c index b7b2e8022..f4fa2c085 100644 --- a/libxfs/xfs_defer.c +++ b/libxfs/xfs_defer.c @@ -369,7 +369,7 @@ xfs_defer_finish_one( list_for_each_safe(li, n, &dfp->dfp_work) { list_del(li); dfp->dfp_count--; - error = ops->finish_item(tp, li, dfp->dfp_done, &state); + error = ops->finish_item(tp, dfp->dfp_done, li, &state); if (error == -EAGAIN) { /* * Caller wants a fresh transaction; put the work item diff --git a/libxfs/xfs_defer.h b/libxfs/xfs_defer.h index 7b6cc3808..a86c890e6 100644 --- a/libxfs/xfs_defer.h +++ b/libxfs/xfs_defer.h @@ -29,7 +29,7 @@ struct xfs_defer_pending { struct list_head dfp_list; /* pending items */ struct list_head dfp_work; /* work items */ struct xfs_log_item *dfp_intent; /* log intent item */ - void *dfp_done; /* log done item */ + struct xfs_log_item *dfp_done; /* log done item */ unsigned int dfp_count; /* # extent items */ enum xfs_defer_ops_type dfp_type; }; @@ -46,10 +46,10 @@ struct xfs_defer_op_type { struct xfs_log_item *(*create_intent)(struct xfs_trans *tp, 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 *, - void **); + struct xfs_log_item *(*create_done)(struct xfs_trans *tp, + struct xfs_log_item *intent, unsigned int count); + int (*finish_item)(struct xfs_trans *tp, struct xfs_log_item *done, + struct list_head *item, void **state); void (*finish_cleanup)(struct xfs_trans *, void *, int); void (*cancel_item)(struct list_head *); unsigned int max_items;