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

xfs: don't cast inode_log_items to get the log_item

The cast is not type safe, and we can just dereference the first
member instead to start with.

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
b3b14aac 9ce632a2

+2 -2
+2 -2
fs/xfs/xfs_inode.c
··· 485 485 */ 486 486 if (!try_lock) { 487 487 for (j = (i - 1); j >= 0 && !try_lock; j--) { 488 - lp = (xfs_log_item_t *)ips[j]->i_itemp; 488 + lp = &ips[j]->i_itemp->ili_item; 489 489 if (lp && test_bit(XFS_LI_IN_AIL, &lp->li_flags)) 490 490 try_lock++; 491 491 } ··· 585 585 * the second lock. If we can't get it, we must release the first one 586 586 * and try again. 587 587 */ 588 - lp = (xfs_log_item_t *)ip0->i_itemp; 588 + lp = &ip0->i_itemp->ili_item; 589 589 if (lp && test_bit(XFS_LI_IN_AIL, &lp->li_flags)) { 590 590 if (!xfs_ilock_nowait(ip1, xfs_lock_inumorder(ip1_mode, 1))) { 591 591 xfs_iunlock(ip0, ip0_mode);