From: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
To: Damien Le Moal <Damien.LeMoal@wdc.com>,
"dm-devel@redhat.com" <dm-devel@redhat.com>,
Mike Snitzer <snitzer@redhat.com>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
Jens Axboe <axboe@kernel.dk>,
"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
Christoph Hellwig <hch@lst.de>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
David Sterba <dsterba@suse.com>,
Josef Bacik <josef@toxicpanda.com>
Cc: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
Naohiro Aota <Naohiro.Aota@wdc.com>
Subject: Re: [PATCH 2/4] dm crypt: Fix zoned block device support
Date: Fri, 16 Apr 2021 09:10:12 +0000 [thread overview]
Message-ID: <PH0PR04MB7416D55514E54F67BD8D92A89B4C9@PH0PR04MB7416.namprd04.prod.outlook.com> (raw)
In-Reply-To: BL0PR04MB6514908FACBF6A34D8A085C9E74C9@BL0PR04MB6514.namprd04.prod.outlook.com
On 16/04/2021 09:30, Damien Le Moal wrote:
> On 2021/04/16 16:13, Johannes Thumshirn wrote:
>> On 16/04/2021 05:05, Damien Le Moal wrote:
>>
>> [...]
>>
>>> + CRYPT_IV_NO_SECTORS, /* IV calculation does not use sectors */
>>
>> [...]
>>
>>> - if (ivmode == NULL)
>>> + if (ivmode == NULL) {
>>> cc->iv_gen_ops = NULL;
>>> - else if (strcmp(ivmode, "plain") == 0)
>>> + set_bit(CRYPT_IV_NO_SECTORS, &cc->cipher_flags);
>>> + } else if (strcmp(ivmode, "plain") == 0)
>>
>> [...]
>>
>>> + if (!test_bit(CRYPT_IV_NO_SECTORS, &cc->cipher_flags)) {
>>> + DMWARN("Zone append is not supported with sector-based IV cyphers");
>>> + ti->zone_append_not_supported = true;
>>> + }
>>
>> I think this negation is hard to follow, at least I had a hard time
>> reviewing it.
>>
>> Wouldn't it make more sense to use CRYPT_IV_USE_SECTORS, set the bit
>> for algorithms that use sectors as IV (like plain64) and then do a
>> normal
>
> There are only 2 IV modes that do not use sectors. null and random. All others
> do. Hence the "NO_SECTORS" choice. That is the exception rather than the norm,
> the flag indicates that.
>
>>
>> if (test_bit(CRYPT_IV_USE_SECTORS, &cc->cipher_flags)) {
>> DMWARN("Zone append is not supported with sector-based IV cyphers");
>> ti->zone_append_not_supported = true;
>> }
>>
>> i.e. without the double negation?
>
> Yes. I agree, it is more readable. But adds more lines for the same result. I
> could add a small boolean helper to make the "!test_bit(CRYPT_IV_NO_SECTORS,
> &cc->cipher_flags)" easier to understand.
>
Yes I guessed this was the reason for the choice.
Maybe
set_bit(CRYPT_IV_USE_SECTORS, &cc->cipher_flags);
if (!strcmp(ivmode, "plain") || !strcmp(ivmode, "random"))
clear_bit(CRYPT_IV_USE_SECTORS, &cc->cipher_flags);
if (test_bit(CRYPT_IV_USE_SECTORS, &cc->cipher_flags)) {
DMWARN("Zone append is not supported with sector-based IV cyphers");
ti->zone_append_not_supported = true;
}
Ultimately it's your and Mikes's call, but I /think/ this makes the code easier
to understand.
WARNING: multiple messages have this Message-ID (diff)
From: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
To: Damien Le Moal <Damien.LeMoal@wdc.com>,
"dm-devel@redhat.com" <dm-devel@redhat.com>,
Mike Snitzer <snitzer@redhat.com>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
Jens Axboe <axboe@kernel.dk>,
"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
Christoph Hellwig <hch@lst.de>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
David Sterba <dsterba@suse.com>,
Josef Bacik <josef@toxicpanda.com>
Cc: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
Naohiro Aota <Naohiro.Aota@wdc.com>
Subject: Re: [PATCH 2/4] dm crypt: Fix zoned block device support
Date: Fri, 16 Apr 2021 09:10:12 +0000 [thread overview]
Message-ID: <PH0PR04MB7416D55514E54F67BD8D92A89B4C9@PH0PR04MB7416.namprd04.prod.outlook.com> (raw)
In-Reply-To: BL0PR04MB6514908FACBF6A34D8A085C9E74C9@BL0PR04MB6514.namprd04.prod.outlook.com
On 16/04/2021 09:30, Damien Le Moal wrote:
> On 2021/04/16 16:13, Johannes Thumshirn wrote:
>> On 16/04/2021 05:05, Damien Le Moal wrote:
>>
>> [...]
>>
>>> + CRYPT_IV_NO_SECTORS, /* IV calculation does not use sectors */
>>
>> [...]
>>
>>> - if (ivmode == NULL)
>>> + if (ivmode == NULL) {
>>> cc->iv_gen_ops = NULL;
>>> - else if (strcmp(ivmode, "plain") == 0)
>>> + set_bit(CRYPT_IV_NO_SECTORS, &cc->cipher_flags);
>>> + } else if (strcmp(ivmode, "plain") == 0)
>>
>> [...]
>>
>>> + if (!test_bit(CRYPT_IV_NO_SECTORS, &cc->cipher_flags)) {
>>> + DMWARN("Zone append is not supported with sector-based IV cyphers");
>>> + ti->zone_append_not_supported = true;
>>> + }
>>
>> I think this negation is hard to follow, at least I had a hard time
>> reviewing it.
>>
>> Wouldn't it make more sense to use CRYPT_IV_USE_SECTORS, set the bit
>> for algorithms that use sectors as IV (like plain64) and then do a
>> normal
>
> There are only 2 IV modes that do not use sectors. null and random. All others
> do. Hence the "NO_SECTORS" choice. That is the exception rather than the norm,
> the flag indicates that.
>
>>
>> if (test_bit(CRYPT_IV_USE_SECTORS, &cc->cipher_flags)) {
>> DMWARN("Zone append is not supported with sector-based IV cyphers");
>> ti->zone_append_not_supported = true;
>> }
>>
>> i.e. without the double negation?
>
> Yes. I agree, it is more readable. But adds more lines for the same result. I
> could add a small boolean helper to make the "!test_bit(CRYPT_IV_NO_SECTORS,
> &cc->cipher_flags)" easier to understand.
>
Yes I guessed this was the reason for the choice.
Maybe
set_bit(CRYPT_IV_USE_SECTORS, &cc->cipher_flags);
if (!strcmp(ivmode, "plain") || !strcmp(ivmode, "random"))
clear_bit(CRYPT_IV_USE_SECTORS, &cc->cipher_flags);
if (test_bit(CRYPT_IV_USE_SECTORS, &cc->cipher_flags)) {
DMWARN("Zone append is not supported with sector-based IV cyphers");
ti->zone_append_not_supported = true;
}
Ultimately it's your and Mikes's call, but I /think/ this makes the code easier
to understand.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
WARNING: multiple messages have this Message-ID (diff)
From: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
To: Damien Le Moal <Damien.LeMoal@wdc.com>,
"dm-devel@redhat.com" <dm-devel@redhat.com>,
Mike Snitzer <snitzer@redhat.com>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
Jens Axboe <axboe@kernel.dk>,
"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
Christoph Hellwig <hch@lst.de>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
David Sterba <dsterba@suse.com>,
Josef Bacik <josef@toxicpanda.com>
Cc: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
Naohiro Aota <Naohiro.Aota@wdc.com>
Subject: Re: [dm-devel] [PATCH 2/4] dm crypt: Fix zoned block device support
Date: Fri, 16 Apr 2021 09:10:12 +0000 [thread overview]
Message-ID: <PH0PR04MB7416D55514E54F67BD8D92A89B4C9@PH0PR04MB7416.namprd04.prod.outlook.com> (raw)
In-Reply-To: BL0PR04MB6514908FACBF6A34D8A085C9E74C9@BL0PR04MB6514.namprd04.prod.outlook.com
On 16/04/2021 09:30, Damien Le Moal wrote:
> On 2021/04/16 16:13, Johannes Thumshirn wrote:
>> On 16/04/2021 05:05, Damien Le Moal wrote:
>>
>> [...]
>>
>>> + CRYPT_IV_NO_SECTORS, /* IV calculation does not use sectors */
>>
>> [...]
>>
>>> - if (ivmode == NULL)
>>> + if (ivmode == NULL) {
>>> cc->iv_gen_ops = NULL;
>>> - else if (strcmp(ivmode, "plain") == 0)
>>> + set_bit(CRYPT_IV_NO_SECTORS, &cc->cipher_flags);
>>> + } else if (strcmp(ivmode, "plain") == 0)
>>
>> [...]
>>
>>> + if (!test_bit(CRYPT_IV_NO_SECTORS, &cc->cipher_flags)) {
>>> + DMWARN("Zone append is not supported with sector-based IV cyphers");
>>> + ti->zone_append_not_supported = true;
>>> + }
>>
>> I think this negation is hard to follow, at least I had a hard time
>> reviewing it.
>>
>> Wouldn't it make more sense to use CRYPT_IV_USE_SECTORS, set the bit
>> for algorithms that use sectors as IV (like plain64) and then do a
>> normal
>
> There are only 2 IV modes that do not use sectors. null and random. All others
> do. Hence the "NO_SECTORS" choice. That is the exception rather than the norm,
> the flag indicates that.
>
>>
>> if (test_bit(CRYPT_IV_USE_SECTORS, &cc->cipher_flags)) {
>> DMWARN("Zone append is not supported with sector-based IV cyphers");
>> ti->zone_append_not_supported = true;
>> }
>>
>> i.e. without the double negation?
>
> Yes. I agree, it is more readable. But adds more lines for the same result. I
> could add a small boolean helper to make the "!test_bit(CRYPT_IV_NO_SECTORS,
> &cc->cipher_flags)" easier to understand.
>
Yes I guessed this was the reason for the choice.
Maybe
set_bit(CRYPT_IV_USE_SECTORS, &cc->cipher_flags);
if (!strcmp(ivmode, "plain") || !strcmp(ivmode, "random"))
clear_bit(CRYPT_IV_USE_SECTORS, &cc->cipher_flags);
if (test_bit(CRYPT_IV_USE_SECTORS, &cc->cipher_flags)) {
DMWARN("Zone append is not supported with sector-based IV cyphers");
ti->zone_append_not_supported = true;
}
Ultimately it's your and Mikes's call, but I /think/ this makes the code easier
to understand.
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
next prev parent reply other threads:[~2021-04-16 9:10 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-16 3:05 [PATCH 0/4] Fix dm-crypt zoned block device support Damien Le Moal
2021-04-16 3:05 ` [dm-devel] " Damien Le Moal
2021-04-16 3:05 ` Damien Le Moal
2021-04-16 3:05 ` [PATCH 1/4] dm: Introduce zone append support control Damien Le Moal
2021-04-16 3:05 ` [dm-devel] " Damien Le Moal
2021-04-16 3:05 ` Damien Le Moal
2021-04-16 6:51 ` Johannes Thumshirn
2021-04-16 6:51 ` [dm-devel] " Johannes Thumshirn
2021-04-16 6:51 ` Johannes Thumshirn
2021-04-16 3:05 ` [PATCH 2/4] dm crypt: Fix zoned block device support Damien Le Moal
2021-04-16 3:05 ` [dm-devel] " Damien Le Moal
2021-04-16 3:05 ` Damien Le Moal
2021-04-16 7:13 ` Johannes Thumshirn
2021-04-16 7:13 ` [dm-devel] " Johannes Thumshirn
2021-04-16 7:13 ` Johannes Thumshirn
2021-04-16 7:30 ` Damien Le Moal
2021-04-16 7:30 ` [dm-devel] " Damien Le Moal
2021-04-16 7:30 ` Damien Le Moal
2021-04-16 9:10 ` Johannes Thumshirn [this message]
2021-04-16 9:10 ` [dm-devel] " Johannes Thumshirn
2021-04-16 9:10 ` Johannes Thumshirn
2021-04-16 3:05 ` [PATCH 3/4] btrfs: zoned: fail mount if the device does not support zone append Damien Le Moal
2021-04-16 3:05 ` [dm-devel] " Damien Le Moal
2021-04-16 3:05 ` Damien Le Moal
2021-04-16 16:17 ` David Sterba
2021-04-16 16:17 ` [dm-devel] " David Sterba
2021-04-16 16:17 ` David Sterba
2021-04-19 9:28 ` Christoph Hellwig
2021-04-19 9:28 ` [dm-devel] " Christoph Hellwig
2021-04-19 9:28 ` Christoph Hellwig
2021-04-19 9:35 ` Damien Le Moal
2021-04-19 9:35 ` [dm-devel] " Damien Le Moal
2021-04-19 9:35 ` Damien Le Moal
2021-04-19 9:39 ` hch
2021-04-19 9:39 ` [dm-devel] " hch
2021-04-19 9:39 ` hch
2021-04-19 9:46 ` Damien Le Moal
2021-04-19 9:46 ` [dm-devel] " Damien Le Moal
2021-04-19 9:46 ` Damien Le Moal
2021-04-19 16:48 ` David Sterba
2021-04-19 16:48 ` [dm-devel] " David Sterba
2021-04-19 16:48 ` David Sterba
2021-04-19 9:39 ` Johannes Thumshirn
2021-04-19 9:39 ` [dm-devel] " Johannes Thumshirn
2021-04-19 9:39 ` Johannes Thumshirn
2021-04-16 3:05 ` [PATCH 4/4] zonefs: fix synchronous write to sequential zone files Damien Le Moal
2021-04-16 3:05 ` [dm-devel] " Damien Le Moal
2021-04-16 3:05 ` Damien Le Moal
2021-04-16 6:50 ` Johannes Thumshirn
2021-04-16 6:50 ` [dm-devel] " Johannes Thumshirn
2021-04-16 6:50 ` Johannes Thumshirn
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=PH0PR04MB7416D55514E54F67BD8D92A89B4C9@PH0PR04MB7416.namprd04.prod.outlook.com \
--to=johannes.thumshirn@wdc.com \
--cc=Damien.LeMoal@wdc.com \
--cc=Naohiro.Aota@wdc.com \
--cc=axboe@kernel.dk \
--cc=dm-devel@redhat.com \
--cc=dsterba@suse.com \
--cc=hch@lst.de \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=shinichiro.kawasaki@wdc.com \
--cc=snitzer@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.