linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Ralph Mueck <linux-kernel@rmueck.de>
Cc: i4passt@lists.cs.fau.de, linux-raid@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Matthias Oefelein <ma.oefelein@arcor.de>
Subject: Re: [PATCH 1/2] md: Add configurability for consistency check feature
Date: Tue, 18 Mar 2014 09:54:56 +1100	[thread overview]
Message-ID: <20140318095456.53e2b5cf@notabene.brown> (raw)
In-Reply-To: <1395068405-13860-2-git-send-email-linux-kernel@rmueck.de>

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

On Mon, 17 Mar 2014 16:00:04 +0100 Ralph Mueck <linux-kernel@rmueck.de> wrote:

> This patch adds sysfs configurability for the md level-1 RAID
> consistency check.
> The feature introduces a new attribute in sysfs named "safe_read".
> To toggle consistency checks on/off, simply echo safe_read in
> /sys/block/md*/md/safe_read.
> 
> Signed-off-by: Ralph Mueck <linux-kernel@rmueck.de>
> Signed-off-by: Matthias Oefelein <ma.oefelein@arcor.de>
> 
> ---
>  drivers/md/md.c | 27 +++++++++++++++++++++++++++
>  drivers/md/md.h |  3 +++
>  2 files changed, 30 insertions(+)
> 
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 4ad5cc4..5cc9a00 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -4652,6 +4652,32 @@ static struct md_sysfs_entry md_array_size =
>  __ATTR(array_size, S_IRUGO|S_IWUSR, array_size_show,
>         array_size_store);
>  
> +static ssize_t
> +safe_read_show(struct mddev *mddev, char *page)
> +{
> +	if(mddev->safe_read)
> +		return sprintf(page, "enabled\n");
> +	else
> +		return sprintf(page, "disabled\n");
> +}
> +
> +static ssize_t
> +safe_read_store(struct mddev *mddev, const char *buf, size_t len)
> +{
> +	if(mddev->pers->level != 1) {
> +		printk(KERN_NOTICE "RAID level not supported!\n");
> +		return len;
> +	}
> +	if (strncmp(buf, "safe_read", 9) == 0) {
> +		mddev->safe_read = !mddev->safe_read;
> +	}
> +	return len;
> +}
> +

So let me get this straight....

There is a sysfs file called "safe_read".
When you read from that file it reports either "enabled" or "disabled".

However you cannot write "enabled" or "disabled" to the file.  Rather you
write "safe_read".  And when you do, it toggles the status.

Seriously?

Any chance you could use device_show_bool / device_store_bool ??

NeilBrown



[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2014-03-17 22:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-17 15:00 [PATCH 0/2] md: Add consistency check feature for level-1 RAID Ralph Mueck
2014-03-17 15:00 ` [PATCH 1/2] md: Add configurability for consistency check feature Ralph Mueck
2014-03-17 22:54   ` NeilBrown [this message]
2014-03-17 15:00 ` [PATCH 2/2] md: Add support for RAID-1 " Ralph Mueck
2014-03-17 23:09   ` 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=20140318095456.53e2b5cf@notabene.brown \
    --to=neilb@suse.de \
    --cc=i4passt@lists.cs.fau.de \
    --cc=linux-kernel@rmueck.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=ma.oefelein@arcor.de \
    /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).