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