Re: [PATCH RFC 04/10] SUNRPC: Add common byte-swapped RPC header constants

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 04, 2019 at 09:16:54AM -0500, Chuck Lever wrote:
> They are. The problem is that we are byte-swapping the incoming wire
> data and then comparing to CPU-endian constants in some hot paths.
> It's better to leave the incoming data alone and compare to a pre-
> byte-swapped constant. This patch adds some of these constants that
> were missing, in preparation for fixing the hot paths.
> 
> That is apparently not clear from the patch description, so I will
> endeavor to improve it.

Why do we need new enums / #defines for that?

Just replace:

	if (beXX_to_cpu(pkt->field) == SOME_CONSTANT)

with

	if (pkt->field == cpu_to_be32(SOME_CONSTANT))

and we are done.  The latter is a pretty common pattern through
the kernel.



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux