diff options
author | NeilBrown <neilb@suse.com> | 2018-05-21 14:35:12 +1000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-05-25 18:29:10 +0200 |
commit | 7b8e2026fb185e5178f9137c463ff07fc895be5d (patch) | |
tree | 519f144f0c0bede927f2237e285536f9eb8ba761 /drivers/staging/lustre/include | |
parent | 457d63ea5c1aa81fe0b9a66a77a2282856b88983 (diff) | |
download | op-kernel-dev-7b8e2026fb185e5178f9137c463ff07fc895be5d.zip op-kernel-dev-7b8e2026fb185e5178f9137c463ff07fc895be5d.tar.gz |
staging: lustre: remove conditional compilation from libcfs_cpu.c
libcfs_cpu.c manages CPU partitions. In the !CONFIG_SMP case, most
of this disappears and 'static inline's from libcfs_cpu.h are used.
However we still allocate a 'struct cfs_cpt_table' and keep some
dummy data in it. This is a bit pointless.
This patch removes all the !CONFIG_SMP code from libcfs_cpu.c and
conditionally compiles the whole file only when CONFIG_SMP.
We no longer allocate a 'struct cfs_cpt_table' on !CONFIG_SMP,
and don't even declare a structure. The name "cfs_cpt_tab"
becomes always "NULL", which allows some code to be optimized away.
This means that cfs_cpt_tab can sometimes be NULL, so we need to
discard the assertion that it isn't.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/include')
-rw-r--r-- | drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h index 552e9f5..61641c4 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h @@ -109,6 +109,8 @@ struct cfs_cpt_table { nodemask_t *ctb_nodemask; }; +extern struct cfs_cpt_table *cfs_cpt_tab; + /** * return cpumask of CPU partition \a cpt */ @@ -202,17 +204,12 @@ int cfs_cpt_spread_node(struct cfs_cpt_table *cptab, int cpt); */ int cfs_cpu_ht_nsiblings(int cpu); +int cfs_cpu_init(void); +void cfs_cpu_fini(void); + #else /* !CONFIG_SMP */ -struct cfs_cpt_table { - /* # of CPU partitions */ - int ctb_nparts; - /* cpu mask */ - cpumask_t ctb_mask; - /* node mask */ - nodemask_t ctb_nodemask; - /* version */ - u64 ctb_version; -}; +struct cfs_cpt_table; +#define cfs_cpt_tab ((struct cfs_cpt_table *)NULL) static inline cpumask_var_t * cfs_cpt_cpumask(struct cfs_cpt_table *cptab, int cpt) @@ -246,7 +243,7 @@ cfs_cpt_online(struct cfs_cpt_table *cptab, int cpt) static inline nodemask_t * cfs_cpt_nodemask(struct cfs_cpt_table *cptab, int cpt) { - return &cptab->ctb_nodemask; + return NULL; } static inline int @@ -327,9 +324,18 @@ cfs_cpt_bind(struct cfs_cpt_table *cptab, int cpt) { return 0; } -#endif /* CONFIG_SMP */ -extern struct cfs_cpt_table *cfs_cpt_tab; +static inline int +cfs_cpu_init(void) +{ + return 0; +} + +static inline void cfs_cpu_fini(void) +{ +} + +#endif /* CONFIG_SMP */ /** * destroy a CPU partition table @@ -425,7 +431,4 @@ void cfs_percpt_unlock(struct cfs_percpt_lock *pcl, int index); #define cfs_cpt_for_each(i, cptab) \ for (i = 0; i < cfs_cpt_number(cptab); i++) -int cfs_cpu_init(void); -void cfs_cpu_fini(void); - #endif /* __LIBCFS_CPU_H__ */ |