xfs: reduce the size of struct xfs_extent_free_item

We only use EFIs to free metadata blocks -- not regular data/attr fork
extents. Remove all the fields that we never use, for a net reduction
of 16 bytes.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>

+32 -14
+16 -9
fs/xfs/libxfs/xfs_alloc.c
··· 2462 ASSERT(xfs_extfree_item_cache != NULL); 2463 ASSERT(oinfo != NULL); 2464 2465 - new = kmem_cache_alloc(xfs_extfree_item_cache, 2466 GFP_KERNEL | __GFP_NOFAIL); 2467 new->xefi_startblock = XFS_AGB_TO_FSB(mp, agno, agbno); 2468 new->xefi_blockcount = 1; 2469 - new->xefi_oinfo = *oinfo; 2470 - new->xefi_skip_discard = false; 2471 2472 trace_xfs_agfl_free_defer(mp, agno, 0, agbno, 1); 2473 ··· 2504 #endif 2505 ASSERT(xfs_extfree_item_cache != NULL); 2506 2507 - new = kmem_cache_alloc(xfs_extfree_item_cache, 2508 GFP_KERNEL | __GFP_NOFAIL); 2509 new->xefi_startblock = bno; 2510 new->xefi_blockcount = (xfs_extlen_t)len; 2511 - if (oinfo) 2512 - new->xefi_oinfo = *oinfo; 2513 - else 2514 - new->xefi_oinfo = XFS_RMAP_OINFO_SKIP_UPDATE; 2515 - new->xefi_skip_discard = skip_discard; 2516 trace_xfs_bmap_free_defer(tp->t_mountp, 2517 XFS_FSB_TO_AGNO(tp->t_mountp, bno), 0, 2518 XFS_FSB_TO_AGBNO(tp->t_mountp, bno), len);
··· 2462 ASSERT(xfs_extfree_item_cache != NULL); 2463 ASSERT(oinfo != NULL); 2464 2465 + new = kmem_cache_zalloc(xfs_extfree_item_cache, 2466 GFP_KERNEL | __GFP_NOFAIL); 2467 new->xefi_startblock = XFS_AGB_TO_FSB(mp, agno, agbno); 2468 new->xefi_blockcount = 1; 2469 + new->xefi_owner = oinfo->oi_owner; 2470 2471 trace_xfs_agfl_free_defer(mp, agno, 0, agbno, 1); 2472 ··· 2505 #endif 2506 ASSERT(xfs_extfree_item_cache != NULL); 2507 2508 + new = kmem_cache_zalloc(xfs_extfree_item_cache, 2509 GFP_KERNEL | __GFP_NOFAIL); 2510 new->xefi_startblock = bno; 2511 new->xefi_blockcount = (xfs_extlen_t)len; 2512 + if (skip_discard) 2513 + new->xefi_flags |= XFS_EFI_SKIP_DISCARD; 2514 + if (oinfo) { 2515 + ASSERT(oinfo->oi_offset == 0); 2516 + 2517 + if (oinfo->oi_flags & XFS_OWNER_INFO_ATTR_FORK) 2518 + new->xefi_flags |= XFS_EFI_ATTR_FORK; 2519 + if (oinfo->oi_flags & XFS_OWNER_INFO_BMBT_BLOCK) 2520 + new->xefi_flags |= XFS_EFI_BMBT_BLOCK; 2521 + new->xefi_owner = oinfo->oi_owner; 2522 + } else { 2523 + new->xefi_owner = XFS_RMAP_OWN_NULL; 2524 + } 2525 trace_xfs_bmap_free_defer(tp->t_mountp, 2526 XFS_FSB_TO_AGNO(tp->t_mountp, bno), 0, 2527 XFS_FSB_TO_AGBNO(tp->t_mountp, bno), len);
+6 -2
fs/xfs/libxfs/xfs_alloc.h
··· 258 */ 259 struct xfs_extent_free_item { 260 struct list_head xefi_list; 261 xfs_fsblock_t xefi_startblock;/* starting fs block number */ 262 xfs_extlen_t xefi_blockcount;/* number of blocks in extent */ 263 - bool xefi_skip_discard; 264 - struct xfs_owner_info xefi_oinfo; /* extent owner */ 265 }; 266 267 static inline void 268 xfs_free_extent_later(
··· 258 */ 259 struct xfs_extent_free_item { 260 struct list_head xefi_list; 261 + uint64_t xefi_owner; 262 xfs_fsblock_t xefi_startblock;/* starting fs block number */ 263 xfs_extlen_t xefi_blockcount;/* number of blocks in extent */ 264 + unsigned int xefi_flags; 265 }; 266 + 267 + #define XFS_EFI_SKIP_DISCARD (1U << 0) /* don't issue discard */ 268 + #define XFS_EFI_ATTR_FORK (1U << 1) /* freeing attr fork block */ 269 + #define XFS_EFI_BMBT_BLOCK (1U << 2) /* freeing bmap btree block */ 270 271 static inline void 272 xfs_free_extent_later(
+10 -3
fs/xfs/xfs_extfree_item.c
··· 474 struct list_head *item, 475 struct xfs_btree_cur **state) 476 { 477 struct xfs_extent_free_item *free; 478 int error; 479 480 free = container_of(item, struct xfs_extent_free_item, xefi_list); 481 error = xfs_trans_free_extent(tp, EFD_ITEM(done), 482 free->xefi_startblock, 483 free->xefi_blockcount, 484 - &free->xefi_oinfo, free->xefi_skip_discard); 485 kmem_cache_free(xfs_extfree_item_cache, free); 486 return error; 487 } ··· 531 struct list_head *item, 532 struct xfs_btree_cur **state) 533 { 534 struct xfs_mount *mp = tp->t_mountp; 535 struct xfs_efd_log_item *efdp = EFD_ITEM(done); 536 struct xfs_extent_free_item *free; ··· 546 ASSERT(free->xefi_blockcount == 1); 547 agno = XFS_FSB_TO_AGNO(mp, free->xefi_startblock); 548 agbno = XFS_FSB_TO_AGBNO(mp, free->xefi_startblock); 549 550 trace_xfs_agfl_free_deferred(mp, agno, 0, agbno, free->xefi_blockcount); 551 552 error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp); 553 if (!error) 554 - error = xfs_free_agfl_block(tp, agno, agbno, agbp, 555 - &free->xefi_oinfo); 556 557 /* 558 * Mark the transaction dirty, even on error. This ensures the
··· 474 struct list_head *item, 475 struct xfs_btree_cur **state) 476 { 477 + struct xfs_owner_info oinfo = { }; 478 struct xfs_extent_free_item *free; 479 int error; 480 481 free = container_of(item, struct xfs_extent_free_item, xefi_list); 482 + oinfo.oi_owner = free->xefi_owner; 483 + if (free->xefi_flags & XFS_EFI_ATTR_FORK) 484 + oinfo.oi_flags |= XFS_OWNER_INFO_ATTR_FORK; 485 + if (free->xefi_flags & XFS_EFI_BMBT_BLOCK) 486 + oinfo.oi_flags |= XFS_OWNER_INFO_BMBT_BLOCK; 487 error = xfs_trans_free_extent(tp, EFD_ITEM(done), 488 free->xefi_startblock, 489 free->xefi_blockcount, 490 + &oinfo, free->xefi_flags & XFS_EFI_SKIP_DISCARD); 491 kmem_cache_free(xfs_extfree_item_cache, free); 492 return error; 493 } ··· 525 struct list_head *item, 526 struct xfs_btree_cur **state) 527 { 528 + struct xfs_owner_info oinfo = { }; 529 struct xfs_mount *mp = tp->t_mountp; 530 struct xfs_efd_log_item *efdp = EFD_ITEM(done); 531 struct xfs_extent_free_item *free; ··· 539 ASSERT(free->xefi_blockcount == 1); 540 agno = XFS_FSB_TO_AGNO(mp, free->xefi_startblock); 541 agbno = XFS_FSB_TO_AGBNO(mp, free->xefi_startblock); 542 + oinfo.oi_owner = free->xefi_owner; 543 544 trace_xfs_agfl_free_deferred(mp, agno, 0, agbno, free->xefi_blockcount); 545 546 error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp); 547 if (!error) 548 + error = xfs_free_agfl_block(tp, agno, agbno, agbp, &oinfo); 549 550 /* 551 * Mark the transaction dirty, even on error. This ensures the