From: "Alan D. Brunelle" <Alan.Brunelle@hp.com>
To: linux-btrace@vger.kernel.org
Subject: [Patch kernel] Allow one to filter on specific trace actions
Date: Mon, 21 Jul 2008 18:38:18 +0000 [thread overview]
Message-ID: <4884D79A.5030001@hp.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 209 bytes --]
This kernel patch allows one to specify one or more trace actions to
filter on. This is different from trace categories - you can drill down
to getrq, sleeprq, ...
The associated application patch is next...
[-- Attachment #2: 0002-Allow-one-to-filter-on-specific-trace-actions.patch --]
[-- Type: text/x-diff, Size: 2622 bytes --]
From e82d1d848b1587c5a472ec5af503457d5e1353a1 Mon Sep 17 00:00:00 2001
From: Alan D. Brunelle <alan.brunelle@hp.com>
Date: Mon, 21 Jul 2008 14:22:34 -0400
Subject: [PATCH] Allow one to filter on specific trace actions
Signed-off-by: Alan D. Brunelle <alan.brunelle@hp.com>
---
block/blktrace.c | 6 ++++++
block/compat_ioctl.c | 2 ++
include/linux/blktrace_api.h | 4 ++++
3 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/block/blktrace.c b/block/blktrace.c
index 91c7f2b..05d08c9 100644
--- a/block/blktrace.c
+++ b/block/blktrace.c
@@ -98,6 +98,8 @@ static int act_log_check(struct blk_trace *bt, u32 what, sector_t sector,
{
if (((bt->cat_mask << BLK_TC_SHIFT) & what) == 0)
return 1;
+ if ((bt->trace_mask & (1 << (what & BLK_TA_MASK))) == 0)
+ return 1;
if (sector < bt->start_lba || sector > bt->end_lba)
return 1;
if (bt->pid && pid != bt->pid)
@@ -389,6 +391,10 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
if (!bt->cat_mask)
bt->cat_mask = (u16) -1;
+ bt->trace_mask = buts->trace_mask;
+ if (!bt->trace_mask)
+ bt->trace_mask = (u32) -1;
+
bt->start_lba = buts->start_lba;
bt->end_lba = buts->end_lba;
if (!bt->end_lba)
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c
index ef0cc68..3002475 100644
--- a/block/compat_ioctl.c
+++ b/block/compat_ioctl.c
@@ -532,6 +532,7 @@ out:
struct compat_blk_user_trace_setup {
char name[32];
u16 cat_mask;
+ u32 trace_mask;
u32 buf_size;
u32 buf_nr;
compat_u64 start_lba;
@@ -559,6 +560,7 @@ static int compat_blk_trace_setup(struct block_device *bdev, char __user *arg)
buts = (struct blk_user_trace_setup) {
.cat_mask = cbuts.cat_mask,
+ .trace_mask = cbuts.trace_mask,
.buf_size = cbuts.buf_size,
.buf_nr = cbuts.buf_nr,
.start_lba = cbuts.start_lba,
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 2abbcc0..e55ae37 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -49,6 +49,8 @@ enum blktrace_act {
__BLK_TA_REMAP, /* bio was remapped */
};
+#define BLK_TA_MASK ((1 << BLK_TC_SHIFT) - 1)
+
/*
* Notify events.
*/
@@ -123,6 +125,7 @@ struct blk_trace {
unsigned long *sequence;
unsigned char *msg_data;
u16 cat_mask;
+ u32 trace_mask;
u64 start_lba;
u64 end_lba;
u32 pid;
@@ -138,6 +141,7 @@ struct blk_trace {
struct blk_user_trace_setup {
char name[BDEVNAME_SIZE]; /* output */
u16 cat_mask; /* input */
+ u32 trace_mask; /* input */
u32 buf_size; /* input */
u32 buf_nr; /* input */
u64 start_lba;
--
1.5.4.3
reply other threads:[~2008-07-21 18:38 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=4884D79A.5030001@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).