All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Thornber <thornber@redhat.com>
To: Joe Thornber <thornber@redhat.com>
Cc: Andrew Morton <akpm@osdl.org>,
	Linux Mailing List <linux-kernel@vger.kernel.org>
Subject: [Patch 4/6] dm: default queue limits
Date: Fri, 20 Feb 2004 15:36:15 +0000	[thread overview]
Message-ID: <20040220153615.GR27549@reti> (raw)
In-Reply-To: <20040220153145.GN27549@reti>

Audit for list_for_each_*entry*
--- diff/drivers/md/dm-ioctl.c	2004-02-18 15:23:23.000000000 +0000
+++ source/drivers/md/dm-ioctl.c	2004-02-18 15:34:04.000000000 +0000
@@ -88,30 +88,24 @@ static unsigned int hash_str(const char 
  *---------------------------------------------------------------*/
 static struct hash_cell *__get_name_cell(const char *str)
 {
-	struct list_head *tmp;
 	struct hash_cell *hc;
 	unsigned int h = hash_str(str);
 
-	list_for_each (tmp, _name_buckets + h) {
-		hc = list_entry(tmp, struct hash_cell, name_list);
+	list_for_each_entry (hc, _name_buckets + h, name_list)
 		if (!strcmp(hc->name, str))
 			return hc;
-	}
 
 	return NULL;
 }
 
 static struct hash_cell *__get_uuid_cell(const char *str)
 {
-	struct list_head *tmp;
 	struct hash_cell *hc;
 	unsigned int h = hash_str(str);
 
-	list_for_each (tmp, _uuid_buckets + h) {
-		hc = list_entry(tmp, struct hash_cell, uuid_list);
+	list_for_each_entry (hc, _uuid_buckets + h, uuid_list)
 		if (!strcmp(hc->uuid, str))
 			return hc;
-	}
 
 	return NULL;
 }
@@ -935,6 +929,7 @@ static void retrieve_deps(struct dm_tabl
 	unsigned int count = 0;
 	struct list_head *tmp;
 	size_t len, needed;
+	struct dm_dev *dd;
 	struct dm_target_deps *deps;
 
 	deps = get_result_buffer(param, param_size, &len);
@@ -942,7 +937,7 @@ static void retrieve_deps(struct dm_tabl
 	/*
 	 * Count the devices.
 	 */
-	list_for_each(tmp, dm_table_get_devices(table))
+	list_for_each (tmp, dm_table_get_devices(table))
 		count++;
 
 	/*
@@ -959,10 +954,8 @@ static void retrieve_deps(struct dm_tabl
 	 */
 	deps->count = count;
 	count = 0;
-	list_for_each(tmp, dm_table_get_devices(table)) {
-		struct dm_dev *dd = list_entry(tmp, struct dm_dev, list);
+	list_for_each_entry (dd, dm_table_get_devices(table), list)
 		deps->dev[count++] = huge_encode_dev(dd->bdev->bd_dev);
-	}
 
 	param->data_size = param->data_start + needed;
 }
--- diff/drivers/md/dm-table.c	2004-02-18 15:15:13.000000000 +0000
+++ source/drivers/md/dm-table.c	2004-02-18 15:38:06.000000000 +0000
@@ -329,13 +329,11 @@ static int lookup_device(const char *pat
  */
 static struct dm_dev *find_device(struct list_head *l, dev_t dev)
 {
-	struct list_head *tmp;
+	struct dm_dev *dd;
 
-	list_for_each(tmp, l) {
-		struct dm_dev *dd = list_entry(tmp, struct dm_dev, list);
+	list_for_each_entry (dd, l, list)
 		if (dd->bdev->bd_dev == dev)
 			return dd;
-	}
 
 	return NULL;
 }
--- diff/drivers/md/dm-target.c	2004-02-18 15:16:23.000000000 +0000
+++ source/drivers/md/dm-target.c	2004-02-18 15:38:06.000000000 +0000
@@ -25,15 +25,11 @@ static DECLARE_RWSEM(_lock);
 
 static inline struct tt_internal *__find_target_type(const char *name)
 {
-	struct list_head *tih;
 	struct tt_internal *ti;
 
-	list_for_each(tih, &_targets) {
-		ti = list_entry(tih, struct tt_internal, list);
-
+	list_for_each_entry (ti, &_targets, list)
 		if (!strcmp(name, ti->tt.name))
 			return ti;
-	}
 
 	return NULL;
 }

  parent reply	other threads:[~2004-02-20 15:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-20 15:31 device-mapper patchset Joe Thornber
2004-02-20 15:34 ` [Patch 1/6] dm: endio method Joe Thornber
2004-02-21  9:58   ` Mike Christie
2004-02-21 10:44     ` Christophe Saout
2004-02-23 10:05     ` Joe Thornber
2004-02-23 22:08       ` Mike Christie
2004-02-23 22:29         ` Joe Thornber
2004-02-24  2:18           ` Mike Christie
2004-02-20 15:34 ` [Patch 2/6] dm: remove v1 ioctl interface Joe Thornber
2004-02-20 20:18   ` Andreas Jellinghaus
2004-02-21  6:15   ` Andrew Morton
2004-02-20 15:35 ` [Patch 3/6] dm: list_for_each_entry audit Joe Thornber
2004-02-20 15:36 ` Joe Thornber [this message]
2004-02-20 15:39   ` [Patch 4/6] dm: default queue limits Joe Thornber
2004-02-20 15:37 ` [Patch 5/6] dm: list targets cmd Joe Thornber
2004-02-21  6:17   ` Andrew Morton
2004-02-20 15:37 ` [Patch 6/6] dm: multipath target Joe Thornber

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=20040220153615.GR27549@reti \
    --to=thornber@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@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.