aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Chinner <david@fromorbit.com>2014-12-03 17:46:17 -0500
committerDave Chinner <david@fromorbit.com>2014-12-03 17:46:17 -0500
commit6044e4386cd51dece882ea42352cdaaab0f24cad (patch)
treecde51132ea9d6afefdf05ad621fc22bbb796d5f4
parentc14fc01340dd0afe58d8671acc3ea5e907e707ae (diff)
parentb29c70f59870dad0945b0e0b3fe3758ad528e268 (diff)
Merge branch 'xfs-misc-fixes-for-3.19-2' into for-next
Conflicts: fs/xfs/xfs_iops.c
-rw-r--r--fs/xfs/libxfs/xfs_bmap.c68
-rw-r--r--fs/xfs/libxfs/xfs_da_btree.c4
-rw-r--r--fs/xfs/libxfs/xfs_dir2.c16
-rw-r--r--fs/xfs/libxfs/xfs_dir2.h140
-rw-r--r--fs/xfs/libxfs/xfs_dir2_block.c8
-rw-r--r--fs/xfs/libxfs/xfs_dir2_leaf.c10
-rw-r--r--fs/xfs/libxfs/xfs_dir2_node.c12
-rw-r--r--fs/xfs/libxfs/xfs_dir2_priv.h140
-rw-r--r--fs/xfs/libxfs/xfs_dir2_sf.c10
-rw-r--r--fs/xfs/libxfs/xfs_ialloc.c34
-rw-r--r--fs/xfs/xfs_buf.c13
-rw-r--r--fs/xfs/xfs_buf.h3
-rw-r--r--fs/xfs/xfs_dir2_readdir.c18
-rw-r--r--fs/xfs/xfs_export.c1
-rw-r--r--fs/xfs/xfs_icache.c2
-rw-r--r--fs/xfs/xfs_inode.c12
-rw-r--r--fs/xfs/xfs_iomap.c15
-rw-r--r--fs/xfs/xfs_iops.c2
-rw-r--r--fs/xfs/xfs_itable.c2
-rw-r--r--fs/xfs/xfs_log.c4
-rw-r--r--fs/xfs/xfs_log_recover.c1
-rw-r--r--fs/xfs/xfs_mount.c1
-rw-r--r--fs/xfs/xfs_super.c6
-rw-r--r--fs/xfs/xfs_trans_buf.c135
24 files changed, 271 insertions, 386 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 80e33888ecc6..b5eb4743f75a 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -5447,13 +5447,11 @@ xfs_bmse_merge(
5447 struct xfs_btree_cur *cur, 5447 struct xfs_btree_cur *cur,
5448 int *logflags) /* output */ 5448 int *logflags) /* output */
5449{ 5449{
5450 struct xfs_ifork *ifp;
5451 struct xfs_bmbt_irec got; 5450 struct xfs_bmbt_irec got;
5452 struct xfs_bmbt_irec left; 5451 struct xfs_bmbt_irec left;
5453 xfs_filblks_t blockcount; 5452 xfs_filblks_t blockcount;
5454 int error, i; 5453 int error, i;
5455 5454
5456 ifp = XFS_IFORK_PTR(ip, whichfork);
5457 xfs_bmbt_get_all(gotp, &got); 5455 xfs_bmbt_get_all(gotp, &got);
5458 xfs_bmbt_get_all(leftp, &left); 5456 xfs_bmbt_get_all(leftp, &left);
5459 blockcount = left.br_blockcount + got.br_blockcount; 5457 blockcount = left.br_blockcount + got.br_blockcount;
@@ -5486,32 +5484,25 @@ xfs_bmse_merge(
5486 error = xfs_bmbt_lookup_eq(cur, got.br_startoff, got.br_startblock, 5484 error = xfs_bmbt_lookup_eq(cur, got.br_startoff, got.br_startblock,
5487 got.br_blockcount, &i); 5485 got.br_blockcount, &i);
5488 if (error) 5486 if (error)
5489 goto out_error; 5487 return error;
5490 XFS_WANT_CORRUPTED_GOTO(i == 1, out_error); 5488 XFS_WANT_CORRUPTED_RETURN(i == 1);
5491 5489
5492 error = xfs_btree_delete(cur, &i); 5490 error = xfs_btree_delete(cur, &i);
5493 if (error) 5491 if (error)
5494 goto out_error; 5492 return error;
5495 XFS_WANT_CORRUPTED_GOTO(i == 1, out_error); 5493 XFS_WANT_CORRUPTED_RETURN(i == 1);
5496 5494
5497 /* lookup and update size of the previous extent */ 5495 /* lookup and update size of the previous extent */
5498 error = xfs_bmbt_lookup_eq(cur, left.br_startoff, left.br_startblock, 5496 error = xfs_bmbt_lookup_eq(cur, left.br_startoff, left.br_startblock,
5499 left.br_blockcount, &i); 5497 left.br_blockcount, &i);
5500 if (error) 5498 if (error)
5501 goto out_error; 5499 return error;
5502 XFS_WANT_CORRUPTED_GOTO(i == 1, out_error); 5500 XFS_WANT_CORRUPTED_RETURN(i == 1);
5503 5501
5504 left.br_blockcount = blockcount; 5502 left.br_blockcount = blockcount;
5505 5503
5506 error = xfs_bmbt_update(cur, left.br_startoff, left.br_startblock, 5504 return xfs_bmbt_update(cur, left.br_startoff, left.br_startblock,
5507 left.br_blockcount, left.br_state); 5505 left.br_blockcount, left.br_state);
5508 if (error)
5509 goto out_error;
5510
5511 return 0;
5512
5513out_error:
5514 return error;
5515} 5506}
5516 5507
5517/* 5508/*
@@ -5541,35 +5532,29 @@ xfs_bmse_shift_one(
5541 startoff = got.br_startoff - offset_shift_fsb; 5532 startoff = got.br_startoff - offset_shift_fsb;
5542 5533
5543 /* delalloc extents should be prevented by caller */ 5534 /* delalloc extents should be prevented by caller */
5544 XFS_WANT_CORRUPTED_GOTO(!isnullstartblock(got.br_startblock), 5535 XFS_WANT_CORRUPTED_RETURN(!isnullstartblock(got.br_startblock));
5545 out_error);
5546 5536
5547 /* 5537 /*
5548 * If this is the first extent in the file, make sure there's enough 5538 * Check for merge if we've got an extent to the left, otherwise make
5549 * room at the start of the file and jump right to the shift as there's 5539 * sure there's enough room at the start of the file for the shift.
5550 * no left extent to merge.
5551 */ 5540 */
5552 if (*current_ext == 0) { 5541 if (*current_ext) {
5553 if (got.br_startoff < offset_shift_fsb) 5542 /* grab the left extent and check for a large enough hole */
5554 return -EINVAL; 5543 leftp = xfs_iext_get_ext(ifp, *current_ext - 1);
5555 goto shift_extent; 5544 xfs_bmbt_get_all(leftp, &left);
5556 }
5557 5545
5558 /* grab the left extent and check for a large enough hole */ 5546 if (startoff < left.br_startoff + left.br_blockcount)
5559 leftp = xfs_iext_get_ext(ifp, *current_ext - 1); 5547 return -EINVAL;
5560 xfs_bmbt_get_all(leftp, &left);
5561 5548
5562 if (startoff < left.br_startoff + left.br_blockcount) 5549 /* check whether to merge the extent or shift it down */
5550 if (xfs_bmse_can_merge(&left, &got, offset_shift_fsb)) {
5551 return xfs_bmse_merge(ip, whichfork, offset_shift_fsb,
5552 *current_ext, gotp, leftp, cur,
5553 logflags);
5554 }
5555 } else if (got.br_startoff < offset_shift_fsb)
5563 return -EINVAL; 5556 return -EINVAL;
5564 5557
5565 /* check whether to merge the extent or shift it down */
5566 if (!xfs_bmse_can_merge(&left, &got, offset_shift_fsb))
5567 goto shift_extent;
5568
5569 return xfs_bmse_merge(ip, whichfork, offset_shift_fsb, *current_ext,
5570 gotp, leftp, cur, logflags);
5571
5572shift_extent:
5573 /* 5558 /*
5574 * Increment the extent index for the next iteration, update the start 5559 * Increment the extent index for the next iteration, update the start
5575 * offset of the in-core extent and update the btree if applicable. 5560 * offset of the in-core extent and update the btree if applicable.
@@ -5586,14 +5571,11 @@ shift_extent:
5586 got.br_blockcount, &i); 5571 got.br_blockcount, &i);
5587 if (error) 5572 if (error)
5588 return error; 5573 return error;
5589 XFS_WANT_CORRUPTED_GOTO(i == 1, out_error); 5574 XFS_WANT_CORRUPTED_RETURN(i == 1);
5590 5575
5591 got.br_startoff = startoff; 5576 got.br_startoff = startoff;
5592 return xfs_bmbt_update(cur, got.br_startoff, got.br_startblock, 5577 return xfs_bmbt_update(cur, got.br_startoff, got.br_startblock,
5593 got.br_blockcount, got.br_state); 5578 got.br_blockcount, got.br_state);
5594
5595out_error:
5596 return error;
5597} 5579}
5598 5580
5599/* 5581/*
diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
index c41e7513849e..9cb0115c6bd1 100644
--- a/fs/xfs/libxfs/xfs_da_btree.c
+++ b/fs/xfs/libxfs/xfs_da_btree.c
@@ -512,7 +512,6 @@ xfs_da3_root_split(
512 struct xfs_buf *bp; 512 struct xfs_buf *bp;
513 struct xfs_inode *dp; 513 struct xfs_inode *dp;
514 struct xfs_trans *tp; 514 struct xfs_trans *tp;
515 struct xfs_mount *mp;
516 struct xfs_dir2_leaf *leaf; 515 struct xfs_dir2_leaf *leaf;
517 xfs_dablk_t blkno; 516 xfs_dablk_t blkno;
518 int level; 517 int level;
@@ -532,7 +531,6 @@ xfs_da3_root_split(
532 531
533 dp = args->dp; 532 dp = args->dp;
534 tp = args->trans; 533 tp = args->trans;
535 mp = state->mp;
536 error = xfs_da_get_buf(tp, dp, blkno, -1, &bp, args->whichfork); 534 error = xfs_da_get_buf(tp, dp, blkno, -1, &bp, args->whichfork);
537 if (error) 535 if (error)
538 return error; 536 return error;
@@ -2340,14 +2338,12 @@ xfs_da_shrink_inode(
2340 xfs_inode_t *dp;