diff options
| -rw-r--r-- | fs/xfs/xfs_da_btree.c | 5 | ||||
| -rw-r--r-- | fs/xfs/xfs_dir2.c | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c index 9e561a9cefca..a11a8390bf6c 100644 --- a/fs/xfs/xfs_da_btree.c +++ b/fs/xfs/xfs_da_btree.c | |||
| @@ -1566,11 +1566,14 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno) | |||
| 1566 | int nmap, error, w, count, c, got, i, mapi; | 1566 | int nmap, error, w, count, c, got, i, mapi; |
| 1567 | xfs_trans_t *tp; | 1567 | xfs_trans_t *tp; |
| 1568 | xfs_mount_t *mp; | 1568 | xfs_mount_t *mp; |
| 1569 | xfs_drfsbno_t nblks; | ||
| 1569 | 1570 | ||
| 1570 | dp = args->dp; | 1571 | dp = args->dp; |
| 1571 | mp = dp->i_mount; | 1572 | mp = dp->i_mount; |
| 1572 | w = args->whichfork; | 1573 | w = args->whichfork; |
| 1573 | tp = args->trans; | 1574 | tp = args->trans; |
| 1575 | nblks = dp->i_d.di_nblocks; | ||
| 1576 | |||
| 1574 | /* | 1577 | /* |
| 1575 | * For new directories adjust the file offset and block count. | 1578 | * For new directories adjust the file offset and block count. |
| 1576 | */ | 1579 | */ |
| @@ -1647,6 +1650,8 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno) | |||
| 1647 | } | 1650 | } |
| 1648 | if (mapp != &map) | 1651 | if (mapp != &map) |
| 1649 | kmem_free(mapp); | 1652 | kmem_free(mapp); |
| 1653 | /* account for newly allocated blocks in reserved blocks total */ | ||
| 1654 | args->total -= dp->i_d.di_nblocks - nblks; | ||
| 1650 | *new_blkno = (xfs_dablk_t)bno; | 1655 | *new_blkno = (xfs_dablk_t)bno; |
| 1651 | return 0; | 1656 | return 0; |
| 1652 | } | 1657 | } |
diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c index 80e0dc51361c..1afb12278b8d 100644 --- a/fs/xfs/xfs_dir2.c +++ b/fs/xfs/xfs_dir2.c | |||
| @@ -525,11 +525,13 @@ xfs_dir2_grow_inode( | |||
| 525 | xfs_mount_t *mp; | 525 | xfs_mount_t *mp; |
| 526 | int nmap; /* number of bmap entries */ | 526 | int nmap; /* number of bmap entries */ |
| 527 | xfs_trans_t *tp; | 527 | xfs_trans_t *tp; |
| 528 | xfs_drfsbno_t nblks; | ||
| 528 | 529 | ||
| 529 | xfs_dir2_trace_args_s("grow_inode", args, space); | 530 | xfs_dir2_trace_args_s("grow_inode", args, space); |
| 530 | dp = args->dp; | 531 | dp = args->dp; |
| 531 | tp = args->trans; | 532 | tp = args->trans; |
| 532 | mp = dp->i_mount; | 533 | mp = dp->i_mount; |
| 534 | nblks = dp->i_d.di_nblocks; | ||
| 533 | /* | 535 | /* |
| 534 | * Set lowest possible block in the space requested. | 536 | * Set lowest possible block in the space requested. |
| 535 | */ | 537 | */ |
| @@ -622,7 +624,11 @@ xfs_dir2_grow_inode( | |||
| 622 | */ | 624 | */ |
| 623 | if (mapp != &map) | 625 | if (mapp != &map) |
| 624 | kmem_free(mapp); | 626 | kmem_free(mapp); |
| 627 | |||
| 628 | /* account for newly allocated blocks in reserved blocks total */ | ||
| 629 | args->total -= dp->i_d.di_nblocks - nblks; | ||
| 625 | *dbp = xfs_dir2_da_to_db(mp, (xfs_dablk_t)bno); | 630 | *dbp = xfs_dir2_da_to_db(mp, (xfs_dablk_t)bno); |
| 631 | |||
| 626 | /* | 632 | /* |
| 627 | * Update file's size if this is the data space and it grew. | 633 | * Update file's size if this is the data space and it grew. |
| 628 | */ | 634 | */ |
