xfs: introduce XFS_MAX_FILEOFF
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 2 Jan 2020 21:25:00 +0000 (13:25 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Tue, 14 Jan 2020 16:02:51 +0000 (08:02 -0800)
Introduce a new #define for the maximum supported file block offset.
We'll use this in the next patch to make it more obvious that we're
doing some operation for all possible inode fork mappings after a given
offset.  We can't use ULLONG_MAX here because bunmapi uses that to
detect when it's done.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/libxfs/xfs_format.h
fs/xfs/xfs_reflink.c

index 1b7dcbae051c5fc6e8ccb85922d17b4e87d28b43..77e9fa38598042048d74f7c689c21f6b8564aad3 100644 (file)
@@ -1540,6 +1540,13 @@ typedef struct xfs_bmdr_block {
 #define BMBT_BLOCKCOUNT_BITLEN 21
 
 #define BMBT_STARTOFF_MASK     ((1ULL << BMBT_STARTOFF_BITLEN) - 1)
+#define BMBT_BLOCKCOUNT_MASK   ((1ULL << BMBT_BLOCKCOUNT_BITLEN) - 1)
+
+/*
+ * bmbt records have a file offset (block) field that is 54 bits wide, so this
+ * is the largest xfs_fileoff_t that we ever expect to see.
+ */
+#define XFS_MAX_FILEOFF                (BMBT_STARTOFF_MASK + BMBT_BLOCKCOUNT_MASK)
 
 typedef struct xfs_bmbt_rec {
        __be64                  l0, l1;
index de451235c4ee3aa64004bf660d926f18fe5dc83a..7a6c94295b8acc952b6b2179863071ad1833035e 100644 (file)
@@ -1457,7 +1457,8 @@ xfs_reflink_clear_inode_flag(
         * We didn't find any shared blocks so turn off the reflink flag.
         * First, get rid of any leftover CoW mappings.
         */
-       error = xfs_reflink_cancel_cow_blocks(ip, tpp, 0, NULLFILEOFF, true);
+       error = xfs_reflink_cancel_cow_blocks(ip, tpp, 0, XFS_MAX_FILEOFF,
+                       true);
        if (error)
                return error;