diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-26 13:49:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-26 13:49:11 -0400 |
commit | 8a0599dd2471f2a2e409498c08a0ab339057ad06 (patch) | |
tree | c23c72f3eb4a95d8854720be9d8a228d4adae54a /fs/xfs/xfs_inode.c | |
parent | 35806b4f7c5620b547f183e9d53f7cfaeabb582b (diff) | |
parent | 233eebb9a96f956c541c0c9094fd321894bd93a7 (diff) |
Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs
* 'for-linus' of git://oss.sgi.com/xfs/xfs:
xfs: correctly decrement the extent buffer index in xfs_bmap_del_extent
xfs: check for valid indices in xfs_iext_get_ext and xfs_iext_idx_to_irec
xfs: fix up asserts in xfs_iflush_fork
xfs: do not do pointer arithmetic on extent records
xfs: do not use unchecked extent indices in xfs_bunmapi
xfs: do not use unchecked extent indices in xfs_bmapi
xfs: do not use unchecked extent indices in xfs_bmap_add_extent_*
xfs: remove if_lastex
xfs: remove the unused XFS_BMAPI_RSVBLOCKS flag
xfs: do not discard alloc btree blocks
xfs: add online discard support
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r-- | fs/xfs/xfs_inode.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index c8e3349c287c..a098a20ca63e 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -920,7 +920,6 @@ xfs_iread_extents( | |||
920 | /* | 920 | /* |
921 | * We know that the size is valid (it's checked in iformat_btree) | 921 | * We know that the size is valid (it's checked in iformat_btree) |
922 | */ | 922 | */ |
923 | ifp->if_lastex = NULLEXTNUM; | ||
924 | ifp->if_bytes = ifp->if_real_bytes = 0; | 923 | ifp->if_bytes = ifp->if_real_bytes = 0; |
925 | ifp->if_flags |= XFS_IFEXTENTS; | 924 | ifp->if_flags |= XFS_IFEXTENTS; |
926 | xfs_iext_add(ifp, 0, nextents); | 925 | xfs_iext_add(ifp, 0, nextents); |
@@ -2558,12 +2557,9 @@ xfs_iflush_fork( | |||
2558 | case XFS_DINODE_FMT_EXTENTS: | 2557 | case XFS_DINODE_FMT_EXTENTS: |
2559 | ASSERT((ifp->if_flags & XFS_IFEXTENTS) || | 2558 | ASSERT((ifp->if_flags & XFS_IFEXTENTS) || |
2560 | !(iip->ili_format.ilf_fields & extflag[whichfork])); | 2559 | !(iip->ili_format.ilf_fields & extflag[whichfork])); |
2561 | ASSERT((xfs_iext_get_ext(ifp, 0) != NULL) || | ||
2562 | (ifp->if_bytes == 0)); | ||
2563 | ASSERT((xfs_iext_get_ext(ifp, 0) == NULL) || | ||
2564 | (ifp->if_bytes > 0)); | ||
2565 | if ((iip->ili_format.ilf_fields & extflag[whichfork]) && | 2560 | if ((iip->ili_format.ilf_fields & extflag[whichfork]) && |
2566 | (ifp->if_bytes > 0)) { | 2561 | (ifp->if_bytes > 0)) { |
2562 | ASSERT(xfs_iext_get_ext(ifp, 0)); | ||
2567 | ASSERT(XFS_IFORK_NEXTENTS(ip, whichfork) > 0); | 2563 | ASSERT(XFS_IFORK_NEXTENTS(ip, whichfork) > 0); |
2568 | (void)xfs_iextents_copy(ip, (xfs_bmbt_rec_t *)cp, | 2564 | (void)xfs_iextents_copy(ip, (xfs_bmbt_rec_t *)cp, |
2569 | whichfork); | 2565 | whichfork); |
@@ -3112,6 +3108,8 @@ xfs_iext_get_ext( | |||
3112 | xfs_extnum_t idx) /* index of target extent */ | 3108 | xfs_extnum_t idx) /* index of target extent */ |
3113 | { | 3109 | { |
3114 | ASSERT(idx >= 0); | 3110 | ASSERT(idx >= 0); |
3111 | ASSERT(idx < ifp->if_bytes / sizeof(xfs_bmbt_rec_t)); | ||
3112 | |||
3115 | if ((ifp->if_flags & XFS_IFEXTIREC) && (idx == 0)) { | 3113 | if ((ifp->if_flags & XFS_IFEXTIREC) && (idx == 0)) { |
3116 | return ifp->if_u1.if_ext_irec->er_extbuf; | 3114 | return ifp->if_u1.if_ext_irec->er_extbuf; |
3117 | } else if (ifp->if_flags & XFS_IFEXTIREC) { | 3115 | } else if (ifp->if_flags & XFS_IFEXTIREC) { |
@@ -3191,7 +3189,6 @@ xfs_iext_add( | |||
3191 | } | 3189 | } |
3192 | ifp->if_u1.if_extents = ifp->if_u2.if_inline_ext; | 3190 | ifp->if_u1.if_extents = ifp->if_u2.if_inline_ext; |
3193 | ifp->if_real_bytes = 0; | 3191 | ifp->if_real_bytes = 0; |
3194 | ifp->if_lastex = nextents + ext_diff; | ||
3195 | } | 3192 | } |
3196 | /* | 3193 | /* |
3197 | * Otherwise use a linear (direct) extent list. | 3194 | * Otherwise use a linear (direct) extent list. |
@@ -3886,8 +3883,10 @@ xfs_iext_idx_to_irec( | |||
3886 | xfs_extnum_t page_idx = *idxp; /* extent index in target list */ | 3883 | xfs_extnum_t page_idx = *idxp; /* extent index in target list */ |
3887 | 3884 | ||
3888 | ASSERT(ifp->if_flags & XFS_IFEXTIREC); | 3885 | ASSERT(ifp->if_flags & XFS_IFEXTIREC); |
3889 | ASSERT(page_idx >= 0 && page_idx <= | 3886 | ASSERT(page_idx >= 0); |
3890 | ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t)); | 3887 | ASSERT(page_idx <= ifp->if_bytes / sizeof(xfs_bmbt_rec_t)); |
3888 | ASSERT(page_idx < ifp->if_bytes / sizeof(xfs_bmbt_rec_t) || realloc); | ||
3889 | |||
3891 | nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ; | 3890 | nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ; |
3892 | erp_idx = 0; | 3891 | erp_idx = 0; |
3893 | low = 0; | 3892 | low = 0; |