PATCH [0/5] file system core: use list_for_each_entry() instead of list_for_each()
Subsystems (2)
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()
Signature · 12 lines
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 `-PATCH [1/5] fs/file_table.c: use list_for_each_entry() instead of list_for_each()
fs/file_table.c: use list_for_each_entry() instead of list_for_each() in fs_may_remount_ro()
--
fs/file_table.c +2 -3
@@ -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? */
Signature · 10 lines
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 `-PATCH [2/5] fs/eventpoll.c: use list_for_each_entry() instead of list_for_each()
In reply to Matthias Kaehlckefs/eventpoll.c: use list_for_each_entry() instead of list_for_each() in ep_poll_safewake()
--
fs/eventpoll.c +2 -3
@@ -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 )) {
Signature · 12 lines
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 `-PATCH [3/5] fs/super.c: use list_for_each_entry() instead of list_for_each()
In reply to Matthias Kaehlckefs/super.c: use list_for_each_entry() instead of list_for_each() in sget()
--
fs/super.c +2 -4
@@ -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))
Signature · 10 lines
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 `-PATCH [4/5] fs/locks.c: use list_for_each_entry() instead of list_for_each()
In reply to Matthias Kaehlckefs/locks.c: use list_for_each_entry() instead of list_for_each() in posix_locks_deadlock() and get_locks_status()
--
fs/locks.c +7 -10
@@ -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);
Signature · 10 lines
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 `-PATCH [5/5] fs/block_dev.c: use list_for_each_entry() instead of list_for_each()
In reply to Matthias Kaehlckefs/block_dev.c: use list_for_each_entry() instead of list_for_each() in nr_blockdev_pages()
--
fs/block_dev.c +2 -4
@@ -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);
Signature · 10 lines
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 `-