public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* PATCH [0/5] file system core: use list_for_each_entry() instead of list_for_each()
@ 2007-07-15 18:54 Matthias Kaehlcke
  2007-07-15 18:59 ` PATCH [1/5] fs/file_table.c: " Matthias Kaehlcke
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Matthias Kaehlcke @ 2007-07-15 18:54 UTC (permalink / raw)
  To: viro; +Cc: linux-kernel, akpm

This patchset replaces some list_for_each() loops by
list_for_each_entry() loops in the following file system functions:

fs_may_remount_ro()
ep_poll_safewake(()
sget()
posix_locks_deadlock()
get_locks_status()
nr_blockdev_pages()

-- 
Matthias Kaehlcke
Linux Application Developer
Barcelona

                Don't walk behind me, I may not lead
             Don't walk in front of me, I may not follow
                Just walk beside me and be my friend
                          (Albert Camus)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-

^ permalink raw reply	[flat|nested] 6+ messages in thread

* PATCH [1/5] fs/file_table.c: use list_for_each_entry() instead of list_for_each()
  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 ` Matthias Kaehlcke
  2007-07-15 19:01 ` PATCH [2/5] fs/eventpoll.c: " Matthias Kaehlcke
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Matthias Kaehlcke @ 2007-07-15 18:59 UTC (permalink / raw)
  To: viro; +Cc: linux-kernel, akpm

fs/file_table.c: use list_for_each_entry() instead of list_for_each()
in fs_may_remount_ro()

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>

--

diff --git a/fs/file_table.c b/fs/file_table.c
index d17fd69..3ddd993 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -264,12 +264,11 @@ void file_kill(struct file *file)
 
 int fs_may_remount_ro(struct super_block *sb)
 {
-	struct list_head *p;
+	struct file *file;
 
 	/* Check that no files are currently opened for writing. */
 	file_list_lock();
-	list_for_each(p, &sb->s_files) {
-		struct file *file = list_entry(p, struct file, f_u.fu_list);
+	list_for_each_entry(file, &sb->s_files, f_u.fu_list) {
 		struct inode *inode = file->f_path.dentry->d_inode;
 
 		/* File with pending delete? */

-- 
Matthias Kaehlcke
Linux Application Developer
Barcelona

      The assumption that what currently exists must necessarily
        exist is the acid that corrodes all visionary thinking
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* PATCH [2/5] fs/eventpoll.c: use list_for_each_entry() instead of list_for_each()
  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 ` Matthias Kaehlcke
  2007-07-15 19:03 ` PATCH [3/5] fs/super.c: " Matthias Kaehlcke
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Matthias Kaehlcke @ 2007-07-15 19:01 UTC (permalink / raw)
  To: viro; +Cc: linux-kernel, akpm

fs/eventpoll.c: use list_for_each_entry() instead of list_for_each()
in ep_poll_safewake()

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>

--

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 0b73cd4..fada1f9 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -325,15 +325,14 @@ static void ep_poll_safewake(struct poll_safewake *psw, wait_queue_head_t *wq)
 	int wake_nests = 0;
 	unsigned long flags;
 	struct task_struct *this_task = current;
-	struct list_head *lsthead = &psw->wake_task_list, *lnk;
+	struct list_head *lsthead = &psw->wake_task_list;
 	struct wake_task_node *tncur;
 	struct wake_task_node tnode;
 
 	spin_lock_irqsave(&psw->lock, flags);
 
 	/* Try to see if the current task is already inside this wakeup call */
-	list_for_each(lnk, lsthead) {
-		tncur = list_entry(lnk, struct wake_task_node, llink);
+	list_for_each_entry(tncur, lsthead, llink) {
 
 		if (tncur->wq == wq ||
 		    (tncur->task == this_task && ++wake_nests > EP_MAX_POLLWAKE_NESTS)) {

-- 
Matthias Kaehlcke
Linux Application Developer
Barcelona


   Usually when people are sad, they don't do anything. They just cry over
     their condition. But when they get angry, they bring about a change
                              (Malcolm X)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* PATCH [3/5] fs/super.c: use list_for_each_entry() instead of list_for_each()
  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 ` Matthias Kaehlcke
  2007-07-15 19:06 ` PATCH [4/5] fs/locks.c: " Matthias Kaehlcke
  2007-07-15 19:08 ` PATCH [5/5] fs/block_dev.c: " Matthias Kaehlcke
  4 siblings, 0 replies; 6+ messages in thread
