From: maximilian attems Subject: [Kernel-janitors] [patch] use list_for_each() in fs/dcache.c Date: Wed, 10 Sep 2003 16:35:27 +0200 Sender: kernel-janitors-bounces@lists.osdl.org Message-ID: <20030910143527.GE24711@mail.sternwelten.at> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============066187140881311723==" Cc: linux-fsdevel@vger.kernel.org, matthew@wil.cx Return-path: To: kj List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-janitors-bounces@lists.osdl.org List-Id: linux-fsdevel.vger.kernel.org --===============066187140881311723== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5oH/S/bF6lOfqCQb" Content-Disposition: inline --5oH/S/bF6lOfqCQb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Use list_for_each() where applicable From: Domen Puncer - for (list =3D ymf_devs.next; list !=3D &ymf_devs; list =3D list->next) { + list_for_each(list, &ymf_devs) { pure cosmetic change, defined as a preprocessor macro in: include/linux/list.h domen stated in his mail from 12. July not to be shure about this one, yes it compiles but not done further testings. please apply maks --- linux-2.6.0-test5/fs/dcache.c Mon Sep 8 21:49:53 2003 +++ linux/fs/dcache.c Wed Sep 10 12:13:24 2003 @@ -279,15 +279,11 @@ =20 struct dentry * d_find_alias(struct inode *inode) { - struct list_head *head, *next, *tmp; + struct list_head *tmp, *next; struct dentry *alias, *discon_alias=3DNULL; =20 spin_lock(&dcache_lock); - head =3D &inode->i_dentry; - next =3D inode->i_dentry.next; - while (next !=3D head) { - tmp =3D next; - next =3D tmp->next; + list_for_each_safe(tmp, next, &inode->i_dentry) { prefetch(next); alias =3D list_entry(tmp, struct dentry, d_alias); if (!d_unhashed(alias)) { @@ -315,8 +311,7 @@ struct list_head *tmp, *head =3D &inode->i_dentry; restart: spin_lock(&dcache_lock); - tmp =3D head; - while ((tmp =3D tmp->next) !=3D head) { + list_for_each(tmp, head) { struct dentry *dentry =3D list_entry(tmp, struct dentry, d_alias); if (!atomic_read(&dentry->d_count)) { __dget_locked(dentry); @@ -430,10 +425,7 @@ * superblock to the most recent end of the unused list. */ spin_lock(&dcache_lock); - next =3D dentry_unused.next; - while (next !=3D &dentry_unused) { - tmp =3D next; - next =3D tmp->next; + list_for_each_safe(tmp, next, &dentry_unused) { dentry =3D list_entry(tmp, struct dentry, d_lru); if (dentry->d_sb !=3D sb) continue; @@ -445,10 +437,7 @@ * Pass two ... free the dentries for this superblock. */ repeat: - next =3D dentry_unused.next; - while (next !=3D &dentry_unused) { - tmp =3D next; - next =3D tmp->next; + list_for_each_safe(tmp, next, &dentry_unused) { dentry =3D list_entry(tmp, struct dentry, d_lru); if (dentry->d_sb !=3D sb) continue; --5oH/S/bF6lOfqCQb Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE/Xzav6//kSTNjoX0RAtaGAJ0XRIN2J6bBB3CCg4SfPTyhaGxjdQCfSpaQ +xgkqxTn/cYvFkyZP774ahs= =l9A+ -----END PGP SIGNATURE----- --5oH/S/bF6lOfqCQb-- --===============066187140881311723== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Kernel-janitors mailing list Kernel-janitors@lists.osdl.org http://lists.osdl.org/mailman/listinfo/kernel-janitors --===============066187140881311723==--