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)
commit4c4c327b25f3414f20a9ae600e7311f1aa3a866d
tree54f1179d2e1a6ca14f72b72269cb8d6284595408
parent117f587bc3e60f4dd1c939f8488e43cb752c12ca
LU-9679 modules: convert MIN/MAX to kernel style

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>
27 files changed:
contrib/scripts/spelling.txt
libcfs/include/libcfs/libcfs_private.h
lnet/klnds/gnilnd/gnilnd.c
lnet/klnds/gnilnd/gnilnd_cb.c
lnet/klnds/gnilnd/gnilnd_conn.c
lnet/klnds/o2iblnd/o2iblnd.h
lnet/klnds/o2iblnd/o2iblnd_cb.c
lnet/klnds/socklnd/socklnd.c
lnet/klnds/socklnd/socklnd_cb.c
lnet/lnet/lib-move.c
lnet/lnet/peer.c
lnet/lnet/router_proc.c
lnet/selftest/conrpc.h
lnet/selftest/rpc.c
lustre/lod/lod_object.c
lustre/lov/lov_io.c
lustre/mdc/mdc_locks.c
lustre/mdc/mdc_request.c
lustre/mdd/mdd_dir.c
lustre/mdd/mdd_object.c
lustre/mdd/mdd_permission.c
lustre/mdt/mdt_handler.c
lustre/mgs/mgs_handler.c
lustre/obdclass/lu_object.c
lustre/ofd/ofd_objects.c
lustre/osc/osc_request.c
lustre/osd-zfs/osd_internal.h