]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: factor out nodiscard helpers
authorBrian Foster <bfoster@redhat.com>
Thu, 28 Jun 2018 20:11:56 +0000 (15:11 -0500)
committerEric Sandeen <sandeen@redhat.com>
Thu, 28 Jun 2018 20:11:56 +0000 (15:11 -0500)
Source kernel commit: 4e529339af15226a30e0ca044aa2d78ba3518494

The changes to skip discards of speculative preallocation and
unwritten extents introduced several new wrapper functions through
the bunmapi -> extent free codepath to reduce churn in all of the
associated callers. In several cases, these wrappers simply toggle a
single flag to skip or not skip discards for the resulting blocks.

The explicit _nodiscard() wrappers for such an isolated set of
callers is a bit overkill. Kill off these wrappers and replace with
the calls to the underlying functions in the contexts that need to
control discard behavior. Retain the wrappers that preserve the
original calling conventions to serve the original purpose of
reducing code churn.

This is a refactoring patch and does not change behavior.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
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/xfs_alloc.h
libxfs/xfs_bmap.c
libxfs/xfs_bmap.h

index 1dcac78586b46ede7d7e48a159feb35940badd36..46d48c6f83b7bad9100b4479b6bd02a1845338ec 100644 (file)
@@ -210,17 +210,6 @@ xfs_free_extent(
        return __xfs_free_extent(tp, bno, len, oinfo, type, false);
 }
 
-static inline int
-xfs_free_extent_nodiscard(
-       struct xfs_trans        *tp,
-       xfs_fsblock_t           bno,
-       xfs_extlen_t            len,
-       struct xfs_owner_info   *oinfo,
-       enum xfs_ag_resv_type   type)
-{
-       return __xfs_free_extent(tp, bno, len, oinfo, type, true);
-}
-
 int                            /* error */
 xfs_alloc_lookup_le(
        struct xfs_btree_cur    *cur,   /* btree cursor */
index ee3a13d33a6afb55ec5138b524cc4df1b21eced1..6488ce700f1b43c68699863c3bd7c02b23f22f0e 100644 (file)
@@ -5107,15 +5107,10 @@ xfs_bmap_del_extent_real(
                        if (error)
                                goto done;
                } else {
-                       if ((bflags & XFS_BMAPI_NODISCARD) ||
-                           (del->br_state == XFS_EXT_UNWRITTEN)) {
-                               xfs_bmap_add_free_nodiscard(mp, dfops,
-                                       del->br_startblock, del->br_blockcount,
-                                       NULL);
-                       } else {
-                               xfs_bmap_add_free(mp, dfops, del->br_startblock,
-                                       del->br_blockcount, NULL);
-                       }
+                       __xfs_bmap_add_free(mp, dfops, del->br_startblock,
+                                       del->br_blockcount, NULL,
+                                       (bflags & XFS_BMAPI_NODISCARD) ||
+                                       del->br_state == XFS_EXT_UNWRITTEN);
                }
        }
 
index c46b73d1cb5bbdc03843c5932a8dea78431a89b3..6046012674c87c49469065bd7df16608cccc2903 100644 (file)
@@ -260,17 +260,6 @@ xfs_bmap_add_free(
        __xfs_bmap_add_free(mp, dfops, bno, len, oinfo, false);
 }
 
-static inline void
-xfs_bmap_add_free_nodiscard(
-       struct xfs_mount                *mp,
-       struct xfs_defer_ops            *dfops,
-       xfs_fsblock_t                   bno,
-       xfs_filblks_t                   len,
-       struct xfs_owner_info           *oinfo)
-{
-       __xfs_bmap_add_free(mp, dfops, bno, len, oinfo, true);
-}
-
 enum xfs_bmap_intent_type {
        XFS_BMAP_MAP = 1,
        XFS_BMAP_UNMAP,