[SCSI] fcoe: Use per-CPU kernel function for dev_stats instead of an array
Remove the hotplug creation of dev_stats, we allocate for all possible CPUs now when we allocate the lport. v2: Durring the 2.6.30 merge window, before these patches were comitted, 'percpu_ptr' was renamed 'per_cpu_ptr'. This latest update updates this patch for the name change. Signed-off-by: Yi Zou <yi.zou@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
This commit is contained in:

committed by
James Bottomley

parent
5e5e92df49
commit
582b45bc57
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <linux/timer.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/percpu.h>
|
||||
|
||||
#include <scsi/scsi_transport.h>
|
||||
#include <scsi/scsi_transport_fc.h>
|
||||
@@ -661,7 +662,8 @@ struct fc_lport {
|
||||
unsigned long boot_time;
|
||||
|
||||
struct fc_host_statistics host_stats;
|
||||
struct fcoe_dev_stats *dev_stats[NR_CPUS];
|
||||
struct fcoe_dev_stats *dev_stats;
|
||||
|
||||
u64 wwpn;
|
||||
u64 wwnn;
|
||||
u8 retry_count;
|
||||
@@ -722,6 +724,25 @@ static inline void fc_lport_state_enter(struct fc_lport *lp,
|
||||
lp->state = state;
|
||||
}
|
||||
|
||||
static inline int fc_lport_init_stats(struct fc_lport *lp)
|
||||
{
|
||||
/* allocate per cpu stats block */
|
||||
lp->dev_stats = alloc_percpu(struct fcoe_dev_stats);
|
||||
if (!lp->dev_stats)
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void fc_lport_free_stats(struct fc_lport *lp)
|
||||
{
|
||||
free_percpu(lp->dev_stats);
|
||||
}
|
||||
|
||||
static inline struct fcoe_dev_stats *fc_lport_get_stats(struct fc_lport *lp)
|
||||
{
|
||||
return per_cpu_ptr(lp->dev_stats, smp_processor_id());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* LOCAL PORT LAYER
|
||||
|
Reference in New Issue
Block a user