From: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
To: Shaohua Li <shli@kernel.org>
Cc: linux-raid@vger.kernel.org, jes.sorensen@gmail.com
Subject: Re: [PATCH 1/2] md: add bad block flag to disk state
Date: Wed, 1 Feb 2017 10:53:52 +0100 [thread overview]
Message-ID: <20170201095352.GA24920@proton.igk.intel.com> (raw)
In-Reply-To: <20170130233341.l5eiars5lbgowrht@kernel.org>
On Mon, Jan 30, 2017 at 03:33:41PM -0800, Shaohua Li wrote:
> On Tue, Jan 24, 2017 at 01:03:38PM +0100, Tomasz Majchrzak wrote:
> > Add a new flag to report that bad blocks are present on a disk. It will
> > allow userspace to notify the user of the problem.
> >
> > Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
> > ---
> > drivers/md/md.c | 2 ++
> > include/uapi/linux/raid/md_p.h | 1 +
> > 2 files changed, 3 insertions(+)
> >
> > diff --git a/drivers/md/md.c b/drivers/md/md.c
> > index 0abb147..1a807ec 100644
> > --- a/drivers/md/md.c
> > +++ b/drivers/md/md.c
> > @@ -6034,6 +6034,8 @@ static int get_disk_info(struct mddev *mddev, void __user * arg)
> > info.state |= (1<<MD_DISK_WRITEMOSTLY);
> > if (test_bit(FailFast, &rdev->flags))
> > info.state |= (1<<MD_DISK_FAILFAST);
> > + if (rdev->badblocks.count)
> > + info.state |= (1<<MD_DISK_BB_PRESENT);
>
> Userspace can find if a disk has badblocks by reading the bad_blocks sysfs
> file. Why adds another interface?
>
> Thanks,
> Shaohua
Yes, indeed, it can. I have chosen to do it this way to keep it consistent
with mdadm which uses GET_DISK_INFO ioctl to get disk information. All data
provided in this ioctl is also available in sysfs file (rdev state), however
ioctl is still used (legacy). The same applies for details subcommand of
mdadm. To answer your question - yes, I could avoid new flag but it would
make mdadm side of my improvement much more complicated.
Tomek
> > } else {
> > info.major = info.minor = 0;
> > info.raid_disk = -1;
> > diff --git a/include/uapi/linux/raid/md_p.h b/include/uapi/linux/raid/md_p.h
> > index 9930f3e..b151e93 100644
> > --- a/include/uapi/linux/raid/md_p.h
> > +++ b/include/uapi/linux/raid/md_p.h
> > @@ -93,6 +93,7 @@
> > * read requests will only be sent here in
> > * dire need
> > */
> > +#define MD_DISK_BB_PRESENT 11 /* disk has bad blocks */
> > #define MD_DISK_JOURNAL 18 /* disk is used as the write journal in RAID-5/6 */
> >
> > #define MD_DISK_ROLE_SPARE 0xffff
> > --
> > 1.8.3.1
> >
next prev parent reply other threads:[~2017-02-01 9:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-24 12:03 [PATCH 0/2] Bad block notification Tomasz Majchrzak
2017-01-24 12:03 ` [PATCH 1/2] md: add bad block flag to disk state Tomasz Majchrzak
2017-01-30 23:33 ` Shaohua Li
2017-02-01 9:53 ` Tomasz Majchrzak [this message]
2017-02-01 18:12 ` Shaohua Li
2017-03-06 20:23 ` jes.sorensen
2017-03-07 6:54 ` Hannes Reinecke
2017-01-24 12:03 ` [PATCH 2/2] Monitor: add new event BadBlocks Tomasz Majchrzak
2017-01-29 17:44 ` [PATCH 0/2] Bad block notification jes.sorensen
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=20170201095352.GA24920@proton.igk.intel.com \
--to=tomasz.majchrzak@intel.com \
--cc=jes.sorensen@gmail.com \
--cc=linux-raid@vger.kernel.org \
--cc=shli@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).