From: "majianpeng" <majianpeng@gmail.com>
To: linux-raid <linux-raid@vger.kernel.org>
Subject: About monitor raid event using poll/select
Date: Thu, 2 Jun 2011 10:34:52 +0800 [thread overview]
Message-ID: <201106021034490930721@gmail.com> (raw)
I recently did a project which monitor raids event in system.
I used this way:
while(1){
open(/proc/mdstat);
poll();
do-something
close
}
I wanted to monitor all events in times.Supposing events A--10s-->B---1hour---->C,do-somethings taks 30s.
First I must fetch the event A.But I do do-somthing using 30s,so I did not monitor event B.
But the interval of B and C is 1 hour,so I only after 1 hours can detected the events B.
I can modified the do-something in order to reduce times.But in theory,I can omit event.
so I think modified kernel function mdstat_poll:
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 39b27c4..aaecc03 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -6539,8 +6539,10 @@ static unsigned int mdstat_poll(struct file *filp, poll_table *wait)
/* always allow read */
mask = POLLIN | POLLRDNORM;
- if (mi->event != atomic_read(&md_event_count))
+ if (mi->event != atomic_read(&md_event_count)){
+ mi->event = atomic_read(&md_event_count);
mask |= POLLERR | POLLPRI;
+ }
return mask;
}
user space function like this:
opne(/proc/mdstat)
while(1){
poll
do-something
}
close
2011-06-02
majianpeng
next reply other threads:[~2011-06-02 2:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-02 2:34 majianpeng [this message]
2011-06-02 2:50 ` About monitor raid event using poll/select NeilBrown
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=201106021034490930721@gmail.com \
--to=majianpeng@gmail.com \
--cc=linux-raid@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).