Commit 93aa2c2a authored by NeilBrown's avatar NeilBrown Committed by Greg Kroah-Hartman

staging: lustre: rearrange placement of CPU partition management code.

Currently the code for cpu-partition tables lives in various places.
The non-SMP code is partly in libcfs/libcfs_cpu.h as static inlines,
and partly in lnet/libcfs/libcfs_cpu.c - some of the functions are
tiny and could well be inlines.

The SMP code is all in lnet/libcfs/linux/linux-cpu.c.

This patch moves all the trivial non-SMP functions into
libcfs_cpu.h as inlines, and all the SMP functions into libcfs_cpu.c
with the non-trival !SMP code.

Now when you go looking for some function, it is easier to find both
versions together when neither is trivial.

There is no code change here - just code movement.
Signed-off-by: default avatarNeilBrown <neilb@suse.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent eba85728
...@@ -117,41 +117,6 @@ cpumask_var_t *cfs_cpt_cpumask(struct cfs_cpt_table *cptab, int cpt); ...@@ -117,41 +117,6 @@ cpumask_var_t *cfs_cpt_cpumask(struct cfs_cpt_table *cptab, int cpt);
* print string information of cpt-table * print string information of cpt-table
*/ */
int cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len); int cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len);
#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;
};
static inline cpumask_var_t *
cfs_cpt_cpumask(struct cfs_cpt_table *cptab, int cpt)
{
return NULL;
}
static inline int
cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len)
{
return 0;
}
#endif /* CONFIG_SMP */
extern struct cfs_cpt_table *cfs_cpt_table;
/**
* destroy a CPU partition table
*/
void cfs_cpt_table_free(struct cfs_cpt_table *cptab);
/**
* create a cfs_cpt_table with \a ncpt number of partitions
*/
struct cfs_cpt_table *cfs_cpt_table_alloc(unsigned int ncpt);
/** /**
* return total number of CPU partitions in \a cptab * return total number of CPU partitions in \a cptab
*/ */
...@@ -237,6 +202,144 @@ int cfs_cpt_spread_node(struct cfs_cpt_table *cptab, int cpt); ...@@ -237,6 +202,144 @@ int cfs_cpt_spread_node(struct cfs_cpt_table *cptab, int cpt);
*/ */
int cfs_cpu_ht_nsiblings(int cpu); int cfs_cpu_ht_nsiblings(int cpu);
#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;
};
static inline cpumask_var_t *
cfs_cpt_cpumask(struct cfs_cpt_table *cptab, int cpt)
{
return NULL;
}
static inline int
cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len)
{
return 0;
}
static inline int
cfs_cpt_number(struct cfs_cpt_table *cptab)
{
return 1;
}
static inline int
cfs_cpt_weight(struct cfs_cpt_table *cptab, int cpt)
{
return 1;
}
static inline int
cfs_cpt_online(struct cfs_cpt_table *cptab, int cpt)
{
return 1;
}
static inline nodemask_t *
cfs_cpt_nodemask(struct cfs_cpt_table *cptab, int cpt)
{
return &cptab->ctb_nodemask;
}
static inline int
cfs_cpt_set_cpu(struct cfs_cpt_table *cptab, int cpt, int cpu)
{
return 1;
}
static inline void
cfs_cpt_unset_cpu(struct cfs_cpt_table *cptab, int cpt, int cpu)
{
}
static inline int
cfs_cpt_set_cpumask(struct cfs_cpt_table *cptab, int cpt, cpumask_t *mask)
{
return 1;
}
static inline void
cfs_cpt_unset_cpumask(struct cfs_cpt_table *cptab, int cpt, cpumask_t *mask)
{
}
static inline int
cfs_cpt_set_node(struct cfs_cpt_table *cptab, int cpt, int node)
{
return 1;
}
static inline void
cfs_cpt_unset_node(struct cfs_cpt_table *cptab, int cpt, int node)
{
}
static inline int
cfs_cpt_set_nodemask(struct cfs_cpt_table *cptab, int cpt, nodemask_t *mask)
{
return 1;
}
static inline void
cfs_cpt_unset_nodemask(struct cfs_cpt_table *cptab, int cpt, nodemask_t *mask)
{
}
static inline void
cfs_cpt_clear(struct cfs_cpt_table *cptab, int cpt)
{
}
static inline int
cfs_cpt_spread_node(struct cfs_cpt_table *cptab, int cpt)
{
return 0;
}
static inline int
cfs_cpu_ht_nsiblings(int cpu)
{
return 1;
}
static inline int
cfs_cpt_current(struct cfs_cpt_table *cptab, int remap)
{
return 0;
}
static inline int
cfs_cpt_of_cpu(struct cfs_cpt_table *cptab, int cpu)
{
return 0;
}
static inline int
cfs_cpt_bind(struct cfs_cpt_table *cptab, int cpt)
{
return 0;
}
#endif /* CONFIG_SMP */
extern struct cfs_cpt_table *cfs_cpt_table;
/**
* destroy a CPU partition table
*/
void cfs_cpt_table_free(struct cfs_cpt_table *cptab);
/**
* create a cfs_cpt_table with \a ncpt number of partitions
*/
struct cfs_cpt_table *cfs_cpt_table_alloc(unsigned int ncpt);
/* /*
* allocate per-cpu-partition data, returned value is an array of pointers, * allocate per-cpu-partition data, returned value is an array of pointers,
* variable can be indexed by CPU ID. * variable can be indexed by CPU ID.
......
...@@ -5,7 +5,6 @@ subdir-ccflags-y += -I$(srctree)/drivers/staging/lustre/lustre/include ...@@ -5,7 +5,6 @@ subdir-ccflags-y += -I$(srctree)/drivers/staging/lustre/lustre/include
obj-$(CONFIG_LNET) += libcfs.o obj-$(CONFIG_LNET) += libcfs.o
libcfs-linux-objs := linux-tracefile.o linux-debug.o libcfs-linux-objs := linux-tracefile.o linux-debug.o
libcfs-linux-objs += linux-cpu.o
libcfs-linux-objs += linux-module.o libcfs-linux-objs += linux-module.o
libcfs-linux-objs += linux-crypto.o libcfs-linux-objs += linux-crypto.o
libcfs-linux-objs += linux-crypto-adler.o libcfs-linux-objs += linux-crypto-adler.o
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment