Skip to content

Commit

Permalink
[PATCH] cpuset: update_nodemask code reformat
Browse files Browse the repository at this point in the history
Restructure code layout of the kernel/cpuset.c update_nodemask() routine,
removing embedded returns and nested if's in favor of goto completion labels.
This is being done in anticipation of adding more logic to this routine, which
will favor the goto style structure.

Signed-off-by: Paul Jackson <pj@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Paul Jackson authored and Linus Torvalds committed Jan 9, 2006
1 parent c5b2aff commit 59dac16
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions kernel/cpuset.c
Original file line number Diff line number Diff line change
Expand Up @@ -799,18 +799,23 @@ static int update_nodemask(struct cpuset *cs, char *buf)
trialcs = *cs;
retval = nodelist_parse(buf, trialcs.mems_allowed);
if (retval < 0)
return retval;
goto done;
nodes_and(trialcs.mems_allowed, trialcs.mems_allowed, node_online_map);
if (nodes_empty(trialcs.mems_allowed))
return -ENOSPC;
retval = validate_change(cs, &trialcs);
if (retval == 0) {
down(&callback_sem);
cs->mems_allowed = trialcs.mems_allowed;
atomic_inc(&cpuset_mems_generation);
cs->mems_generation = atomic_read(&cpuset_mems_generation);
up(&callback_sem);
if (nodes_empty(trialcs.mems_allowed)) {
retval = -ENOSPC;
goto done;
}
retval = validate_change(cs, &trialcs);
if (retval < 0)
goto done;

down(&callback_sem);
cs->mems_allowed = trialcs.mems_allowed;
atomic_inc(&cpuset_mems_generation);
cs->mems_generation = atomic_read(&cpuset_mems_generation);
up(&callback_sem);

done:
return retval;
}

Expand Down

0 comments on commit 59dac16

Please sign in to comment.