From 8d81fcd0b41954f98fdaa0de05e272d9e4504720 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Mon, 10 Aug 2020 16:32:04 -0400 Subject: [PATCH] xfs: merge the ->log_item defer op into ->create_intent Source kernel commit: c1f09188e8de0ae65433cb9c8ace4feb66359bcc These are aways called together, and my merging them we reduce the amount of indirect calls, improve type safety and in general clean up the code a bit. 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 --- libxfs/defer_item.c | 45 ++++----------------------------------------- libxfs/xfs_defer.c | 6 ++---- libxfs/xfs_defer.h | 4 ++-- 3 files changed, 8 insertions(+), 47 deletions(-) diff --git a/libxfs/defer_item.c b/libxfs/defer_item.c index 2ebc12bdd..27278c514 100644 --- a/libxfs/defer_item.c +++ b/libxfs/defer_item.c @@ -46,20 +46,12 @@ xfs_extent_free_diff_items( STATIC void * xfs_extent_free_create_intent( struct xfs_trans *tp, + struct list_head *items, unsigned int count) { return NULL; } -/* Log a free extent to the intent item. */ -STATIC void -xfs_extent_free_log_item( - struct xfs_trans *tp, - void *intent, - struct list_head *item) -{ -} - /* Get an EFD so we can process all the free extents. */ STATIC void * xfs_extent_free_create_done( @@ -111,7 +103,6 @@ const struct xfs_defer_op_type xfs_extent_free_defer_type = { .diff_items = xfs_extent_free_diff_items, .create_intent = xfs_extent_free_create_intent, .abort_intent = xfs_extent_free_abort_intent, - .log_item = xfs_extent_free_log_item, .create_done = xfs_extent_free_create_done, .finish_item = xfs_extent_free_finish_item, .cancel_item = xfs_extent_free_cancel_item, @@ -153,7 +144,6 @@ const struct xfs_defer_op_type xfs_agfl_free_defer_type = { .diff_items = xfs_extent_free_diff_items, .create_intent = xfs_extent_free_create_intent, .abort_intent = xfs_extent_free_abort_intent, - .log_item = xfs_extent_free_log_item, .create_done = xfs_extent_free_create_done, .finish_item = xfs_agfl_free_finish_item, .cancel_item = xfs_extent_free_cancel_item, @@ -182,20 +172,12 @@ xfs_rmap_update_diff_items( STATIC void * xfs_rmap_update_create_intent( struct xfs_trans *tp, + struct list_head *items, unsigned int count) { return NULL; } -/* Log rmap updates in the intent item. */ -STATIC void -xfs_rmap_update_log_item( - struct xfs_trans *tp, - void *intent, - struct list_head *item) -{ -} - /* Get an RUD so we can process all the deferred rmap updates. */ STATIC void * xfs_rmap_update_create_done( @@ -264,7 +246,6 @@ const struct xfs_defer_op_type xfs_rmap_update_defer_type = { .diff_items = xfs_rmap_update_diff_items, .create_intent = xfs_rmap_update_create_intent, .abort_intent = xfs_rmap_update_abort_intent, - .log_item = xfs_rmap_update_log_item, .create_done = xfs_rmap_update_create_done, .finish_item = xfs_rmap_update_finish_item, .finish_cleanup = xfs_rmap_update_finish_cleanup, @@ -294,20 +275,12 @@ xfs_refcount_update_diff_items( STATIC void * xfs_refcount_update_create_intent( struct xfs_trans *tp, + struct list_head *items, unsigned int count) { return NULL; } -/* Log refcount updates in the intent item. */ -STATIC void -xfs_refcount_update_log_item( - struct xfs_trans *tp, - void *intent, - struct list_head *item) -{ -} - /* Get an CUD so we can process all the deferred refcount updates. */ STATIC void * xfs_refcount_update_create_done( @@ -384,7 +357,6 @@ const struct xfs_defer_op_type xfs_refcount_update_defer_type = { .diff_items = xfs_refcount_update_diff_items, .create_intent = xfs_refcount_update_create_intent, .abort_intent = xfs_refcount_update_abort_intent, - .log_item = xfs_refcount_update_log_item, .create_done = xfs_refcount_update_create_done, .finish_item = xfs_refcount_update_finish_item, .finish_cleanup = xfs_refcount_update_finish_cleanup, @@ -412,20 +384,12 @@ xfs_bmap_update_diff_items( STATIC void * xfs_bmap_update_create_intent( struct xfs_trans *tp, + struct list_head *items, unsigned int count) { return NULL; } -/* Log bmap updates in the intent item. */ -STATIC void -xfs_bmap_update_log_item( - struct xfs_trans *tp, - void *intent, - struct list_head *item) -{ -} - /* Get an BUD so we can process all the deferred rmap updates. */ STATIC void * xfs_bmap_update_create_done( @@ -488,7 +452,6 @@ const struct xfs_defer_op_type xfs_bmap_update_defer_type = { .diff_items = xfs_bmap_update_diff_items, .create_intent = xfs_bmap_update_create_intent, .abort_intent = xfs_bmap_update_abort_intent, - .log_item = xfs_bmap_update_log_item, .create_done = xfs_bmap_update_create_done, .finish_item = xfs_bmap_update_finish_item, .cancel_item = xfs_bmap_update_cancel_item, diff --git a/libxfs/xfs_defer.c b/libxfs/xfs_defer.c index eeb167fb2..b31012e00 100644 --- a/libxfs/xfs_defer.c +++ b/libxfs/xfs_defer.c @@ -183,14 +183,12 @@ xfs_defer_create_intent( bool sort) { const struct xfs_defer_op_type *ops = defer_op_types[dfp->dfp_type]; - struct list_head *li; if (sort) list_sort(tp->t_mountp, &dfp->dfp_work, ops->diff_items); - dfp->dfp_intent = ops->create_intent(tp, dfp->dfp_count); - list_for_each(li, &dfp->dfp_work) - ops->log_item(tp, dfp->dfp_intent, li); + dfp->dfp_intent = ops->create_intent(tp, &dfp->dfp_work, + dfp->dfp_count); } /* diff --git a/libxfs/xfs_defer.h b/libxfs/xfs_defer.h index 7c28d7608..d6a4577c2 100644 --- a/libxfs/xfs_defer.h +++ b/libxfs/xfs_defer.h @@ -50,8 +50,8 @@ struct xfs_defer_op_type { void (*finish_cleanup)(struct xfs_trans *, void *, int); void (*cancel_item)(struct list_head *); int (*diff_items)(void *, struct list_head *, struct list_head *); - void *(*create_intent)(struct xfs_trans *, uint); - void (*log_item)(struct xfs_trans *, void *, struct list_head *); + void *(*create_intent)(struct xfs_trans *tp, struct list_head *items, + unsigned int count); unsigned int max_items; }; -- 2.47.3