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>
This commit is contained in:
Matthias Kaehlcke 2007-10-02 11:21:34 -07:00 коммит произвёл J. Bruce Fields
Родитель dfad9441be
Коммит 094f282521
1 изменённых файлов: 7 добавлений и 10 удалений

Просмотреть файл

@ -700,13 +700,12 @@ EXPORT_SYMBOL(posix_test_lock);
static int posix_locks_deadlock(struct file_lock *caller_fl, static int posix_locks_deadlock(struct file_lock *caller_fl,
struct file_lock *block_fl) struct file_lock *block_fl)
{ {
struct list_head *tmp; struct file_lock *fl;
next_task: next_task:
if (posix_same_owner(caller_fl, block_fl)) if (posix_same_owner(caller_fl, block_fl))
return 1; return 1;
list_for_each(tmp, &blocked_list) { list_for_each_entry(fl, &blocked_list, fl_link) {
struct file_lock *fl = list_entry(tmp, struct file_lock, fl_link);
if (posix_same_owner(fl, block_fl)) { if (posix_same_owner(fl, block_fl)) {
fl = fl->fl_next; fl = fl->fl_next;
block_fl = fl; block_fl = fl;
@ -2164,24 +2163,22 @@ static void move_lock_status(char **p, off_t* pos, off_t offset)
int get_locks_status(char *buffer, char **start, off_t offset, int length) int get_locks_status(char *buffer, char **start, off_t offset, int length)
{ {
struct list_head *tmp; struct file_lock *fl;
char *q = buffer; char *q = buffer;
off_t pos = 0; off_t pos = 0;
int i = 0; int i = 0;
lock_kernel(); lock_kernel();
list_for_each(tmp, &file_lock_list) { list_for_each_entry(fl, &file_lock_list, fl_link) {
struct list_head *btmp; struct file_lock *bfl;
struct file_lock *fl = list_entry(tmp, struct file_lock, fl_link);
lock_get_status(q, fl, ++i, ""); lock_get_status(q, fl, ++i, "");
move_lock_status(&q, &pos, offset); move_lock_status(&q, &pos, offset);
if(pos >= offset+length) if(pos >= offset+length)
goto done; goto done;
list_for_each(btmp, &fl->fl_block) { list_for_each_entry(bfl, &fl->fl_block, fl_block) {
struct file_lock *bfl = list_entry(btmp,
struct file_lock, fl_block);
lock_get_status(q, bfl, i, " ->"); lock_get_status(q, bfl, i, " ->");
move_lock_status(&q, &pos, offset); move_lock_status(&q, &pos, offset);