From: David Disseldorp <ddiss@suse.de>
To: target-devel@vger.kernel.org
Subject: Re: [PATCH] scsi: target: fix unmap_zeroes_data boolean initialisation
Date: Wed, 19 Feb 2020 10:20:20 +0000 [thread overview]
Message-ID: <20200219112020.62a6c5c2@suse.de> (raw)
In-Reply-To: <20200218180546.21313-1-ddiss@suse.de>
Thanks for the feedback, Bart...
On Tue, 18 Feb 2020 10:18:51 -0800, Bart Van Assche wrote:
> On 2/18/20 10:05 AM, David Disseldorp wrote:
> > --- a/drivers/target/target_core_device.c
> > +++ b/drivers/target/target_core_device.c
> > @@ -829,7 +829,7 @@ bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib,
> > attrib->unmap_granularity = q->limits.discard_granularity / block_size;
> > attrib->unmap_granularity_alignment = q->limits.discard_alignment /
> > block_size;
> > - attrib->unmap_zeroes_data = (q->limits.max_write_zeroes_sectors);
> > + attrib->unmap_zeroes_data = !!(q->limits.max_write_zeroes_sectors);
> > return true;
> > }
> > EXPORT_SYMBOL(target_configure_unmap_from_queue);
>
> Hi David,
>
> How about changing the datatype of unmap_zeroes_data from 'int' into
> 'bool'? I think that change would have the same effect as this patch and
> additionally would make it clear that 'true' and 'false' are the only
> allowed variables for that struct member.
Yes, that'd also be an option, although my preference would be to change
the type *and* carry the above hunk for readability.
There are plenty of other configfs attrs which are validated via
strtobool() and stored in an int. I guess it makes sense to also change
them as a follow up.
There's also still a question of how we deal with fixing configfs
parsing tools which may have obtained an incorrect (> 1)
unmap_zeroes_data value and expect to be able to write it back - should
we relax the strtobool() check in unmap_zeroes_data_store() to handle
mapping from >1 to true, or just leave it up to them to deal with? I'm
leaning towards the latter.
Cheers, David
prev parent reply other threads:[~2020-02-19 10:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-18 18:05 [PATCH] scsi: target: fix unmap_zeroes_data boolean initialisation David Disseldorp
2020-02-18 18:18 ` Bart Van Assche
2020-02-19 10:20 ` David Disseldorp [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=20200219112020.62a6c5c2@suse.de \
--to=ddiss@suse.de \
--cc=target-devel@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