linux-btrace.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alan D. Brunelle" <Alan.Brunelle@hp.com>
To: linux-btrace@vger.kernel.org
Subject: [BTT PATCH] Fix unplug histogram assignments
Date: Wed, 18 Apr 2007 12:23:37 +0000	[thread overview]
Message-ID: <46260DC9.6010802@hp.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: fix-up-hist --]
[-- Type: text/plain, Size: 1111 bytes --]

From: Alan D. Brunelle <Alan.Brunelle@hp.com>

Fix unplug histogram placement.

Signed-off-by: Alan D. Brunelle <Alan.Brunelle@hp.com>
---

 btt/unplug_hist.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/btt/unplug_hist.c b/btt/unplug_hist.c
index 03b009b..4971f31 100644
--- a/btt/unplug_hist.c
+++ b/btt/unplug_hist.c
@@ -30,8 +30,6 @@ struct hist_bkt {
 	int hist[NBKTS * sizeof(int)];
 };
 
-static struct file_info *unplug_hist_files = NULL;
-
 void *unplug_hist_init(__u32 device)
 {
 	struct hist_bkt *hbp;
@@ -54,9 +52,12 @@ void unplug_hist_add(struct io *u_iop)
 	dip = __dip_find(u_iop->t.device);
 	if (dip && dip->unplug_hist_handle) {
 		__u64 *val = u_iop->pdu;
-		int n_unplugs = be64_to_cpu(*val);
-		struct hist_bkt * hbp = dip->unplug_hist_handle;
-		int idx = (n_unplugs / BKT_WIDTH) <= MAX_BKT ?: EXCESS_BKT;
+		int idx, n_unplugs = be64_to_cpu(*val);
+		struct hist_bkt *hbp = dip->unplug_hist_handle;
+
+		idx = (n_unplugs / BKT_WIDTH);
+		if (idx > MAX_BKT)
+			idx = EXCESS_BKT;
 
 		assert((0 <= idx) && (idx <= EXCESS_BKT));
 		hbp->hist[idx]++;

             reply	other threads:[~2007-04-18 12:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-18 12:23 Alan D. Brunelle [this message]
2007-04-18 12:54 ` [BTT PATCH] Fix unplug histogram assignments Jens Axboe

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=46260DC9.6010802@hp.com \
    --to=alan.brunelle@hp.com \
    --cc=linux-btrace@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).