]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: merge the ->log_item 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: 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 <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 2ebc12bdda3fd88be0dfe3dbb577b3520a5d488f..27278c5149d3c37227b6877dcfda429681d88957 100644 (file)
@@ -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,
index eeb167fb2c676ba2b0a733cbe20e54f90910b201..b31012e00f0d3353c2c2025ee8bb72d3e66bdf68 100644 (file)
@@ -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);
 }
 
 /*
index 7c28d7608ac620d1ecb79f87084de788e6996890..d6a4577c25b05fe1eb9f2d7ae06697cece5eb4bb 100644 (file)
@@ -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;
 };