]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: skip always_cow inodes in xfs_reflink_trim_around_shared
authorChristoph Hellwig <hch@lst.de>
Sat, 14 Oct 2023 05:50:35 +0000 (07:50 +0200)
committerChristoph Hellwig <hch@lst.de>
Mon, 3 Feb 2025 04:49:06 +0000 (05:49 +0100)
xfs_reflink_trim_around_shared tries to find shared blocks in the
refcount btree.  Always_cow inodes don't have that tree, so don't
bother.

For the existing always_cow code this is a minor optimization.  For
the upcoming zoned code that can do COW without the rtreflink code it
avoids triggering a NULL pointer dereference.

Signed-off-by: Christoph Hellwig <hch@lst.de>
fs/xfs/xfs_reflink.c

index 59f7fc16eb8093ba74a5b31e61372163d58808fe..3e778e077d09377ed3d730cba4d244307469e31e 100644 (file)
@@ -235,7 +235,7 @@ xfs_reflink_trim_around_shared(
        int                     error = 0;
 
        /* Holes, unwritten, and delalloc extents cannot be shared */
-       if (!xfs_is_cow_inode(ip) || !xfs_bmap_is_written_extent(irec)) {
+       if (!xfs_is_reflink_inode(ip) || !xfs_bmap_is_written_extent(irec)) {
                *shared = false;
                return 0;
        }