Staging
v0.6.0
https://github.com/torvalds/linux
Revision 9c06938aa458843fb71fa35371f23a3b89317252 authored by Andrew Vasquez on 23 August 2006, 21:54:54 UTC, committed by James Bottomley on 26 August 2006, 14:26:27 UTC
Original code attempts to retry PLOGIs to fcports that are
FCP_TARGETs only.  If the driver never performed a successful
PLOGI/PRLI, the port-type would never be assigned, and the
relogin logic would silently drop the request (and thus the port
would not be recognized and registered).

The fix is relatively straightforward, drop the FCP_TARGET-only
check.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
1 parent b2155d0
Raw File
Tip revision: 9c06938aa458843fb71fa35371f23a3b89317252 authored by Andrew Vasquez on 23 August 2006, 21:54:54 UTC
[SCSI] qla2xxx: Correct PLOGI retry logic.
Tip revision: 9c06938
percpu_counter.c
/*
 * Fast batching percpu counters.
 */

#include <linux/percpu_counter.h>
#include <linux/module.h>

void percpu_counter_mod(struct percpu_counter *fbc, s32 amount)
{
	long count;
	s32 *pcount;
	int cpu = get_cpu();

	pcount = per_cpu_ptr(fbc->counters, cpu);
	count = *pcount + amount;
	if (count >= FBC_BATCH || count <= -FBC_BATCH) {
		spin_lock(&fbc->lock);
		fbc->count += count;
		*pcount = 0;
		spin_unlock(&fbc->lock);
	} else {
		*pcount = count;
	}
	put_cpu();
}
EXPORT_SYMBOL(percpu_counter_mod);

/*
 * Add up all the per-cpu counts, return the result.  This is a more accurate
 * but much slower version of percpu_counter_read_positive()
 */
s64 percpu_counter_sum(struct percpu_counter *fbc)
{
	s64 ret;
	int cpu;

	spin_lock(&fbc->lock);
	ret = fbc->count;
	for_each_possible_cpu(cpu) {
		s32 *pcount = per_cpu_ptr(fbc->counters, cpu);
		ret += *pcount;
	}
	spin_unlock(&fbc->lock);
	return ret < 0 ? 0 : ret;
}
EXPORT_SYMBOL(percpu_counter_sum);
back to top