Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Christoph Hellwig and committed by
Darrick J. Wong
9c5e7c2a 95cf0e4a

+15 -40
+15 -12
fs/xfs/xfs_extfree_item.c
··· 313 313 }; 314 314 315 315 /* 316 - * Allocate and initialize an efd item with the given number of extents. 316 + * Allocate an "extent free done" log item that will hold nextents worth of 317 + * extents. The caller must use all nextents extents, because we are not 318 + * flexible about this at all. 317 319 */ 318 320 struct xfs_efd_log_item * 319 - xfs_efd_init( 320 - struct xfs_mount *mp, 321 - struct xfs_efi_log_item *efip, 322 - uint nextents) 323 - 321 + xfs_trans_get_efd( 322 + struct xfs_trans *tp, 323 + struct xfs_efi_log_item *efip, 324 + unsigned int nextents) 324 325 { 325 - struct xfs_efd_log_item *efdp; 326 - uint size; 326 + struct xfs_efd_log_item *efdp; 327 327 328 328 ASSERT(nextents > 0); 329 + 329 330 if (nextents > XFS_EFD_MAX_FAST_EXTENTS) { 330 - size = (uint)(sizeof(xfs_efd_log_item_t) + 331 - ((nextents - 1) * sizeof(xfs_extent_t))); 332 - efdp = kmem_zalloc(size, KM_SLEEP); 331 + efdp = kmem_zalloc(sizeof(struct xfs_efd_log_item) + 332 + (nextents - 1) * sizeof(struct xfs_extent), 333 + KM_SLEEP); 333 334 } else { 334 335 efdp = kmem_zone_zalloc(xfs_efd_zone, KM_SLEEP); 335 336 } 336 337 337 - xfs_log_item_init(mp, &efdp->efd_item, XFS_LI_EFD, &xfs_efd_item_ops); 338 + xfs_log_item_init(tp->t_mountp, &efdp->efd_item, XFS_LI_EFD, 339 + &xfs_efd_item_ops); 338 340 efdp->efd_efip = efip; 339 341 efdp->efd_format.efd_nextents = nextents; 340 342 efdp->efd_format.efd_efi_id = efip->efi_format.efi_id; 341 343 344 + xfs_trans_add_item(tp, &efdp->efd_item); 342 345 return efdp; 343 346 } 344 347
-2
fs/xfs/xfs_extfree_item.h
··· 79 79 extern struct kmem_zone *xfs_efd_zone; 80 80 81 81 xfs_efi_log_item_t *xfs_efi_init(struct xfs_mount *, uint); 82 - xfs_efd_log_item_t *xfs_efd_init(struct xfs_mount *, xfs_efi_log_item_t *, 83 - uint); 84 82 int xfs_efi_copy_format(xfs_log_iovec_t *buf, 85 83 xfs_efi_log_format_t *dst_efi_fmt); 86 84 void xfs_efi_item_free(xfs_efi_log_item_t *);
-26
fs/xfs/xfs_trans_extfree.c
··· 20 20 #include "xfs_trace.h" 21 21 22 22 /* 23 - * This routine is called to allocate an "extent free done" 24 - * log item that will hold nextents worth of extents. The 25 - * caller must use all nextents extents, because we are not 26 - * flexible about this at all. 27 - */ 28 - struct xfs_efd_log_item * 29 - xfs_trans_get_efd(struct xfs_trans *tp, 30 - struct xfs_efi_log_item *efip, 31 - uint nextents) 32 - { 33 - struct xfs_efd_log_item *efdp; 34 - 35 - ASSERT(tp != NULL); 36 - ASSERT(nextents > 0); 37 - 38 - efdp = xfs_efd_init(tp->t_mountp, efip, nextents); 39 - ASSERT(efdp != NULL); 40 - 41 - /* 42 - * Get a log_item_desc to point at the new item. 43 - */ 44 - xfs_trans_add_item(tp, &efdp->efd_item); 45 - return efdp; 46 - } 47 - 48 - /* 49 23 * Free an extent and log it to the EFD. Note that the transaction is marked 50 24 * dirty regardless of whether the extent free succeeds or fails to support the 51 25 * EFI/EFD lifecycle rules.