Merge tag 'docs-5.15-2' of git://git.lwn.net/linux
[linux-2.6-microblaze.git] / fs / xfs / xfs_iomap.c
index d8cd258..0937584 100644 (file)
@@ -132,7 +132,7 @@ xfs_eof_alignment(
                 * If mounted with the "-o swalloc" option the alignment is
                 * increased from the strip unit size to the stripe width.
                 */
-               if (mp->m_swidth && (mp->m_flags & XFS_MOUNT_SWALLOC))
+               if (mp->m_swidth && xfs_has_swalloc(mp))
                        align = mp->m_swidth;
                else if (mp->m_dalign)
                        align = mp->m_dalign;
@@ -734,7 +734,7 @@ xfs_direct_write_iomap_begin(
 
        ASSERT(flags & (IOMAP_WRITE | IOMAP_ZERO));
 
-       if (XFS_FORCED_SHUTDOWN(mp))
+       if (xfs_is_shutdown(mp))
                return -EIO;
 
        /*
@@ -874,7 +874,7 @@ xfs_buffered_write_iomap_begin(
        int                     allocfork = XFS_DATA_FORK;
        int                     error = 0;
 
-       if (XFS_FORCED_SHUTDOWN(mp))
+       if (xfs_is_shutdown(mp))
                return -EIO;
 
        /* we can't use delayed allocations when using extent size hints */
@@ -994,7 +994,7 @@ xfs_buffered_write_iomap_begin(
                 * Determine the initial size of the preallocation.
                 * We clean up any extra preallocation when the file is closed.
                 */
-               if (mp->m_flags & XFS_MOUNT_ALLOCSIZE)
+               if (xfs_has_allocsize(mp))
                        prealloc_blocks = mp->m_allocsize_blocks;
                else
                        prealloc_blocks = xfs_iomap_prealloc_size(ip, allocfork,
@@ -1064,11 +1064,11 @@ found_cow:
                error = xfs_bmbt_to_iomap(ip, srcmap, &imap, 0);
                if (error)
                        return error;
-       } else {
-               xfs_trim_extent(&cmap, offset_fsb,
-                               imap.br_startoff - offset_fsb);
+               return xfs_bmbt_to_iomap(ip, iomap, &cmap, IOMAP_F_SHARED);
        }
-       return xfs_bmbt_to_iomap(ip, iomap, &cmap, IOMAP_F_SHARED);
+
+       xfs_trim_extent(&cmap, offset_fsb, imap.br_startoff - offset_fsb);
+       return xfs_bmbt_to_iomap(ip, iomap, &cmap, 0);
 
 out_unlock:
        xfs_iunlock(ip, XFS_ILOCK_EXCL);
@@ -1127,7 +1127,7 @@ xfs_buffered_write_iomap_end(
 
                error = xfs_bmap_punch_delalloc_range(ip, start_fsb,
                                               end_fsb - start_fsb);
-               if (error && !XFS_FORCED_SHUTDOWN(mp)) {
+               if (error && !xfs_is_shutdown(mp)) {
                        xfs_alert(mp, "%s: unable to clean up ino %lld",
                                __func__, ip->i_ino);
                        return error;
@@ -1162,7 +1162,7 @@ xfs_read_iomap_begin(
 
        ASSERT(!(flags & (IOMAP_WRITE | IOMAP_ZERO)));
 
-       if (XFS_FORCED_SHUTDOWN(mp))
+       if (xfs_is_shutdown(mp))
                return -EIO;
 
        error = xfs_ilock_for_iomap(ip, flags, &lockmode);
@@ -1203,7 +1203,7 @@ xfs_seek_iomap_begin(
        int                     error = 0;
        unsigned                lockmode;
 
-       if (XFS_FORCED_SHUTDOWN(mp))
+       if (xfs_is_shutdown(mp))
                return -EIO;
 
        lockmode = xfs_ilock_data_map_shared(ip);
@@ -1285,7 +1285,7 @@ xfs_xattr_iomap_begin(
        int                     nimaps = 1, error = 0;
        unsigned                lockmode;
 
-       if (XFS_FORCED_SHUTDOWN(mp))
+       if (xfs_is_shutdown(mp))
                return -EIO;
 
        lockmode = xfs_ilock_attr_map_shared(ip);