aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/xfs_alloc.c10
-rw-r--r--fs/xfs/xfs_da_btree.c6
-rw-r--r--fs/xfs/xfs_dir2_block.c6
-rw-r--r--fs/xfs/xfs_iget.c3
-rw-r--r--fs/xfs/xfs_inode.c4
-rw-r--r--fs/xfs/xfs_inode_item.c18
-rw-r--r--fs/xfs/xfs_log.c2
7 files changed, 15 insertions, 34 deletions
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c
index 6fe5c02ba19a..af168faccc7a 100644
--- a/fs/xfs/xfs_alloc.c
+++ b/fs/xfs/xfs_alloc.c
@@ -683,8 +683,6 @@ xfs_alloc_ag_vextent_near(
683 xfs_agblock_t ltbno; /* start bno of left side entry */ 683 xfs_agblock_t ltbno; /* start bno of left side entry */
684 xfs_agblock_t ltbnoa; /* aligned ... */ 684 xfs_agblock_t ltbnoa; /* aligned ... */
685 xfs_extlen_t ltdiff; /* difference to left side entry */ 685 xfs_extlen_t ltdiff; /* difference to left side entry */
686 /*REFERENCED*/
687 xfs_agblock_t ltend; /* end bno of left side entry */
688 xfs_extlen_t ltlen; /* length of left side entry */ 686 xfs_extlen_t ltlen; /* length of left side entry */
689 xfs_extlen_t ltlena; /* aligned ... */ 687 xfs_extlen_t ltlena; /* aligned ... */
690 xfs_agblock_t ltnew; /* useful start bno of left side */ 688 xfs_agblock_t ltnew; /* useful start bno of left side */
@@ -809,8 +807,7 @@ xfs_alloc_ag_vextent_near(
809 if ((error = xfs_alloc_get_rec(cnt_cur, &ltbno, &ltlen, &i))) 807 if ((error = xfs_alloc_get_rec(cnt_cur, &ltbno, &ltlen, &i)))
810 goto error0; 808 goto error0;
811 XFS_WANT_CORRUPTED_GOTO(i == 1, error0); 809 XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
812 ltend = ltbno + ltlen; 810 ASSERT(ltbno + ltlen <= be32_to_cpu(XFS_BUF_TO_AGF(args->agbp)->agf_length));
813 ASSERT(ltend <= be32_to_cpu(XFS_BUF_TO_AGF(args->agbp)->agf_length));
814 args->len = blen; 811 args->len = blen;
815 if (!xfs_alloc_fix_minleft(args)) { 812 if (!xfs_alloc_fix_minleft(args)) {
816 xfs_btree_del_cursor(cnt_cur, XFS_BTREE_NOERROR); 813 xfs_btree_del_cursor(cnt_cur, XFS_BTREE_NOERROR);
@@ -823,7 +820,7 @@ xfs_alloc_ag_vextent_near(
823 */ 820 */
824 args->agbno = bnew; 821 args->agbno = bnew;
825 ASSERT(bnew >= ltbno); 822 ASSERT(bnew >= ltbno);
826 ASSERT(bnew + blen <= ltend); 823 ASSERT(bnew + blen <= ltbno + ltlen);
827 /* 824 /*
828 * Set up a cursor for the by-bno tree. 825 * Set up a cursor for the by-bno tree.
829 */ 826 */
@@ -1152,7 +1149,6 @@ xfs_alloc_ag_vextent_near(
1152 /* 1149 /*
1153 * Fix up the length and compute the useful address. 1150 * Fix up the length and compute the useful address.
1154 */ 1151 */
1155 ltend = ltbno + ltlen;
1156 args->len = XFS_EXTLEN_MIN(ltlena, args->maxlen); 1152 args->len = XFS_EXTLEN_MIN(ltlena, args->maxlen);
1157 xfs_alloc_fix_len(args); 1153 xfs_alloc_fix_len(args);
1158 if (!xfs_alloc_fix_minleft(args)) { 1154 if (!xfs_alloc_fix_minleft(args)) {
@@ -1165,7 +1161,7 @@ xfs_alloc_ag_vextent_near(
1165 (void)xfs_alloc_compute_diff(args->agbno, rlen, args->alignment, ltbno, 1161 (void)xfs_alloc_compute_diff(args->agbno, rlen, args->alignment, ltbno,
1166 ltlen, &ltnew); 1162 ltlen, &ltnew);
1167 ASSERT(ltnew >= ltbno); 1163 ASSERT(ltnew >= ltbno);
1168 ASSERT(ltnew + rlen <= ltend); 1164 ASSERT(ltnew + rlen <= ltbno + ltlen);
1169 ASSERT(ltnew + rlen <= be32_to_cpu(XFS_BUF_TO_AGF(args->agbp)->agf_length)); 1165 ASSERT(ltnew + rlen <= be32_to_cpu(XFS_BUF_TO_AGF(args->agbp)->agf_length));
1170 args->agbno = ltnew; 1166 args->agbno = ltnew;
1171 if ((error = xfs_alloc_fixup_trees(cnt_cur, bno_cur_lt, ltbno, ltlen, 1167 if ((error = xfs_alloc_fixup_trees(cnt_cur, bno_cur_lt, ltbno, ltlen,
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c
index 2adfb761ab13..30fa0e206fba 100644
--- a/fs/xfs/xfs_da_btree.c
+++ b/fs/xfs/xfs_da_btree.c
@@ -576,16 +576,14 @@ xfs_da_node_add(xfs_da_state_t *state, xfs_da_state_blk_t *oldblk,
576 xfs_da_intnode_t *node; 576 xfs_da_intnode_t *node;
577 xfs_da_node_entry_t *btree; 577 xfs_da_node_entry_t *btree;
578 int tmp; 578 int tmp;
579 xfs_mount_t *mp;
580 579
581 node = oldblk->bp->data; 580 node = oldblk->bp->data;
582 mp = state->mp;
583 ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC); 581 ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC);
584 ASSERT((oldblk->index >= 0) && (oldblk->index <= be16_to_cpu(node->hdr.count))); 582 ASSERT((oldblk->index >= 0) && (oldblk->index <= be16_to_cpu(node->hdr.count)));
585 ASSERT(newblk->blkno != 0); 583 ASSERT(newblk->blkno != 0);
586 if (state->args->whichfork == XFS_DATA_FORK) 584 if (state->args->whichfork == XFS_DATA_FORK)
587 ASSERT(newblk->blkno >= mp->m_dirleafblk && 585 ASSERT(newblk->blkno >= state->mp->m_dirleafblk &&
588 newblk->blkno < mp->m_dirfreeblk); 586 newblk->blkno < state->mp->m_dirfreeblk);
589 587
590 /* 588 /*
591 * We may need to make some room before we insert the new node. 589 * We may need to make some room before we insert the new node.
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index 68f4926c7d16..580d99cef9e7 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -1071,10 +1071,10 @@ xfs_dir2_sf_to_block(
1071 */ 1071 */
1072 1072
1073 buf_len = dp->i_df.if_bytes; 1073 buf_len = dp->i_df.if_bytes;
1074 buf = kmem_alloc(dp->i_df.if_bytes, KM_SLEEP); 1074 buf = kmem_alloc(buf_len, KM_SLEEP);
1075 1075
1076 memcpy(buf, sfp, dp->i_df.if_bytes); 1076 memcpy(buf, sfp, buf_len);
1077 xfs_idata_realloc(dp, -dp->i_df.if_bytes, XFS_DATA_FORK); 1077 xfs_idata_realloc(dp, -buf_len, XFS_DATA_FORK);
1078 dp->i_d.di_size = 0; 1078 dp->i_d.di_size = 0;
1079 xfs_trans_log_inode(tp, dp, XFS_ILOG_CORE); 1079 xfs_trans_log_inode(tp, dp, XFS_ILOG_CORE);
1080 /* 1080 /*
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c
index eba5ae61d362..b1ecc6f97ade 100644
--- a/fs/xfs/xfs_iget.c
+++ b/fs/xfs/xfs_iget.c
@@ -261,7 +261,6 @@ xfs_iget_cache_miss(
261{ 261{
262 struct xfs_inode *ip; 262 struct xfs_inode *ip;
263 int error; 263 int error;
264 unsigned long first_index, mask;
265 xfs_agino_t agino = XFS_INO_TO_AGINO(mp, ino); 264 xfs_agino_t agino = XFS_INO_TO_AGINO(mp, ino);
266 265
267 ip = xfs_inode_alloc(mp, ino); 266 ip = xfs_inode_alloc(mp, ino);
@@ -298,8 +297,6 @@ xfs_iget_cache_miss(
298 BUG(); 297 BUG();
299 } 298 }
300 299
301 mask = ~(((XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog)) - 1);
302 first_index = agino & mask;
303 write_lock(&pag->pag_ici_lock); 300 write_lock(&pag->pag_ici_lock);
304 301
305 /* insert the new inode */ 302 /* insert the new inode */
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 4a08c91dc976..eef211dfca03 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -918,7 +918,6 @@ xfs_iread_extents(
918 int error; 918 int error;
919 xfs_ifork_t *ifp; 919 xfs_ifork_t *ifp;
920 xfs_extnum_t nextents; 920 xfs_extnum_t nextents;
921 size_t size;
922 921
923 if (unlikely(XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE)) { 922 if (unlikely(XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE)) {
924 XFS_ERROR_REPORT("xfs_iread_extents", XFS_ERRLEVEL_LOW, 923 XFS_ERROR_REPORT("xfs_iread_extents", XFS_ERRLEVEL_LOW,
@@ -926,7 +925,6 @@ xfs_iread_extents(
926 return XFS_ERROR(EFSCORRUPTED); 925 return XFS_ERROR(EFSCORRUPTED);
927 } 926 }
928 nextents = XFS_IFORK_NEXTENTS(ip, whichfork); 927 nextents = XFS_IFORK_NEXTENTS(ip, whichfork);
929 size = nextents * sizeof(xfs_bmbt_rec_t);
930 ifp = XFS_IFORK_PTR(ip, whichfork); 928 ifp = XFS_IFORK_PTR(ip, whichfork);
931 929
932 /* 930 /*
@@ -3503,13 +3501,11 @@ xfs_iext_remove_indirect(
3503 xfs_extnum_t ext_diff; /* extents to remove in current list */ 3501 xfs_extnum_t ext_diff; /* extents to remove in current list */
3504 xfs_extnum_t nex1; /* number of extents before idx */ 3502 xfs_extnum_t nex1; /* number of extents before idx */
3505 xfs_extnum_t nex2; /* extents after idx + count */ 3503 xfs_extnum_t nex2; /* extents after idx + count */
3506 int nlists; /* entries in indirection array */
3507 int page_idx = idx; /* index in target extent list */ 3504 int page_idx = idx; /* index in target extent list */
3508 3505
3509 ASSERT(ifp->if_flags & XFS_IFEXTIREC); 3506 ASSERT(ifp->if_flags & XFS_IFEXTIREC);
3510 erp = xfs_iext_idx_to_irec(ifp, &page_idx, &erp_idx, 0); 3507 erp = xfs_iext_idx_to_irec(ifp, &page_idx, &erp_idx, 0);
3511 ASSERT(erp != NULL); 3508 ASSERT(erp != NULL);
3512 nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ;
3513 nex1 = page_idx; 3509 nex1 = page_idx;
3514 ext_cnt = count; 3510 ext_cnt = count;
3515 while (ext_cnt) { 3511 while (ext_cnt) {
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index 065c1ad9b708..2d6fcfdc7834 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -214,7 +214,6 @@ xfs_inode_item_format(
214 uint nvecs; 214 uint nvecs;
215 size_t data_bytes; 215 size_t data_bytes;
216 xfs_bmbt_rec_t *ext_buffer; 216 xfs_bmbt_rec_t *ext_buffer;
217 int nrecs;
218 xfs_mount_t *mp; 217 xfs_mount_t *mp;
219 218
220 vecp->i_addr = &iip->ili_format; 219 vecp->i_addr = &iip->ili_format;
@@ -314,9 +313,8 @@ xfs_inode_item_format(
314 ASSERT(ip->i_df.if_u1.if_extents != NULL); 313 ASSERT(ip->i_df.if_u1.if_extents != NULL);
315 ASSERT(ip->i_d.di_nextents > 0); 314 ASSERT(ip->i_d.di_nextents > 0);
316 ASSERT(iip->ili_extents_buf == NULL); 315 ASSERT(iip->ili_extents_buf == NULL);
317 nrecs = ip->i_df.if_bytes / 316 ASSERT((ip->i_df.if_bytes /
318 (uint)sizeof(xfs_bmbt_rec_t); 317 (uint)sizeof(xfs_bmbt_rec_t)) > 0);
319 ASSERT(nrecs > 0);
320#ifdef XFS_NATIVE_HOST 318#ifdef XFS_NATIVE_HOST
321 if (nrecs == ip->i_d.di_nextents) { 319 if (nrecs == ip->i_d.di_nextents) {
322 /* 320 /*
@@ -439,15 +437,15 @@ xfs_inode_item_format(
439 ASSERT(!(iip->ili_format.ilf_fields & 437 ASSERT(!(iip->ili_format.ilf_fields &
440 (XFS_ILOG_ADATA | XFS_ILOG_ABROOT))); 438 (XFS_ILOG_ADATA | XFS_ILOG_ABROOT)));
441 if (iip->ili_format.ilf_fields & XFS_ILOG_AEXT) { 439 if (iip->ili_format.ilf_fields & XFS_ILOG_AEXT) {
442 ASSERT(ip->i_afp->if_bytes > 0);
443 ASSERT(ip->i_afp->if_u1.if_extents != NULL);
444 ASSERT(ip->i_d.di_anextents > 0);
445#ifdef DEBUG 440#ifdef DEBUG
446 nrecs = ip->i_afp->if_bytes / 441 int nrecs = ip->i_afp->if_bytes /
447 (uint)sizeof(xfs_bmbt_rec_t); 442 (uint)sizeof(xfs_bmbt_rec_t);
448#endif
449 ASSERT(nrecs > 0); 443 ASSERT(nrecs > 0);
450 ASSERT(nrecs == ip->i_d.di_anextents); 444 ASSERT(nrecs == ip->i_d.di_anextents);
445 ASSERT(ip->i_afp->if_bytes > 0);
446 ASSERT(ip->i_afp->if_u1.if_extents != NULL);
447 ASSERT(ip->i_d.di_anextents > 0);
448#endif
451#ifdef XFS_NATIVE_HOST 449#ifdef XFS_NATIVE_HOST
452 /* 450 /*
453 * There are not delayed allocation extents 451 * There are not delayed allocation extents
@@ -889,10 +887,8 @@ xfs_iflush_abort(
889 xfs_inode_t *ip) 887 xfs_inode_t *ip)
890{ 888{
891 xfs_inode_log_item_t *iip = ip->i_itemp; 889 xfs_inode_log_item_t *iip = ip->i_itemp;
892 xfs_mount_t *mp;
893 890
894 iip = ip->i_itemp; 891 iip = ip->i_itemp;
895 mp = ip->i_mount;
896 if (iip) { 892 if (iip) {
897 struct xfs_ail *ailp = iip->ili_item.li_ailp; 893 struct xfs_ail *ailp = iip->ili_item.li_ailp;
898 if (iip->ili_item.li_flags & XFS_LI_IN_AIL) { 894 if (iip->ili_item.li_flags & XFS_LI_IN_AIL) {
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index f309e1404fd6..925d572bf0f4 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1042,7 +1042,6 @@ xlog_alloc_log(xfs_mount_t *mp,
1042 xlog_in_core_t *iclog, *prev_iclog=NULL; 1042 xlog_in_core_t *iclog, *prev_iclog=NULL;
1043 xfs_buf_t *bp; 1043 xfs_buf_t *bp;
1044 int i; 1044 int i;
1045 int iclogsize;
1046 int error = ENOMEM; 1045 int error = ENOMEM;
1047 uint log2_size = 0; 1046 uint log2_size = 0;
1048 1047
@@ -1122,7 +1121,6 @@ xlog_alloc_log(xfs_mount_t *mp,
1122 * with different amounts of memory. See the definition of 1121 * with different amounts of memory. See the definition of
1123 * xlog_in_core_t in xfs_log_priv.h for details. 1122 * xlog_in_core_t in xfs_log_priv.h for details.
1124 */ 1123 */
1125 iclogsize = log->l_iclog_size;
1126 ASSERT(log->l_iclog_size >= 4096); 1124 ASSERT(log->l_iclog_size >= 4096);
1127 for (i=0; i < log->l_iclog_bufs; i++) { 1125 for (i=0; i < log->l_iclog_bufs; i++) {
1128 *iclogp = kmem_zalloc(sizeof(xlog_in_core_t), KM_MAYFAIL); 1126 *iclogp = kmem_zalloc(sizeof(xlog_in_core_t), KM_MAYFAIL);