From: Matthias Kaehlcke @ 2007-07-15 19:03 UTC (permalink / raw)
  To: viro; +Cc: linux-kernel, akpm

fs/super.c: use list_for_each_entry() instead of list_for_each() in
sget()

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>

--

diff --git a/fs/super.c b/fs/super.c
index 5260d62..6866c92 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -335,14 +335,12 @@ struct super_block *sget(struct file_system_type *type,
 			void *data)
 {
 	struct super_block *s = NULL;
-	struct list_head *p;
+	struct super_block *old;
 	int err;
 
 retry:
 	spin_lock(&sb_lock);
-	if (test) list_for_each(p, &type->fs_supers) {
-		struct super_block *old;
-		old = list_entry(p, struct super_block, s_instances);
+	if (test) list_for_each_entry(old, &type->fs_supers, s_instances) {
 		if (!test(old, data))
 			continue;
 		if (!grab_super(old))

-- 
Matthias Kaehlcke
Linux Application Developer
Barcelona

      El trabajo es el refugio de los que no tienen nada que hacer
                            (Oscar Wilde)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* PATCH [4/5] fs/locks.c: use list_for_each_entry() instead of list_for_each()
  2007-07-15 18:54 PATCH [0/5] file system core: use list_for_each_entry() instead of list_for_each() Matthias Kaehlcke
                   ` (2 preceding siblings ...)
  2007-07-15 19:03 ` PATCH [3/5] fs/super.c: " Matthias Kaehlcke
@ 2007-07-15 19:06 ` Matthias Kaehlcke
  2007-07-15 19:08 ` PATCH [5/5] fs/block_dev.c: " Matthias Kaehlcke
  4 siblings, 0 replies; 6+ messages in thread
From: Matthias Kaehlcke @ 2007-07-15 19:06 UTC (permalink / raw)
  To: viro; +Cc: linux-kernel, akpm

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                  `-

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* PATCH [5/5] fs/block_dev.c: use list_for_each_entry() instead of list_for_each()
  2007-07-15 18:54 PATCH [0/5] file system core: use list_for_each_entry() instead of list_for_each() Matthias Kaehlcke
                   ` (3 preceding siblings ...)
  2007-07-15 19:06 ` PATCH [4/5] fs/locks.c: " Matthias Kaehlcke
@ 2007-07-15 19:08 ` Matthias Kaehlcke
  4 siblings, 0 replies; 6+ messages in thread
From: Matthias Kaehlcke @ 2007-07-15 19:08 UTC (permalink / raw)
  To: viro; +Cc: linux-kernel, akpm

fs/block_dev.c: use list_for_each_entry() instead of list_for_each()
in nr_blockdev_pages()

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>

--

diff --git a/fs/block_dev.c b/fs/block_dev.c
index b3e9bfa..da5f051 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -588,12 +588,10 @@ EXPORT_SYMBOL(bdget);
 
 long nr_blockdev_pages(void)
 {
-	struct list_head *p;
+	struct block_device *bdev;
 	long ret = 0;
 	spin_lock(&bdev_lock);
-	list_for_each(p, &all_bdevs) {
-		struct block_device *bdev;
-		bdev = list_entry(p, struct block_device, bd_list);
+	list_for_each_entry(bdev, &all_bdevs, bd_list) {
 		ret += bdev->bd_inode->i_mapping->nrpages;
 	}
 	spin_unlock(&bdev_lock);

-- 
Matthias Kaehlcke
Linux Application Developer
Barcelona

  Si deseas mantener tu libertad, debes estar preparado para defenderla
                          (Richard Stallman)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-07-15 19:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` PATCH [4/5] fs/locks.c: " Matthias Kaehlcke
2007-07-15 19:08 ` PATCH [5/5] fs/block_dev.c: " Matthias Kaehlcke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox