diff options
| -rw-r--r-- | fs/xfs/libxfs/xfs_bmap.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 0c9c9cdd532a..4582f5547ae3 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c | |||
| @@ -3337,6 +3337,22 @@ xfs_bmap_btalloc_filestreams( | |||
| 3337 | return 0; | 3337 | return 0; |
| 3338 | } | 3338 | } |
| 3339 | 3339 | ||
| 3340 | /* Update all inode and quota accounting for the allocation we just did. */ | ||
| 3341 | static void | ||
| 3342 | xfs_bmap_btalloc_accounting( | ||
| 3343 | struct xfs_bmalloca *ap, | ||
| 3344 | struct xfs_alloc_arg *args) | ||
| 3345 | { | ||
| 3346 | if (!(ap->flags & XFS_BMAPI_COWFORK)) | ||
| 3347 | ap->ip->i_d.di_nblocks += args->len; | ||
| 3348 | xfs_trans_log_inode(ap->tp, ap->ip, XFS_ILOG_CORE); | ||
| 3349 | if (ap->wasdel) | ||
| 3350 | ap->ip->i_delayed_blks -= args->len; | ||
| 3351 | xfs_trans_mod_dquot_byino(ap->tp, ap->ip, | ||
| 3352 | ap->wasdel ? XFS_TRANS_DQ_DELBCOUNT : XFS_TRANS_DQ_BCOUNT, | ||
| 3353 | args->len); | ||
| 3354 | } | ||
| 3355 | |||
| 3340 | STATIC int | 3356 | STATIC int |
| 3341 | xfs_bmap_btalloc( | 3357 | xfs_bmap_btalloc( |
| 3342 | struct xfs_bmalloca *ap) /* bmap alloc argument struct */ | 3358 | struct xfs_bmalloca *ap) /* bmap alloc argument struct */ |
| @@ -3571,19 +3587,7 @@ xfs_bmap_btalloc( | |||
| 3571 | *ap->firstblock = args.fsbno; | 3587 | *ap->firstblock = args.fsbno; |
| 3572 | ASSERT(nullfb || fb_agno <= args.agno); | 3588 | ASSERT(nullfb || fb_agno <= args.agno); |
| 3573 | ap->length = args.len; | 3589 | ap->length = args.len; |
| 3574 | if (!(ap->flags & XFS_BMAPI_COWFORK)) | 3590 | xfs_bmap_btalloc_accounting(ap, &args); |
| 3575 | ap->ip->i_d.di_nblocks += args.len; | ||
| 3576 | xfs_trans_log_inode(ap->tp, ap->ip, XFS_ILOG_CORE); | ||
| 3577 | if (ap->wasdel) | ||
| 3578 | ap->ip->i_delayed_blks -= args.len; | ||
| 3579 | /* | ||
| 3580 | * Adjust the disk quota also. This was reserved | ||
| 3581 | * earlier. | ||
| 3582 | */ | ||
| 3583 | xfs_trans_mod_dquot_byino(ap->tp, ap->ip, | ||
| 3584 | ap->wasdel ? XFS_TRANS_DQ_DELBCOUNT : | ||
| 3585 | XFS_TRANS_DQ_BCOUNT, | ||
| 3586 | (long) args.len); | ||
| 3587 | } else { | 3591 | } else { |
| 3588 | ap->blkno = NULLFSBLOCK; | 3592 | ap->blkno = NULLFSBLOCK; |
| 3589 | ap->length = 0; | 3593 | ap->length = 0; |
