aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
authorRobert Love <robert.w.love@intel.com>2009-03-31 18:51:50 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-04-03 10:22:58 -0400
commit582b45bc577f78b5bfff3db874594ce2d962b846 (patch)
treeb0cfe95b235aeca9b967cba8446db58b8a102533 /include/scsi
parent5e5e92df49d4dfbef9ba981297c7f76d189376ac (diff)
[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>
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/libfc.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index a70eafaad084..4e1d394348cf 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -22,6 +22,7 @@
22 22
23#include <linux/timer.h> 23#include <linux/timer.h>
24#include <linux/if.h> 24#include <linux/if.h>
25#include <linux/percpu.h>
25 26
26#include <scsi/scsi_transport.h> 27#include <scsi/scsi_transport.h>
27#include <scsi/scsi_transport_fc.h> 28#include <scsi/scsi_transport_fc.h>
@@ -661,7 +662,8 @@ struct fc_lport {
661 unsigned long boot_time; 662 unsigned long boot_time;
662 663
663 struct fc_host_statistics host_stats; 664 struct fc_host_statistics host_stats;
664 struct fcoe_dev_stats *dev_stats[NR_CPUS]; 665 struct fcoe_dev_stats *dev_stats;
666
665 u64 wwpn; 667 u64 wwpn;
666 u64 wwnn; 668 u64 wwnn;
667 u8 retry_count; 669 u8 retry_count;
@@ -722,6 +724,25 @@ static inline void fc_lport_state_enter(struct fc_lport *lp,
722 lp->state = state; 724 lp->state = state;
723} 725}
724 726
727static inline int fc_lport_init_stats(struct fc_lport *lp)
728{
729 /* allocate per cpu stats block */
730 lp->dev_stats = alloc_percpu(struct fcoe_dev_stats);
731 if (!lp->dev_stats)
732 return -ENOMEM;
733 return 0;
734}
735
736static inline void fc_lport_free_stats(struct fc_lport *lp)
737{
738 free_percpu(lp->dev_stats);
739}
740
741static inline struct fcoe_dev_stats *fc_lport_get_stats(struct fc_lport *lp)
742{
743 return per_cpu_ptr(lp->dev_stats, smp_processor_id());
744}
745
725 746
726/* 747/*
727 * LOCAL PORT LAYER 748 * LOCAL PORT LAYER