]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/xfs/xfs_bmap_util.c
xfs: fix up xfs_swap_extent_forks inline extent handling
[karo-tx-linux.git] / fs / xfs / xfs_bmap_util.c
index 552465e011ecb0df23aaeae57b94108dcdd24360..47074e0c33f3c82b86157926cd55511bb4e6ecaf 100644 (file)
@@ -1792,6 +1792,7 @@ xfs_swap_extent_forks(
        struct xfs_ifork        tempifp, *ifp, *tifp;
        int                     aforkblks = 0;
        int                     taforkblks = 0;
+       xfs_extnum_t            nextents;
        __uint64_t              tmp;
        int                     error;
 
@@ -1881,7 +1882,8 @@ xfs_swap_extent_forks(
                 * pointer.  Otherwise it's already NULL or
                 * pointing to the extent.
                 */
-               if (ip->i_d.di_nextents <= XFS_INLINE_EXTS) {
+               nextents = ip->i_df.if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
+               if (nextents <= XFS_INLINE_EXTS) {
                        ifp->if_u1.if_extents =
                                ifp->if_u2.if_inline_ext;
                }
@@ -1900,7 +1902,8 @@ xfs_swap_extent_forks(
                 * pointer.  Otherwise it's already NULL or
                 * pointing to the extent.
                 */
-               if (tip->i_d.di_nextents <= XFS_INLINE_EXTS) {
+               nextents = tip->i_df.if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
+               if (nextents <= XFS_INLINE_EXTS) {
                        tifp->if_u1.if_extents =
                                tifp->if_u2.if_inline_ext;
                }