]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: expose xfs_bmap_local_to_extents for online repair
authorDarrick J. Wong <djwong@kernel.org>
Mon, 29 Jul 2024 23:22:39 +0000 (16:22 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:01:00 +0000 (17:01 -0700)
Source kernel commit: ef744be416b5c649d287604730400dfa728779fe

Allow online repair to call xfs_bmap_local_to_extents and add a void *
argument at the end so that online repair can pass its own context.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_bmap.c
libxfs/xfs_bmap.h
libxfs/xfs_symlink_remote.c
libxfs/xfs_symlink_remote.h

index 8683342294a1b4c4f5d0938c48155b049fbe7257..63feb20e24b32629bf6ff1656ed128d39cb12c91 100644 (file)
@@ -773,7 +773,7 @@ xfs_bmap_local_to_extents_empty(
 }
 
 
-STATIC int                             /* error */
+int                                    /* error */
 xfs_bmap_local_to_extents(
        xfs_trans_t     *tp,            /* transaction pointer */
        xfs_inode_t     *ip,            /* incore inode pointer */
@@ -783,7 +783,8 @@ xfs_bmap_local_to_extents(
        void            (*init_fn)(struct xfs_trans *tp,
                                   struct xfs_buf *bp,
                                   struct xfs_inode *ip,
-                                  struct xfs_ifork *ifp))
+                                  struct xfs_ifork *ifp, void *priv),
+       void            *priv)
 {
        int             error = 0;
        int             flags;          /* logging flags returned */
@@ -844,7 +845,7 @@ xfs_bmap_local_to_extents(
         * log here. Note that init_fn must also set the buffer log item type
         * correctly.
         */
-       init_fn(tp, bp, ip, ifp);
+       init_fn(tp, bp, ip, ifp, priv);
 
        /* account for the change in fork size */
        xfs_idata_realloc(ip, -ifp->if_bytes, whichfork);
@@ -976,8 +977,8 @@ xfs_bmap_add_attrfork_local(
 
        if (S_ISLNK(VFS_I(ip)->i_mode))
                return xfs_bmap_local_to_extents(tp, ip, 1, flags,
-                                                XFS_DATA_FORK,
-                                                xfs_symlink_local_to_remote);
+                               XFS_DATA_FORK, xfs_symlink_local_to_remote,
+                               NULL);
 
        /* should only be called for types that support local format data */
        ASSERT(0);
index b8bdbf1560e658f41e4f6b329349e2cf217ca815..32fb2a455c294f627d8ce21ebc45971a37ba350a 100644 (file)
@@ -179,6 +179,12 @@ unsigned int xfs_bmap_compute_attr_offset(struct xfs_mount *mp);
 int    xfs_bmap_add_attrfork(struct xfs_inode *ip, int size, int rsvd);
 void   xfs_bmap_local_to_extents_empty(struct xfs_trans *tp,
                struct xfs_inode *ip, int whichfork);
+int xfs_bmap_local_to_extents(struct xfs_trans *tp, struct xfs_inode *ip,
+               xfs_extlen_t total, int *logflagsp, int whichfork,
+               void (*init_fn)(struct xfs_trans *tp, struct xfs_buf *bp,
+                               struct xfs_inode *ip, struct xfs_ifork *ifp,
+                               void *priv),
+               void *priv);
 void   xfs_bmap_compute_maxlevels(struct xfs_mount *mp, int whichfork);
 int    xfs_bmap_first_unused(struct xfs_trans *tp, struct xfs_inode *ip,
                xfs_extlen_t len, xfs_fileoff_t *unused, int whichfork);
index 72f175990f636e93b912d121bd1bddf5af518ef9..fbcd1aebb67719ea3ea96c8abf0d6f8644ace797 100644 (file)
@@ -166,7 +166,8 @@ xfs_symlink_local_to_remote(
        struct xfs_trans        *tp,
        struct xfs_buf          *bp,
        struct xfs_inode        *ip,
-       struct xfs_ifork        *ifp)
+       struct xfs_ifork        *ifp,
+       void                    *priv)
 {
        struct xfs_mount        *mp = ip->i_mount;
        char                    *buf;
index ac3dac8f617ed063c6e14a5353e347b916a42b45..83b89a1deb9f2c542e029dd9a76a7e3d9eec3516 100644 (file)
@@ -16,7 +16,8 @@ int xfs_symlink_hdr_set(struct xfs_mount *mp, xfs_ino_t ino, uint32_t offset,
 bool xfs_symlink_hdr_ok(xfs_ino_t ino, uint32_t offset,
                        uint32_t size, struct xfs_buf *bp);
 void xfs_symlink_local_to_remote(struct xfs_trans *tp, struct xfs_buf *bp,
-                                struct xfs_inode *ip, struct xfs_ifork *ifp);
+                                struct xfs_inode *ip, struct xfs_ifork *ifp,
+                                void *priv);
 xfs_failaddr_t xfs_symlink_shortform_verify(void *sfp, int64_t size);
 int xfs_symlink_remote_read(struct xfs_inode *ip, char *link);
 int xfs_symlink_write_target(struct xfs_trans *tp, struct xfs_inode *ip,