]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: merge the ->diff_items defer op into ->create_intent
authorChristoph Hellwig <hch@lst.de>
Mon, 10 Aug 2020 20:32:04 +0000 (16:32 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Mon, 10 Aug 2020 20:32:04 +0000 (16:32 -0400)
Source kernel commit: d367a868e46b025a8ced8e00ef2b3a3c2f3bf732

This avoids a per-item indirect call, and also simplifies the interface
a bit.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/defer_item.c
libxfs/xfs_defer.c
libxfs/xfs_defer.h

index 27278c5149d3c37227b6877dcfda429681d88957..49ddf38b93fc65329b6d27a3262f2b27d690c21c 100644 (file)
@@ -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,
index b31012e00f0d3353c2c2025ee8bb72d3e66bdf68..56bc695e6c173bb1fc72408a01d13ed3896fd7d8 100644 (file)
@@ -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);
 }
 
 /*
index d6a4577c25b05fe1eb9f2d7ae06697cece5eb4bb..660f5c3821d6b950b9b93d9688fec4e2fb8e9d20 100644 (file)
@@ -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;
 };