From: Domen Puncer <domen@coderock.org>
To: kernel-janitors@vger.kernel.org
Subject: [Kernel-janitors] [patch 2.6.8] list_for_each_entry in fs/dcache.c
Date: Sat, 14 Aug 2004 17:09:08 +0000 [thread overview]
Message-ID: <20040814170908.GA2575@masina.coderock.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 1917 bytes --]
Hi.
First 2 are list_for_each_entry (thanks maks), second 2 list_for_each_safe.
Boot tested.
Signed-off-by: Domen Puncer <domen@coderock.org>
--- c/fs/dcache.c Sat Aug 14 10:57:28 2004
+++ a/fs/dcache.c Sat Aug 14 18:53:51 2004
@@ -288,17 +288,10 @@
struct dentry * d_find_alias(struct inode *inode)
{
- struct list_head *head, *next, *tmp;
struct dentry *alias, *discon_alias=NULL;
spin_lock(&dcache_lock);
- head = &inode->i_dentry;
- next = inode->i_dentry.next;
- while (next != head) {
- tmp = next;
- next = tmp->next;
- prefetch(next);
- alias = list_entry(tmp, struct dentry, d_alias);
+ list_for_each_entry(alias, &inode->i_dentry, d_alias) {
if (!d_unhashed(alias)) {
if (alias->d_flags & DCACHE_DISCONNECTED)
discon_alias = alias;
@@ -321,12 +314,10 @@
*/
void d_prune_aliases(struct inode *inode)
{
- struct list_head *tmp, *head = &inode->i_dentry;
+ struct dentry *dentry;
restart:
spin_lock(&dcache_lock);
- tmp = head;
- while ((tmp = tmp->next) != head) {
- struct dentry *dentry = list_entry(tmp, struct dentry, d_alias);
+ list_for_each_entry(dentry, &inode->i_dentry, d_alias) {
if (!atomic_read(&dentry->d_count)) {
__dget_locked(dentry);
__d_drop(dentry);
@@ -442,10 +433,7 @@
* superblock to the most recent end of the unused list.
*/
spin_lock(&dcache_lock);
- next = dentry_unused.next;
- while (next != &dentry_unused) {
- tmp = next;
- next = tmp->next;
+ list_for_each_safe(tmp, next, &dentry_unused) {
dentry = list_entry(tmp, struct dentry, d_lru);
if (dentry->d_sb != sb)
continue;
@@ -457,10 +445,7 @@
* Pass two ... free the dentries for this superblock.
*/
repeat:
- next = dentry_unused.next;
- while (next != &dentry_unused) {
- tmp = next;
- next = tmp->next;
+ list_for_each_safe(tmp, next, &dentry_unused) {
dentry = list_entry(tmp, struct dentry, d_lru);
if (dentry->d_sb != sb)
continue;
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
reply other threads:[~2004-08-14 17:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20040814170908.GA2575@masina.coderock.org \
--to=domen@coderock.org \
--cc=kernel-janitors@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.