[7/3] libxfs: fix argument to xfs_trans_add_item
diff mbox series

Message ID 1bd8bba2-b884-02f6-8e49-eb2374481888@redhat.com
State Superseded
Headers show
Series
  • xfsprogs: more libxfs/ spring cleaning
Related show

Commit Message

Eric Sandeen May 16, 2019, 8:40 p.m. UTC
The hack of casting an inode_log_item or buf_log_item to a
xfs_log_item_t is pretty gross; yes it's the first member in the
structure, but yuk.  Pass in the correct structure member.

This was fixed in the kernel with commit e98c414f9
("xfs: simplify log item descriptor tracking")

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
 libxfs/trans.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Allison Collins May 17, 2019, 10:57 p.m. UTC | #1
On 5/16/19 1:40 PM, Eric Sandeen wrote:
> The hack of casting an inode_log_item or buf_log_item to a
> xfs_log_item_t is pretty gross; yes it's the first member in the
> structure, but yuk.  Pass in the correct structure member.
> 
> This was fixed in the kernel with commit e98c414f9
> ("xfs: simplify log item descriptor tracking")
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Looks good.
Reviewed-by: Allison Collins <allison.henderson@oracle.com>

> ---
>   libxfs/trans.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libxfs/trans.c b/libxfs/trans.c
> index f78222fd..6ef4841f 100644
> --- a/libxfs/trans.c
> +++ b/libxfs/trans.c
> @@ -346,7 +346,7 @@ xfs_trans_ijoin(
>   	ASSERT(iip->ili_lock_flags == 0);
>   	iip->ili_lock_flags = lock_flags;
>   
> -	xfs_trans_add_item(tp, (xfs_log_item_t *)(iip));
> +	xfs_trans_add_item(tp, &iip->ili_item);
>   }
>   
>   void
> @@ -570,7 +570,7 @@ _xfs_trans_bjoin(
>   	 * Attach the item to the transaction so we can find it in
>   	 * xfs_trans_get_buf() and friends.
>   	 */
> -	xfs_trans_add_item(tp, (xfs_log_item_t *)bip);
> +	xfs_trans_add_item(tp, &bip->bli_item);
>   	bp->b_transp = tp;
>   
>   }
>

Patch
diff mbox series

diff --git a/libxfs/trans.c b/libxfs/trans.c
index f78222fd..6ef4841f 100644
--- a/libxfs/trans.c
+++ b/libxfs/trans.c
@@ -346,7 +346,7 @@  xfs_trans_ijoin(
 	ASSERT(iip->ili_lock_flags == 0);
 	iip->ili_lock_flags = lock_flags;
 
-	xfs_trans_add_item(tp, (xfs_log_item_t *)(iip));
+	xfs_trans_add_item(tp, &iip->ili_item);
 }
 
 void
@@ -570,7 +570,7 @@  _xfs_trans_bjoin(
 	 * Attach the item to the transaction so we can find it in
 	 * xfs_trans_get_buf() and friends.
 	 */
-	xfs_trans_add_item(tp, (xfs_log_item_t *)bip);
+	xfs_trans_add_item(tp, &bip->bli_item);
 	bp->b_transp = tp;
 
 }