Whamcloud - gitweb
LU-9679 modules: convert MIN/MAX to kernel style 56/37456/2
authorMr NeilBrown <neilb@suse.de>
Wed, 4 Dec 2019 01:26:46 +0000 (12:26 +1100)
committerOleg Drokin <green@whamcloud.com>
Fri, 14 Feb 2020 05:49:38 +0000 (05:49 +0000)
The linux kernel provides a variety of min/max style macros which
ensure type correctness - not risking signed vs unsigned comparisons
etc.

min_t and max_t can be given a type, but if the type of the
args is identicatl min/max can be used.

We also have min3() and max3() to compare three values of identical
type, and clamp_t() to restrict a value to a given range
(min(max(...)).

Use these as appropriate throughout the lustre/lnet kernel code.

The variables (rlength and mlength) have their type changed from int
to unsigned int as this makes more sense in the context, and allows
min() to be used.

Similarly the return type of kiblnd_rd_frag_size() is changed from
__u32 to unsigned int as the return value is *only* used in a min3()
comparison with another unsigned it.

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I9f0cdd23b78d2f9dd04ba58e9b9c7df8d1ee3ca1
Reviewed-on: https://review.whamcloud.com/37456
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>

No differences found