From: "Theodore Ts'o" <tytso@mit.edu>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>
Subject: Re: [GIT PULL] ext4 updates for 4.15
Date: Tue, 14 Nov 2017 19:56:56 -0500 [thread overview]
Message-ID: <20171115005656.6znjpa3ktqdre6dp@thunk.org> (raw)
In-Reply-To: <CA+55aFxbTtsf-WUhH0uY2=dzrn7BjsNuqFT0POD+pViyMwQBfg@mail.gmail.com>
On Tue, Nov 14, 2017 at 12:59:17PM -0800, Linus Torvalds wrote:
> Of course,
>
> (flags & EXT4_ENCRYPT_FL)
>
> _should_ be the same as
>
> ext4_test_inode_flag(inode, EXT4_INODE_ENCRYPT);
And in the second is the preferred way to do things, actually.
> I'll do that suggested resolution, but I have to say that the ext4 bit
> testing is incredibly broken and non-obvious. Just as an example:
>
> fs/ext4/ext4.h:#define EXT4_ENCRYPT_FL 0x00000800
> /* encrypted file */
> fs/ext4/ext4.h: EXT4_INODE_ENCRYPT = 11, /* Encrypted file */
>
> yeah, it's the same bit, but it sure as hell isn't obvious. Why the
> two totally different ways to define that data?
Yes, it's non-obvious and ugly. Sorry about that.
We originally used EXT4_*_FL, and we needed to use the bit number
encoding so we could use test_bit(). We just never converted all the
way over.
We do have a way to make sure the two ways of defining a bit position
are in sync; see ext4_check_flag_values() and CHECK_FLAG_VALUE in
ext4.h. It's a bit gross, and we probably should clean this up, at
least in the kernel. The e2fsprogs user space libraries all use
EXT4_*_FL, and we can't change that without breaking applications
depending on userspace, but we can keep things consistent in the
kernel, and that probably means completely converting away from
EXT4_*_FL, if possible.
- Ted
next prev parent reply other threads:[~2017-11-15 0:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-13 3:15 Theodore Ts'o
2017-11-13 16:25 ` Theodore Ts'o
2017-11-14 20:59 ` Linus Torvalds
2017-11-15 0:56 ` Theodore Ts'o [this message]
2017-11-15 1:11 ` Linus Torvalds
2018-02-12 10:02 ` ext4 iomap SEEK broken [was: [GIT PULL] ext4 updates for 4.15] Jiri Slaby
2018-02-12 12:14 ` Jiri Slaby
2018-02-12 13:34 ` Jiri Slaby
2018-02-12 13:38 ` Jiri Slaby
2018-02-12 16:10 ` Theodore Ts'o
2018-02-12 20:23 ` Jiri Slaby
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=20171115005656.6znjpa3ktqdre6dp@thunk.org \
--to=tytso@mit.edu \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®