aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/nodemask.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/nodemask.h')
-rw-r--r--include/linux/nodemask.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 848025cd7087..829b94b156f2 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -408,6 +408,19 @@ static inline int num_node_state(enum node_states state)
408#define next_online_node(nid) next_node((nid), node_states[N_ONLINE]) 408#define next_online_node(nid) next_node((nid), node_states[N_ONLINE])
409 409
410extern int nr_node_ids; 410extern int nr_node_ids;
411extern int nr_online_nodes;
412
413static inline void node_set_online(int nid)
414{
415 node_set_state(nid, N_ONLINE);
416 nr_online_nodes = num_node_state(N_ONLINE);
417}
418
419static inline void node_set_offline(int nid)
420{
421 node_clear_state(nid, N_ONLINE);
422 nr_online_nodes = num_node_state(N_ONLINE);
423}
411#else 424#else
412 425
413static inline int node_state(int node, enum node_states state) 426static inline int node_state(int node, enum node_states state)
@@ -434,7 +447,10 @@ static inline int num_node_state(enum node_states state)
434#define first_online_node 0 447#define first_online_node 0
435#define next_online_node(nid) (MAX_NUMNODES) 448#define next_online_node(nid) (MAX_NUMNODES)
436#define nr_node_ids 1 449#define nr_node_ids 1
450#define nr_online_nodes 1
437 451
452#define node_set_online(node) node_set_state((node), N_ONLINE)
453#define node_set_offline(node) node_clear_state((node), N_ONLINE)
438#endif 454#endif
439 455
440#define node_online_map node_states[N_ONLINE] 456#define node_online_map node_states[N_ONLINE]
@@ -454,9 +470,6 @@ static inline int num_node_state(enum node_states state)
454#define node_online(node) node_state((node), N_ONLINE) 470#define node_online(node) node_state((node), N_ONLINE)
455#define node_possible(node) node_state((node), N_POSSIBLE) 471#define node_possible(node) node_state((node), N_POSSIBLE)
456 472
457#define node_set_online(node) node_set_state((node), N_ONLINE)
458#define node_set_offline(node) node_clear_state((node), N_ONLINE)
459
460#define for_each_node(node) for_each_node_state(node, N_POSSIBLE) 473#define for_each_node(node) for_each_node_state(node, N_POSSIBLE)
461#define for_each_online_node(node) for_each_node_state(node, N_ONLINE) 474#define for_each_online_node(node) for_each_node_state(node, N_ONLINE)
462 475