aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_bmap.c52
1 files changed, 9 insertions, 43 deletions
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index 6f3276974555..c9492e23447c 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -102,17 +102,6 @@ xfs_bmap_add_extent_delay_real(
102 102
103/* 103/*
104 * Called by xfs_bmap_add_extent to handle cases converting a hole 104 * Called by xfs_bmap_add_extent to handle cases converting a hole
105 * to a delayed allocation.
106 */
107STATIC int /* error */
108xfs_bmap_add_extent_hole_delay(
109 xfs_inode_t *ip, /* incore inode pointer */
110 xfs_extnum_t *idx, /* extent number to update/insert */
111 xfs_bmbt_irec_t *new, /* new data to add to file extents */
112 int *logflagsp); /* inode logging flags */
113
114/*
115 * Called by xfs_bmap_add_extent to handle cases converting a hole
116 * to a real allocation. 105 * to a real allocation.
117 */ 106 */
118STATIC int /* error */ 107STATIC int /* error */
@@ -431,8 +420,7 @@ xfs_bmap_add_attrfork_local(
431} 420}
432 421
433/* 422/*
434 * Called by xfs_bmapi to update file extent records and the btree 423 * Update file extent records and the btree after allocating space.
435 * after allocating space (or doing a delayed allocation).
436 */ 424 */
437STATIC int /* error */ 425STATIC int /* error */
438xfs_bmap_add_extent( 426xfs_bmap_add_extent(
@@ -464,21 +452,12 @@ xfs_bmap_add_extent(
464 452
465 ASSERT(*idx >= 0); 453 ASSERT(*idx >= 0);
466 ASSERT(*idx <= nextents); 454 ASSERT(*idx <= nextents);
455 ASSERT(!isnullstartblock(new->br_startblock));
467 456
468 /* 457 /*
469 * Any kind of new delayed allocation goes here.
470 */
471 if (isnullstartblock(new->br_startblock)) {
472 if (cur)
473 ASSERT((cur->bc_private.b.flags &
474 XFS_BTCUR_BPRV_WASDEL) == 0);
475 error = xfs_bmap_add_extent_hole_delay(ip, idx, new,
476 &logflags);
477 }
478 /*
479 * Real allocation off the end of the file. 458 * Real allocation off the end of the file.
480 */ 459 */
481 else if (*idx == nextents) { 460 if (*idx == nextents) {
482 if (cur) 461 if (cur)
483 ASSERT((cur->bc_private.b.flags & 462 ASSERT((cur->bc_private.b.flags &
484 XFS_BTCUR_BPRV_WASDEL) == 0); 463 XFS_BTCUR_BPRV_WASDEL) == 0);
@@ -1581,16 +1560,13 @@ done:
1581} 1560}
1582 1561
1583/* 1562/*
1584 * Called by xfs_bmap_add_extent to handle cases converting a hole 1563 * Convert a hole to a delayed allocation.
1585 * to a delayed allocation.
1586 */ 1564 */
1587/*ARGSUSED*/ 1565STATIC void
1588STATIC int /* error */
1589xfs_bmap_add_extent_hole_delay( 1566xfs_bmap_add_extent_hole_delay(
1590 xfs_inode_t *ip, /* incore inode pointer */ 1567 xfs_inode_t *ip, /* incore inode pointer */
1591 xfs_extnum_t *idx, /* extent number to update/insert */ 1568 xfs_extnum_t *idx, /* extent number to update/insert */
1592 xfs_bmbt_irec_t *new, /* new data to add to file extents */ 1569 xfs_bmbt_irec_t *new) /* new data to add to file extents */
1593 int *logflagsp) /* inode logging flags */
1594{ 1570{
1595 xfs_ifork_t *ifp; /* inode fork pointer */ 1571 xfs_ifork_t *ifp; /* inode fork pointer */
1596 xfs_bmbt_irec_t left; /* left neighbor extent entry */ 1572 xfs_bmbt_irec_t left; /* left neighbor extent entry */
@@ -1725,8 +1701,6 @@ xfs_bmap_add_extent_hole_delay(
1725 * Nothing to do for disk quota accounting here. 1701 * Nothing to do for disk quota accounting here.
1726 */ 1702 */
1727 } 1703 }
1728 *logflagsp = 0;
1729 return 0;
1730} 1704}
1731 1705
1732/* 1706/*
@@ -4455,9 +4429,6 @@ xfs_bmapi_reserve_delalloc(
4455 struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK); 4429 struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);
4456 xfs_extlen_t alen; 4430 xfs_extlen_t alen;
4457 xfs_extlen_t indlen; 4431 xfs_extlen_t indlen;
4458 xfs_fsblock_t firstblock = NULLFSBLOCK;
4459 struct xfs_btree_cur *cur = NULL;
4460 int tmp_logflags = 0;
4461 char rt = XFS_IS_REALTIME_INODE(ip); 4432 char rt = XFS_IS_REALTIME_INODE(ip);
4462 xfs_extlen_t extsz; 4433 xfs_extlen_t extsz;
4463 int error; 4434 int error;
@@ -4524,16 +4495,11 @@ xfs_bmapi_reserve_delalloc(
4524 got->br_startblock = nullstartblock(indlen); 4495 got->br_startblock = nullstartblock(indlen);
4525 got->br_blockcount = alen; 4496 got->br_blockcount = alen;
4526 got->br_state = XFS_EXT_NORM; 4497 got->br_state = XFS_EXT_NORM;
4527 4498 xfs_bmap_add_extent_hole_delay(ip, lastx, got);
4528 error = xfs_bmap_add_extent(NULL, ip, lastx, &cur, got, &firstblock,
4529 NULL, &tmp_logflags, XFS_DATA_FORK);
4530 ASSERT(!error);
4531 ASSERT(!tmp_logflags);
4532 ASSERT(!cur);
4533 4499
4534 /* 4500 /*
4535 * Update our extent pointer, given that xfs_bmap_add_extent might 4501 * Update our extent pointer, given that xfs_bmap_add_extent_hole_delay
4536 * have merged it into one of the neighbouring ones. 4502 * might have merged it into one of the neighbouring ones.
4537 */ 4503 */
4538 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, *lastx), got); 4504 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, *lastx), got);
4539 4505