public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Naohiro Aota <Naohiro.Aota@wdc.com>
Cc: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
	"wangyugui@e16-tech.com" <wangyugui@e16-tech.com>,
	"clm@meta.com" <clm@meta.com>, "hch@lst.de" <hch@lst.de>
Subject: Re: Re: [PATCH v2] btrfs: introduce sync_csum_mode to tweak sync checksum behavior
Date: Thu, 1 Feb 2024 03:14:27 +0100	[thread overview]
Message-ID: <20240201021427.GV31555@suse.cz> (raw)
In-Reply-To: <lti7awd56rvcvlmviq327ueqjleeo5cvmx3w74bulka5btvfoj@u6zmx3xrbybg>

On Thu, Feb 01, 2024 at 01:28:49AM +0000, Naohiro Aota wrote:
> On Wed, Jan 31, 2024 at 08:04:59PM +0100, David Sterba wrote:
> > On Wed, Jan 31, 2024 at 04:13:45PM +0900, Naohiro Aota wrote:
> > > +#ifdef CONFIG_BTRFS_DEBUG
> > > +static ssize_t btrfs_sync_csum_show(struct kobject *kobj,
> > > +				    struct kobj_attribute *a, char *buf)
> > > +{
> > > +	struct btrfs_fs_devices *fs_devices = to_fs_devs(kobj);
> > > +
> > > +	switch (fs_devices->sync_csum_mode) {
> > > +	case BTRFS_SYNC_CSUM_AUTO:
> > > +		return sysfs_emit(buf, "auto\n");
> > > +	case BTRFS_SYNC_CSUM_FORCE_ON:
> > > +		return sysfs_emit(buf, "on\n");
> > > +	case BTRFS_SYNC_CSUM_FORCE_OFF:
> > > +		return sysfs_emit(buf, "off\n");
> > 
> > We're using numeric indicators for on/off in other sysfs files, though
> > here it's a bit more readable.
> 
> But, numeric indicators (0/1) cannot indicate tripe values well. Should I
> represent it as e.g, "auto" => 0, "on" => 1, "off" => -1?

We can do 0, 1, auto, the same values should work as the input. The
parsing will do a special case for auto.

      reply	other threads:[~2024-02-01  2:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-31  7:13 [PATCH v2] btrfs: introduce sync_csum_mode to tweak sync checksum behavior Naohiro Aota
2024-01-31 14:15 ` Johannes Thumshirn
2024-01-31 18:58   ` David Sterba
2024-02-01  1:16     ` Naohiro Aota
2024-02-01  2:11       ` David Sterba
2024-01-31 19:04 ` David Sterba
2024-02-01  1:28   ` Naohiro Aota
2024-02-01  2:14     ` David Sterba [this message]

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=20240201021427.GV31555@suse.cz \
    --to=dsterba@suse.cz \
    --cc=Naohiro.Aota@wdc.com \
    --cc=clm@meta.com \
    --cc=hch@lst.de \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wangyugui@e16-tech.com \
    /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