Commit 755c38ff authored by Chandan Babu R's avatar Chandan Babu R

xfs: Promote xfs_extnum_t and xfs_aextnum_t to 64 and 32-bits respectively

A future commit will introduce a 64-bit on-disk data extent counter and a
32-bit on-disk attr extent counter. This commit promotes xfs_extnum_t and
xfs_aextnum_t to 64 and 32-bits in order to correctly handle in-core versions
of these quantities.
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarChandan Babu R <chandan.babu@oracle.com>
parent 1e7384f9
...@@ -83,7 +83,7 @@ xfs_bmap_compute_maxlevels( ...@@ -83,7 +83,7 @@ xfs_bmap_compute_maxlevels(
maxrootrecs = xfs_bmdr_maxrecs(sz, 0); maxrootrecs = xfs_bmdr_maxrecs(sz, 0);
minleafrecs = mp->m_bmap_dmnr[0]; minleafrecs = mp->m_bmap_dmnr[0];
minnoderecs = mp->m_bmap_dmnr[1]; minnoderecs = mp->m_bmap_dmnr[1];
maxblocks = (maxleafents + minleafrecs - 1) / minleafrecs; maxblocks = howmany_64(maxleafents, minleafrecs);
for (level = 1; maxblocks > 1; level++) { for (level = 1; maxblocks > 1; level++) {
if (maxblocks <= maxrootrecs) if (maxblocks <= maxrootrecs)
maxblocks = 1; maxblocks = 1;
...@@ -467,7 +467,7 @@ xfs_bmap_check_leaf_extents( ...@@ -467,7 +467,7 @@ xfs_bmap_check_leaf_extents(
if (bp_release) if (bp_release)
xfs_trans_brelse(NULL, bp); xfs_trans_brelse(NULL, bp);
error_norelse: error_norelse:
xfs_warn(mp, "%s: BAD after btree leaves for %d extents", xfs_warn(mp, "%s: BAD after btree leaves for %llu extents",
__func__, i); __func__, i);
xfs_err(mp, "%s: CORRUPTED BTREE OR SOMETHING", __func__); xfs_err(mp, "%s: CORRUPTED BTREE OR SOMETHING", __func__);
xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
......
...@@ -117,8 +117,8 @@ xfs_iformat_extents( ...@@ -117,8 +117,8 @@ xfs_iformat_extents(
* we just bail out rather than crash in kmem_alloc() or memcpy() below. * we just bail out rather than crash in kmem_alloc() or memcpy() below.
*/ */
if (unlikely(size < 0 || size > XFS_DFORK_SIZE(dip, mp, whichfork))) { if (unlikely(size < 0 || size > XFS_DFORK_SIZE(dip, mp, whichfork))) {
xfs_warn(ip->i_mount, "corrupt inode %Lu ((a)extents = %d).", xfs_warn(ip->i_mount, "corrupt inode %llu ((a)extents = %llu).",
(unsigned long long) ip->i_ino, nex); ip->i_ino, nex);
xfs_inode_verifier_error(ip, -EFSCORRUPTED, xfs_inode_verifier_error(ip, -EFSCORRUPTED,
"xfs_iformat_extents(1)", dip, sizeof(*dip), "xfs_iformat_extents(1)", dip, sizeof(*dip),
__this_address); __this_address);
......
...@@ -21,9 +21,9 @@ struct xfs_ifork { ...@@ -21,9 +21,9 @@ struct xfs_ifork {
void *if_root; /* extent tree root */ void *if_root; /* extent tree root */
char *if_data; /* inline file data */ char *if_data; /* inline file data */
} if_u1; } if_u1;
xfs_extnum_t if_nextents; /* # of extents in this fork */
short if_broot_bytes; /* bytes allocated for root */ short if_broot_bytes; /* bytes allocated for root */
int8_t if_format; /* format of this fork */ int8_t if_format; /* format of this fork */
xfs_extnum_t if_nextents; /* # of extents in this fork */
}; };
/* /*
......
...@@ -12,8 +12,8 @@ typedef uint32_t xfs_agblock_t; /* blockno in alloc. group */ ...@@ -12,8 +12,8 @@ typedef uint32_t xfs_agblock_t; /* blockno in alloc. group */
typedef uint32_t xfs_agino_t; /* inode # within allocation grp */ typedef uint32_t xfs_agino_t; /* inode # within allocation grp */
typedef uint32_t xfs_extlen_t; /* extent length in blocks */ typedef uint32_t xfs_extlen_t; /* extent length in blocks */
typedef uint32_t xfs_agnumber_t; /* allocation group number */ typedef uint32_t xfs_agnumber_t; /* allocation group number */
typedef int32_t xfs_extnum_t; /* # of extents in a file */ typedef uint64_t xfs_extnum_t; /* # of extents in a file */
typedef int16_t xfs_aextnum_t; /* # extents in an attribute fork */ typedef uint32_t xfs_aextnum_t; /* # extents in an attribute fork */
typedef int64_t xfs_fsize_t; /* bytes in a file */ typedef int64_t xfs_fsize_t; /* bytes in a file */
typedef uint64_t xfs_ufsize_t; /* unsigned bytes in a file */ typedef uint64_t xfs_ufsize_t; /* unsigned bytes in a file */
......
...@@ -3515,8 +3515,8 @@ xfs_iflush( ...@@ -3515,8 +3515,8 @@ xfs_iflush(
if (XFS_TEST_ERROR(ip->i_df.if_nextents + xfs_ifork_nextents(ip->i_afp) > if (XFS_TEST_ERROR(ip->i_df.if_nextents + xfs_ifork_nextents(ip->i_afp) >
ip->i_nblocks, mp, XFS_ERRTAG_IFLUSH_5)) { ip->i_nblocks, mp, XFS_ERRTAG_IFLUSH_5)) {
xfs_alert_tag(mp, XFS_PTAG_IFLUSH, xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
"%s: detected corrupt incore inode %Lu, " "%s: detected corrupt incore inode %llu, "
"total extents = %d, nblocks = %Ld, ptr "PTR_FMT, "total extents = %llu nblocks = %lld, ptr "PTR_FMT,
__func__, ip->i_ino, __func__, ip->i_ino,
ip->i_df.if_nextents + xfs_ifork_nextents(ip->i_afp), ip->i_df.if_nextents + xfs_ifork_nextents(ip->i_afp),
ip->i_nblocks, ip); ip->i_nblocks, ip);
......
...@@ -2182,7 +2182,7 @@ DECLARE_EVENT_CLASS(xfs_swap_extent_class, ...@@ -2182,7 +2182,7 @@ DECLARE_EVENT_CLASS(xfs_swap_extent_class,
__entry->broot_size = ip->i_df.if_broot_bytes; __entry->broot_size = ip->i_df.if_broot_bytes;
__entry->fork_off = XFS_IFORK_BOFF(ip); __entry->fork_off = XFS_IFORK_BOFF(ip);
), ),
TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, " TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %llu, "
"broot size %d, forkoff 0x%x", "broot size %d, forkoff 0x%x",
MAJOR(__entry->dev), MINOR(__entry->dev), MAJOR(__entry->dev), MINOR(__entry->dev),
__entry->ino, __entry->ino,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment