Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c575417 authored by Jeremiah Mahler's avatar Jeremiah Mahler Committed by Greg Kroah-Hartman
Browse files

staging: lustre: use min/max instead of MIN/MAX, simple cases



Custom MIN/MAX operations are being used which are not as robust
as the built in min/max operations which will warn about potentially
problematic type comparisons.

For the simple cases, where no type warning is produced, simply
replace MIN/MAX with min/max.

Signed-off-by: default avatarJeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3f3af378
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1125,7 +1125,7 @@ kiblnd_init_rdma (kib_conn_t *conn, kib_tx_t *tx, int type,
			break;
		}

		wrknob = MIN(MIN(kiblnd_rd_frag_size(srcrd, srcidx),
		wrknob = min(min(kiblnd_rd_frag_size(srcrd, srcidx),
				 kiblnd_rd_frag_size(dstrd, dstidx)), resid);

		sge = &tx->tx_sge[tx->tx_nwrq];
+1 −1
Original line number Diff line number Diff line
@@ -773,7 +773,7 @@ ksocknal_select_ips(ksock_peer_t *peer, __u32 *peerips, int n_peerips)
	/* Only match interfaces for additional connections
	 * if I have > 1 interface */
	n_ips = (net->ksnn_ninterfaces < 2) ? 0 :
		MIN(n_peerips, net->ksnn_ninterfaces);
		min(n_peerips, net->ksnn_ninterfaces);

	for (i = 0; peer->ksnp_n_passive_ips < n_ips; i++) {
		/*	      ^ yes really... */
+2 −2
Original line number Diff line number Diff line
@@ -1950,10 +1950,10 @@ ksocknal_connect (ksock_route_t *route)
	/* This is a retry rather than a new connection */
	route->ksnr_retry_interval *= 2;
	route->ksnr_retry_interval =
		MAX(route->ksnr_retry_interval,
		max(route->ksnr_retry_interval,
		    cfs_time_seconds(*ksocknal_tunables.ksnd_min_reconnectms)/1000);
	route->ksnr_retry_interval =
		MIN(route->ksnr_retry_interval,
		min(route->ksnr_retry_interval,
		    cfs_time_seconds(*ksocknal_tunables.ksnd_max_reconnectms)/1000);

	LASSERT (route->ksnr_retry_interval != 0);
+6 −6
Original line number Diff line number Diff line
@@ -201,9 +201,9 @@ lnet_copy_iov2iov(unsigned int ndiov, struct kvec *diov, unsigned int doffset,
	do {
		LASSERT(ndiov > 0);
		LASSERT(nsiov > 0);
		this_nob = MIN(diov->iov_len - doffset,
		this_nob = min(diov->iov_len - doffset,
			       siov->iov_len - soffset);
		this_nob = MIN(this_nob, nob);
		this_nob = min(this_nob, nob);

		memcpy((char *)diov->iov_base + doffset,
			(char *)siov->iov_base + soffset, this_nob);
@@ -322,9 +322,9 @@ lnet_copy_kiov2kiov(unsigned int ndiov, lnet_kiov_t *diov, unsigned int doffset,
	do {
		LASSERT(ndiov > 0);
		LASSERT(nsiov > 0);
		this_nob = MIN(diov->kiov_len - doffset,
		this_nob = min(diov->kiov_len - doffset,
			       siov->kiov_len - soffset);
		this_nob = MIN(this_nob, nob);
		this_nob = min(this_nob, nob);

		if (daddr == NULL)
			daddr = ((char *)kmap(diov->kiov_page)) +
@@ -405,7 +405,7 @@ lnet_copy_kiov2iov(unsigned int niov, struct kvec *iov, unsigned int iovoffset,
		LASSERT(nkiov > 0);
		this_nob = MIN(iov->iov_len - iovoffset,
			       kiov->kiov_len - kiovoffset);
		this_nob = MIN(this_nob, nob);
		this_nob = min(this_nob, nob);

		if (addr == NULL)
			addr = ((char *)kmap(kiov->kiov_page)) +
@@ -476,7 +476,7 @@ lnet_copy_iov2kiov(unsigned int nkiov, lnet_kiov_t *kiov,
		LASSERT(niov > 0);
		this_nob = MIN(kiov->kiov_len - kiovoffset,
			       iov->iov_len - iovoffset);
		this_nob = MIN(this_nob, nob);
		this_nob = min(this_nob, nob);

		if (addr == NULL)
			addr = ((char *)kmap(kiov->kiov_page)) +
+2 −2
Original line number Diff line number Diff line
@@ -793,7 +793,7 @@ lnet_update_ni_status_locked(void)
	LASSERT(the_lnet.ln_routing);

	timeout = router_ping_timeout +
		  MAX(live_router_check_interval, dead_router_check_interval);
		  max(live_router_check_interval, dead_router_check_interval);

	now = get_seconds();
	list_for_each_entry(ni, &the_lnet.ln_nis, ni_list) {
@@ -1593,7 +1593,7 @@ lnet_router_checker (void)
		return;

	if (last != 0 &&
	    interval > MAX(live_router_check_interval,
	    interval > max(live_router_check_interval,
			   dead_router_check_interval))
		CNETERR("Checker(%d/%d) not called for %d seconds\n",
			live_router_check_interval, dead_router_check_interval,
Loading