lkml.org 
[lkml]   [2005]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 03/10] Cpuset: update_nodemask code reformat
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>

---
kernel/cpuset.c | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
--- 2.6.15-rc3-mm1.orig/kernel/cpuset.c 2005-12-07 19:15:37.420771718 -0800
+++ 2.6.15-rc3-mm1/kernel/cpuset.c 2005-12-07 19:16:31.104966322 -0800
@@ -799,18 +799,23 @@ static int update_nodemask(struct cpuset
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;
}

--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-12-10 09:25    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site