aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias.kaehlcke@gmail.com>2007-10-02 14:21:34 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2007-10-09 18:32:46 -0400
commit094f2825218fec1b240cb8537d2d0a10edf5ddc9 (patch)
treebadec49dc185e0b5cfcf6a6a04623077d35152ca /fs
parentdfad9441be82f1eadc3fa3f1bbc93f93d48d1bdf (diff)
fs/locks.c: use list_for_each_entry() instead of list_for_each()
fs/locks.c: use list_for_each_entry() instead of list_for_each() in posix_locks_deadlock() and get_locks_status() Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/locks.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/locks.c b/fs/locks.c
index 9a3fe0d8285b..c17bc00b1e8d 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -700,13 +700,12 @@ EXPORT_SYMBOL(posix_test_lock);
700static int posix_locks_deadlock(struct file_lock *caller_fl, 700static int posix_locks_deadlock(struct file_lock *caller_fl,
701 struct file_lock *block_fl) 701 struct file_lock *block_fl)
702{ 702{
703 struct list_head *tmp; 703 struct file_lock *fl;
704 704
705next_task: 705next_task:
706 if (posix_same_owner(caller_fl, block_fl)) 706 if (posix_same_owner(caller_fl, block_fl))
707 return 1; 707 return 1;
708 list_for_each(tmp, &blocked_list) { 708 list_for_each_entry(fl, &blocked_list, fl_link) {
709 struct file_lock *fl = list_entry(tmp, struct file_lock, fl_link);
710 if (posix_same_owner(fl, block_fl)) { 709 if (posix_same_owner(fl, block_fl)) {
711 fl = fl->fl_next; 710 fl = fl->fl_next;
712 block_fl = fl; 711 block_fl = fl;
@@ -2164,24 +2163,22 @@ static void move_lock_status(char **p, off_t* pos, off_t offset)
2164 2163
2165int get_locks_status(char *buffer, char **start, off_t offset, int length) 2164int get_locks_status(char *buffer, char **start, off_t offset, int length)
2166{ 2165{
2167 struct list_head *tmp; 2166 struct file_lock *fl;
2168 char *q = buffer; 2167 char *q = buffer;
2169 off_t pos = 0; 2168 off_t pos = 0;
2170 int i = 0; 2169 int i = 0;
2171 2170
2172 lock_kernel(); 2171 lock_kernel();
2173 list_for_each(tmp, &file_lock_list) { 2172 list_for_each_entry(fl, &file_lock_list, fl_link) {
2174 struct list_head *btmp; 2173 struct file_lock *bfl;
2175 struct file_lock *fl = list_entry(tmp, struct file_lock, fl_link); 2174
2176 lock_get_status(q, fl, ++i, ""); 2175 lock_get_status(q, fl, ++i, "");
2177 move_lock_status(&q, &pos, offset); 2176 move_lock_status(&q, &pos, offset);
2178 2177
2179 if(pos >= offset+length) 2178 if(pos >= offset+length)
2180 goto done; 2179 goto done;
2181 2180
2182 list_for_each(btmp, &fl->fl_block) { 2181 list_for_each_entry(bfl, &fl->fl_block, fl_block) {
2183 struct file_lock *bfl = list_entry(btmp,
2184 struct file_lock, fl_block);
2185 lock_get_status(q, bfl, i, " ->"); 2182 lock_get_status(q, bfl, i, " ->");
2186 move_lock_status(&q, &pos, offset); 2183 move_lock_status(&q, &pos, offset);
2187 2184