From: Christoph Hellwig Date: Mon, 10 Aug 2020 20:32:04 +0000 (-0400) Subject: xfs: merge the ->diff_items defer op into ->create_intent X-Git-Tag: v5.8.0-rc0~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74a7f5fa91481785684f553aafe87215a814f73d;p=thirdparty%2Fxfsprogs-dev.git xfs: merge the ->diff_items defer op into ->create_intent Source kernel commit: d367a868e46b025a8ced8e00ef2b3a3c2f3bf732 This avoids a per-item indirect call, and also simplifies the interface 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 --- diff --git a/libxfs/defer_item.c b/libxfs/defer_item.c index 27278c514..49ddf38b9 100644 --- a/libxfs/defer_item.c +++ b/libxfs/defer_item.c @@ -47,8 +47,13 @@ STATIC void * xfs_extent_free_create_intent( struct xfs_trans *tp, struct list_head *items, - unsigned int count) + unsigned int count, + bool sort) { + struct xfs_mount *mp = tp->t_mountp; + + if (sort) + list_sort(mp, items, xfs_extent_free_diff_items); return NULL; } @@ -100,7 +105,6 @@ xfs_extent_free_cancel_item( } 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, .create_done = xfs_extent_free_create_done, @@ -141,7 +145,6 @@ xfs_agfl_free_finish_item( /* sub-type with special handling for AGFL deferred frees */ 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, .create_done = xfs_extent_free_create_done, @@ -173,8 +176,13 @@ STATIC void * xfs_rmap_update_create_intent( struct xfs_trans *tp, struct list_head *items, - unsigned int count) + unsigned int count, + bool sort) { + struct xfs_mount *mp = tp->t_mountp; + + if (sort) + list_sort(mp, items, xfs_rmap_update_diff_items); return NULL; } @@ -243,7 +251,6 @@ xfs_rmap_update_cancel_item( } 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, .create_done = xfs_rmap_update_create_done, @@ -276,8 +283,13 @@ STATIC void * xfs_refcount_update_create_intent( struct xfs_trans *tp, struct list_head *items, - unsigned int count) + unsigned int count, + bool sort) { + struct xfs_mount *mp = tp->t_mountp; + + if (sort) + list_sort(mp, items, xfs_refcount_update_diff_items); return NULL; } @@ -354,7 +366,6 @@ xfs_refcount_update_cancel_item( } 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, .create_done = xfs_refcount_update_create_done, @@ -385,8 +396,13 @@ STATIC void * xfs_bmap_update_create_intent( struct xfs_trans *tp, struct list_head *items, - unsigned int count) + unsigned int count, + bool sort) { + struct xfs_mount *mp = tp->t_mountp; + + if (sort) + list_sort(mp, items, xfs_bmap_update_diff_items); return NULL; } @@ -449,7 +465,6 @@ xfs_bmap_update_cancel_item( } 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, .create_done = xfs_bmap_update_create_done, diff --git a/libxfs/xfs_defer.c b/libxfs/xfs_defer.c index b31012e00..56bc695e6 100644 --- a/libxfs/xfs_defer.c +++ b/libxfs/xfs_defer.c @@ -184,11 +184,8 @@ xfs_defer_create_intent( { 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_count); + dfp->dfp_count, sort); } /* diff --git a/libxfs/xfs_defer.h b/libxfs/xfs_defer.h index d6a4577c2..660f5c382 100644 --- a/libxfs/xfs_defer.h +++ b/libxfs/xfs_defer.h @@ -49,9 +49,8 @@ struct xfs_defer_op_type { void **); 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 *tp, struct list_head *items, - unsigned int count); + unsigned int count, bool sort); unsigned int max_items; };