diff options
author | Christoph Hellwig <hch@lst.de> | 2019-06-28 19:27:35 -0700 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2019-06-28 19:27:35 -0700 |
commit | 9c5e7c2ae34bc8c261daf4dc536f2c7c64ed40ca (patch) | |
tree | 1c238d9f65cccccb826aa79c2199688919a1da46 /fs/xfs/xfs_extfree_item.c | |
parent | 95cf0e4a0ddc59f17eacfb4d06e0950ea5f624ca (diff) | |
download | lwn-9c5e7c2ae34bc8c261daf4dc536f2c7c64ed40ca.tar.gz lwn-9c5e7c2ae34bc8c261daf4dc536f2c7c64ed40ca.zip |
xfs: merge xfs_efd_init into xfs_trans_get_efd
There is no good reason to keep these two functions separate.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_extfree_item.c')
-rw-r--r-- | fs/xfs/xfs_extfree_item.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c index 2c379947715d..b4a245d684e2 100644 --- a/fs/xfs/xfs_extfree_item.c +++ b/fs/xfs/xfs_extfree_item.c @@ -313,32 +313,35 @@ static const struct xfs_item_ops xfs_efd_item_ops = { }; /* - * Allocate and initialize an efd item with the given number of extents. + * Allocate an "extent free done" log item that will hold nextents worth of + * extents. The caller must use all nextents extents, because we are not + * flexible about this at all. */ struct xfs_efd_log_item * -xfs_efd_init( - struct xfs_mount *mp, - struct xfs_efi_log_item *efip, - uint nextents) - +xfs_trans_get_efd( + struct xfs_trans *tp, + struct xfs_efi_log_item *efip, + unsigned int nextents) { - struct xfs_efd_log_item *efdp; - uint size; + struct xfs_efd_log_item *efdp; ASSERT(nextents > 0); + if (nextents > XFS_EFD_MAX_FAST_EXTENTS) { - size = (uint)(sizeof(xfs_efd_log_item_t) + - ((nextents - 1) * sizeof(xfs_extent_t))); - efdp = kmem_zalloc(size, KM_SLEEP); + efdp = kmem_zalloc(sizeof(struct xfs_efd_log_item) + + (nextents - 1) * sizeof(struct xfs_extent), + KM_SLEEP); } else { efdp = kmem_zone_zalloc(xfs_efd_zone, KM_SLEEP); } - xfs_log_item_init(mp, &efdp->efd_item, XFS_LI_EFD, &xfs_efd_item_ops); + xfs_log_item_init(tp->t_mountp, &efdp->efd_item, XFS_LI_EFD, + &xfs_efd_item_ops); efdp->efd_efip = efip; efdp->efd_format.efd_nextents = nextents; efdp->efd_format.efd_efi_id = efip->efi_format.efi_id; + xfs_trans_add_item(tp, &efdp->efd_item); return efdp; } |