Skip to content

Commit b6ccde3

Browse files
ebiggersAndreas Gruenbacher
authored andcommitted
gfs2: avoid inefficient use of crc32_le_shift()
__get_log_header() was using crc32_le_shift() to update a CRC with four zero bytes. However, this is about 5x slower than just CRC'ing four zero bytes in the normal way. Just do that instead. (We could instead make crc32_le_shift() faster on short lengths. But all its callers do just fine without it, so I'd like to just remove it.) Signed-off-by: Eric Biggers <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent 87faee3 commit b6ccde3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/gfs2/recovery.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ void gfs2_revoke_clean(struct gfs2_jdesc *jd)
118118
int __get_log_header(struct gfs2_sbd *sdp, const struct gfs2_log_header *lh,
119119
unsigned int blkno, struct gfs2_log_header_host *head)
120120
{
121+
const u32 zero = 0;
121122
u32 hash, crc;
122123

123124
if (lh->lh_header.mh_magic != cpu_to_be32(GFS2_MAGIC) ||
@@ -126,7 +127,7 @@ int __get_log_header(struct gfs2_sbd *sdp, const struct gfs2_log_header *lh,
126127
return 1;
127128

128129
hash = crc32(~0, lh, LH_V1_SIZE - 4);
129-
hash = ~crc32_le_shift(hash, 4); /* assume lh_hash is zero */
130+
hash = ~crc32(hash, &zero, 4); /* assume lh_hash is zero */
130131

131132
if (be32_to_cpu(lh->lh_hash) != hash)
132133
return 1;

0 commit comments

Comments
 (0)