aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_extfree_item.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_extfree_item.c')
-rw-r--r--fs/xfs/xfs_extfree_item.c50
1 files changed, 32 insertions, 18 deletions
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c
index 452920a3f03f..dc53e8febbbe 100644
--- a/fs/xfs/xfs_extfree_item.c
+++ b/fs/xfs/xfs_extfree_item.c
@@ -73,11 +73,22 @@ __xfs_efi_release(
73 * We only need 1 iovec for an efi item. It just logs the efi_log_format 73 * We only need 1 iovec for an efi item. It just logs the efi_log_format
74 * structure. 74 * structure.
75 */ 75 */
76STATIC uint 76static inline int
77xfs_efi_item_sizeof(
78 struct xfs_efi_log_item *efip)
79{
80 return sizeof(struct xfs_efi_log_format) +
81 (efip->efi_format.efi_nextents - 1) * sizeof(xfs_extent_t);
82}
83
84STATIC void
77xfs_efi_item_size( 85xfs_efi_item_size(
78 struct xfs_log_item *lip) 86 struct xfs_log_item *lip,
87 int *nvecs,
88 int *nbytes)
79{ 89{
80 return 1; 90 *nvecs += 1;
91 *nbytes += xfs_efi_item_sizeof(EFI_ITEM(lip));
81} 92}
82 93
83/* 94/*
@@ -93,21 +104,17 @@ xfs_efi_item_format(
93 struct xfs_log_iovec *log_vector) 104 struct xfs_log_iovec *log_vector)
94{ 105{
95 struct xfs_efi_log_item *efip = EFI_ITEM(lip); 106 struct xfs_efi_log_item *efip = EFI_ITEM(lip);
96 uint size;
97 107
98 ASSERT(atomic_read(&efip->efi_next_extent) == 108 ASSERT(atomic_read(&efip->efi_next_extent) ==
99 efip->efi_format.efi_nextents); 109 efip->efi_format.efi_nextents);
100 110
101 efip->efi_format.efi_type = XFS_LI_EFI; 111 efip->efi_format.efi_type = XFS_LI_EFI;
102
103 size = sizeof(xfs_efi_log_format_t);
104 size += (efip->efi_format.efi_nextents - 1) * sizeof(xfs_extent_t);
105 efip->efi_format.efi_size = 1; 112 efip->efi_format.efi_size = 1;
106 113
107 log_vector->i_addr = &efip->efi_format; 114 log_vector->i_addr = &efip->efi_format;
108 log_vector->i_len = size; 115 log_vector->i_len = xfs_efi_item_sizeof(efip);
109 log_vector->i_type = XLOG_REG_TYPE_EFI_FORMAT; 116 log_vector->i_type = XLOG_REG_TYPE_EFI_FORMAT;
110 ASSERT(size >= sizeof(xfs_efi_log_format_t)); 117 ASSERT(log_vector->i_len >= sizeof(xfs_efi_log_format_t));
111} 118}
112 119
113 120
@@ -333,11 +340,22 @@ xfs_efd_item_free(struct xfs_efd_log_item *efdp)
333 * We only need 1 iovec for an efd item. It just logs the efd_log_format 340 * We only need 1 iovec for an efd item. It just logs the efd_log_format
334 * structure. 341 * structure.
335 */ 342 */
336STATIC uint 343static inline int
344xfs_efd_item_sizeof(
345 struct xfs_efd_log_item *efdp)
346{
347 return sizeof(xfs_efd_log_format_t) +
348 (efdp->efd_format.efd_nextents - 1) * sizeof(xfs_extent_t);
349}
350
351STATIC void
337xfs_efd_item_size( 352xfs_efd_item_size(
338 struct xfs_log_item *lip) 353 struct xfs_log_item *lip,
354 int *nvecs,
355 int *nbytes)
339{ 356{
340 return 1; 357 *nvecs += 1;
358 *nbytes += xfs_efd_item_sizeof(EFD_ITEM(lip));
341} 359}
342 360
343/* 361/*
@@ -353,20 +371,16 @@ xfs_efd_item_format(
353 struct xfs_log_iovec *log_vector) 371 struct xfs_log_iovec *log_vector)
354{ 372{
355 struct xfs_efd_log_item *efdp = EFD_ITEM(lip); 373 struct xfs_efd_log_item *efdp = EFD_ITEM(lip);
356 uint size;
357 374
358 ASSERT(efdp->efd_next_extent == efdp->efd_format.efd_nextents); 375 ASSERT(efdp->efd_next_extent == efdp->efd_format.efd_nextents);
359 376
360 efdp->efd_format.efd_type = XFS_LI_EFD; 377 efdp->efd_format.efd_type = XFS_LI_EFD;
361
362 size = sizeof(xfs_efd_log_format_t);
363 size += (efdp->efd_format.efd_nextents - 1) * sizeof(xfs_extent_t);
364 efdp->efd_format.efd_size = 1; 378 efdp->efd_format.efd_size = 1;
365 379
366 log_vector->i_addr = &efdp->efd_format; 380 log_vector->i_addr = &efdp->efd_format;
367 log_vector->i_len = size; 381 log_vector->i_len = xfs_efd_item_sizeof(efdp);
368 log_vector->i_type = XLOG_REG_TYPE_EFD_FORMAT; 382 log_vector->i_type = XLOG_REG_TYPE_EFD_FORMAT;
369 ASSERT(size >= sizeof(xfs_efd_log_format_t)); 383 ASSERT(log_vector->i_len >= sizeof(xfs_efd_log_format_t));
370} 384}
371 385
372/* 386/*