diff options
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r-- | fs/xfs/xfs_inode.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index ccd619a993f6..96b29e3286db 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -299,11 +299,8 @@ xfs_iformat( | |||
299 | { | 299 | { |
300 | xfs_attr_shortform_t *atp; | 300 | xfs_attr_shortform_t *atp; |
301 | int size; | 301 | int size; |
302 | int error; | 302 | int error = 0; |
303 | xfs_fsize_t di_size; | 303 | xfs_fsize_t di_size; |
304 | ip->i_df.if_ext_max = | ||
305 | XFS_IFORK_DSIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t); | ||
306 | error = 0; | ||
307 | 304 | ||
308 | if (unlikely(be32_to_cpu(dip->di_nextents) + | 305 | if (unlikely(be32_to_cpu(dip->di_nextents) + |
309 | be16_to_cpu(dip->di_anextents) > | 306 | be16_to_cpu(dip->di_anextents) > |
@@ -409,10 +406,10 @@ xfs_iformat( | |||
409 | } | 406 | } |
410 | if (!XFS_DFORK_Q(dip)) | 407 | if (!XFS_DFORK_Q(dip)) |
411 | return 0; | 408 | return 0; |
409 | |||
412 | ASSERT(ip->i_afp == NULL); | 410 | ASSERT(ip->i_afp == NULL); |
413 | ip->i_afp = kmem_zone_zalloc(xfs_ifork_zone, KM_SLEEP | KM_NOFS); | 411 | ip->i_afp = kmem_zone_zalloc(xfs_ifork_zone, KM_SLEEP | KM_NOFS); |
414 | ip->i_afp->if_ext_max = | 412 | |
415 | XFS_IFORK_ASIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t); | ||
416 | switch (dip->di_aformat) { | 413 | switch (dip->di_aformat) { |
417 | case XFS_DINODE_FMT_LOCAL: | 414 | case XFS_DINODE_FMT_LOCAL: |
418 | atp = (xfs_attr_shortform_t *)XFS_DFORK_APTR(dip); | 415 | atp = (xfs_attr_shortform_t *)XFS_DFORK_APTR(dip); |
@@ -604,10 +601,11 @@ xfs_iformat_btree( | |||
604 | * or the number of extents is greater than the number of | 601 | * or the number of extents is greater than the number of |
605 | * blocks. | 602 | * blocks. |
606 | */ | 603 | */ |
607 | if (unlikely(XFS_IFORK_NEXTENTS(ip, whichfork) <= ifp->if_ext_max | 604 | if (unlikely(XFS_IFORK_NEXTENTS(ip, whichfork) <= |
608 | || XFS_BMDR_SPACE_CALC(nrecs) > | 605 | XFS_IFORK_MAXEXT(ip, whichfork) || |
609 | XFS_DFORK_SIZE(dip, ip->i_mount, whichfork) | 606 | XFS_BMDR_SPACE_CALC(nrecs) > |
610 | || XFS_IFORK_NEXTENTS(ip, whichfork) > ip->i_d.di_nblocks)) { | 607 | XFS_DFORK_SIZE(dip, ip->i_mount, whichfork) || |
608 | XFS_IFORK_NEXTENTS(ip, whichfork) > ip->i_d.di_nblocks)) { | ||
611 | xfs_warn(ip->i_mount, "corrupt inode %Lu (btree).", | 609 | xfs_warn(ip->i_mount, "corrupt inode %Lu (btree).", |
612 | (unsigned long long) ip->i_ino); | 610 | (unsigned long long) ip->i_ino); |
613 | XFS_CORRUPTION_ERROR("xfs_iformat_btree", XFS_ERRLEVEL_LOW, | 611 | XFS_CORRUPTION_ERROR("xfs_iformat_btree", XFS_ERRLEVEL_LOW, |
@@ -835,12 +833,6 @@ xfs_iread( | |||
835 | * with the uninitialized part of it. | 833 | * with the uninitialized part of it. |
836 | */ | 834 | */ |
837 | ip->i_d.di_mode = 0; | 835 | ip->i_d.di_mode = 0; |
838 | /* | ||
839 | * Initialize the per-fork minima and maxima for a new | ||
840 | * inode here. xfs_iformat will do it for old inodes. | ||
841 | */ | ||
842 | ip->i_df.if_ext_max = | ||
843 | XFS_IFORK_DSIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t); | ||
844 | } | 836 | } |
845 | 837 | ||
846 | /* | 838 | /* |
@@ -1740,8 +1732,6 @@ xfs_ifree( | |||
1740 | ip->i_d.di_flags = 0; | 1732 | ip->i_d.di_flags = 0; |
1741 | ip->i_d.di_dmevmask = 0; | 1733 | ip->i_d.di_dmevmask = 0; |
1742 | ip->i_d.di_forkoff = 0; /* mark the attr fork not in use */ | 1734 | ip->i_d.di_forkoff = 0; /* mark the attr fork not in use */ |
1743 | ip->i_df.if_ext_max = | ||
1744 | XFS_IFORK_DSIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t); | ||
1745 | ip->i_d.di_format = XFS_DINODE_FMT_EXTENTS; | 1735 | ip->i_d.di_format = XFS_DINODE_FMT_EXTENTS; |
1746 | ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS; | 1736 | ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS; |
1747 | /* | 1737 | /* |
@@ -2408,7 +2398,7 @@ xfs_iflush( | |||
2408 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); | 2398 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); |
2409 | ASSERT(!completion_done(&ip->i_flush)); | 2399 | ASSERT(!completion_done(&ip->i_flush)); |
2410 | ASSERT(ip->i_d.di_format != XFS_DINODE_FMT_BTREE || | 2400 | ASSERT(ip->i_d.di_format != XFS_DINODE_FMT_BTREE || |
2411 | ip->i_d.di_nextents > ip->i_df.if_ext_max); | 2401 | ip->i_d.di_nextents > XFS_IFORK_MAXEXT(ip, XFS_DATA_FORK)); |
2412 | 2402 | ||
2413 | iip = ip->i_itemp; | 2403 | iip = ip->i_itemp; |
2414 | mp = ip->i_mount; | 2404 | mp = ip->i_mount; |
@@ -2524,7 +2514,7 @@ xfs_iflush_int( | |||
2524 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); | 2514 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); |
2525 | ASSERT(!completion_done(&ip->i_flush)); | 2515 | ASSERT(!completion_done(&ip->i_flush)); |
2526 | ASSERT(ip->i_d.di_format != XFS_DINODE_FMT_BTREE || | 2516 | ASSERT(ip->i_d.di_format != XFS_DINODE_FMT_BTREE || |
2527 | ip->i_d.di_nextents > ip->i_df.if_ext_max); | 2517 | ip->i_d.di_nextents > XFS_IFORK_MAXEXT(ip, XFS_DATA_FORK)); |
2528 | 2518 | ||
2529 | iip = ip->i_itemp; | 2519 | iip = ip->i_itemp; |
2530 | mp = ip->i_mount; | 2520 | mp = ip->i_mount; |