Whamcloud - gitweb
LU-9859 libcfs: hide struct cfs_cpt_table internals 89/38389/2
authorJames Simmons <jsimmons@infradead.org>
Mon, 27 Apr 2020 15:49:33 +0000 (11:49 -0400)
committerOleg Drokin <green@whamcloud.com>
Thu, 7 May 2020 05:46:36 +0000 (05:46 +0000)
Exposing the internals of struct cfs_cpt_table in the libcfs
header used by lustre makes it too tempting to use but those
fields are not available for UP systems. Make cfs_cpt_table
abstract so the lustre and LNet code will never use the
internals and instead use the functions provided in
libcfs_cpu.h.

Linux-commit: commit a6fe6f584b6a1032c2e63e94d7a7a6f1436c3774

Change-Id: Ia2b3363bcee87e042a133cc7af9a912cbafb0d92
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/38389
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/include/libcfs/libcfs_cpu.h
libcfs/libcfs/libcfs_cpu.c

index e7ff6ae..44675f7 100644 (file)
@@ -88,40 +88,6 @@ struct cfs_cpt_table;
 #ifdef CONFIG_SMP
 extern struct cfs_cpt_table    *cfs_cpt_tab;
 
 #ifdef CONFIG_SMP
 extern struct cfs_cpt_table    *cfs_cpt_tab;
 
-/** virtual processing unit */
-struct cfs_cpu_partition {
-       /* CPUs mask for this partition */
-       cpumask_var_t                    cpt_cpumask;
-       /* nodes mask for this partition */
-       nodemask_t                      *cpt_nodemask;
-       /* NUMA distance between CPTs */
-       unsigned int                    *cpt_distance;
-       /* spread rotor for NUMA allocator */
-       unsigned int                     cpt_spread_rotor;
-       /* NUMA node if cpt_nodemask is empty */
-       int                              cpt_node;
-};
-
-/** descriptor for CPU partitions */
-struct cfs_cpt_table {
-       /* spread rotor for NUMA allocator */
-       unsigned int                     ctb_spread_rotor;
-       /* maximum NUMA distance between all nodes in table */
-       unsigned int                     ctb_distance;
-       /* # of CPU partitions */
-       int                              ctb_nparts;
-       /* partitions tables */
-       struct cfs_cpu_partition        *ctb_parts;
-       /* shadow HW CPU to CPU partition ID */
-       int                             *ctb_cpu2cpt;
-       /* all cpus in this partition table */
-       cpumask_var_t                    ctb_cpumask;
-       /* shadow HW node to CPU partition ID */
-       int                             *ctb_node2cpt;
-       /* all nodes in this partition table */
-       nodemask_t                      *ctb_nodemask;
-};
-
 /**
  * destroy a CPU partition table
  */
 /**
  * destroy a CPU partition table
  */
index 58a3a44..9fac258 100644 (file)
 #include <libcfs/libcfs_cpu.h>
 #include <libcfs/libcfs.h>
 
 #include <libcfs/libcfs_cpu.h>
 #include <libcfs/libcfs.h>
 
+/** virtual processing unit */
+struct cfs_cpu_partition {
+       /* CPUs mask for this partition */
+       cpumask_var_t                   cpt_cpumask;
+       /* nodes mask for this partition */
+       nodemask_t                      *cpt_nodemask;
+       /* NUMA distance between CPTs */
+       unsigned int                    *cpt_distance;
+       /* spread rotor for NUMA allocator */
+       unsigned int                    cpt_spread_rotor;
+       /* NUMA node if cpt_nodemask is empty */
+       int                             cpt_node;
+};
+
+/** descriptor for CPU partitions */
+struct cfs_cpt_table {
+       /* spread rotor for NUMA allocator */
+       unsigned int                    ctb_spread_rotor;
+       /* maximum NUMA distance between all nodes in table */
+       unsigned int                    ctb_distance;
+       /* # of CPU partitions */
+       int                             ctb_nparts;
+       /* partitions tables */
+       struct cfs_cpu_partition        *ctb_parts;
+       /* shadow HW CPU to CPU partition ID */
+       int                             *ctb_cpu2cpt;
+       /* all cpus in this partition table */
+       cpumask_var_t                   ctb_cpumask;
+       /* shadow HW node to CPU partition ID */
+       int                             *ctb_node2cpt;
+       /* all nodes in this partition table */
+       nodemask_t                      *ctb_nodemask;
+};
+
 /** Global CPU partition table */
 struct cfs_cpt_table *cfs_cpt_tab __read_mostly;
 EXPORT_SYMBOL(cfs_cpt_tab);
 /** Global CPU partition table */
 struct cfs_cpt_table *cfs_cpt_tab __read_mostly;
 EXPORT_SYMBOL(cfs_cpt_tab);