]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: turn dfp_done into a xfs_log_item
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: 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 <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 38f289655e2a65fa1d77e4f76f72b3deb87a2389..bd872d18e67b95556e763d220477844aef164abb 100644 (file)
@@ -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;
index b7b2e80228c7629e65464f7883d07d9cc4f72f0e..f4fa2c085b894a095af9523ba3fc3e5f366b2108 100644 (file)
@@ -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
index 7b6cc3808a91b0c87c3ea82f0612ac1d9d77a146..a86c890e63d20af3f6b47e13e80671372c7db481 100644 (file)
@@ -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;