From: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
To: viro@zeniv.linux.org.uk
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: PATCH [4/5] fs/locks.c: use list_for_each_entry() instead of list_for_each()
Date: Sun, 15 Jul 2007 21:06:12 +0200 [thread overview]
Message-ID: <20070715190612.GI4034@traven> (raw)
In-Reply-To: <20070715185409.GE4034@traven>
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>
--
diff --git a/fs/locks.c b/fs/locks.c
index 431a8b8..d09c6bd 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -702,13 +702,12 @@ EXPORT_SYMBOL(posix_test_lock);
static int posix_locks_deadlock(struct file_lock *caller_fl,
struct file_lock *block_fl)
{
- struct list_head *tmp;
+ struct file_lock *fl;
next_task:
if (posix_same_owner(caller_fl, block_fl))
return 1;
- list_for_each(tmp, &blocked_list) {
- struct file_lock *fl = list_entry(tmp, struct file_lock, fl_link);
+ list_for_each_entry(fl, &blocked_list, fl_link) {
if (posix_same_owner(fl, block_fl)) {
fl = fl->fl_next;
block_fl = fl;
@@ -2159,24 +2158,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)
{
- struct list_head *tmp;
+ struct file_lock *fl;
char *q = buffer;
off_t pos = 0;
int i = 0;
lock_kernel();
- list_for_each(tmp, &file_lock_list) {
- struct list_head *btmp;
- struct file_lock *fl = list_entry(tmp, struct file_lock, fl_link);
+ list_for_each_entry(fl, &file_lock_list, fl_link) {
+ struct file_lock *bfl;
+
lock_get_status(q, fl, ++i, "");
move_lock_status(&q, &pos, offset);
if(pos >= offset+length)
goto done;
- list_for_each(btmp, &fl->fl_block) {
- struct file_lock *bfl = list_entry(btmp,
- struct file_lock, fl_block);
+ list_for_each_entry(bfl, &fl->fl_block, fl_block) {
lock_get_status(q, bfl, i, " ->");
move_lock_status(&q, &pos, offset);
--
Matthias Kaehlcke
Linux Application Developer
Barcelona
I am incapable of conceiving infinity, and yet I do not accept finity
(Simone de Beauvoir)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
next prev parent reply other threads:[~2007-07-15 19:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-15 18:54 PATCH [0/5] file system core: use list_for_each_entry() instead of list_for_each() Matthias Kaehlcke
2007-07-15 18:59 ` PATCH [1/5] fs/file_table.c: " Matthias Kaehlcke
2007-07-15 19:01 ` PATCH [2/5] fs/eventpoll.c: " Matthias Kaehlcke
2007-07-15 19:03 ` PATCH [3/5] fs/super.c: " Matthias Kaehlcke
2007-07-15 19:06 ` Matthias Kaehlcke [this message]
2007-07-15 19:08 ` PATCH [5/5] fs/block_dev.c: " Matthias Kaehlcke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070715190612.GI4034@traven \
--to=matthias.kaehlcke@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox