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

xfs: fix use of agi_newino in finobt lookup

Sparse warns that we are passing the big-endian valueo f agi_newino
to the initial btree lookup function when trying to find a new
inode. This is wrong - we need to pass the host order value, not the
disk order value. This will adversely affect the next inode
allocated, but given that the free inode btree is usually much
smaller than the allocated inode btree it is much less likely to be
a performance issue if we start the search in the wrong place.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>

+2 -3
+2 -3
fs/xfs/libxfs/xfs_ialloc.c
··· 1076 1076 int i; 1077 1077 1078 1078 if (agi->agi_newino != cpu_to_be32(NULLAGINO)) { 1079 - error = xfs_inobt_lookup(cur, agi->agi_newino, XFS_LOOKUP_EQ, 1080 - &i); 1079 + error = xfs_inobt_lookup(cur, be32_to_cpu(agi->agi_newino), 1080 + XFS_LOOKUP_EQ, &i); 1081 1081 if (error) 1082 1082 return error; 1083 1083 if (i == 1) { ··· 1085 1085 if (error) 1086 1086 return error; 1087 1087 XFS_WANT_CORRUPTED_RETURN(i == 1); 1088 - 1089 1088 return 0; 1090 1089 } 1091 1090 }