linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Andreas Dilger <adilger@dilger.ca>
Cc: linux-ext4@vger.kernel.org, linux-fscrypt@vger.kernel.org
Subject: Re: [PATCH] e2fsck: check for consistent encryption policies
Date: Fri, 19 Jul 2019 16:18:44 -0700	[thread overview]
Message-ID: <20190719231843.GH1422@gmail.com> (raw)
In-Reply-To: <621FA6A1-745D-43BA-A52A-4229902737BF@dilger.ca>

On Wed, Jul 17, 2019 at 08:12:25PM -0600, Andreas Dilger wrote:
> It would appear from my reading of the patch that every file that is
> encrypted will have the xattr saved until pass2? If the filesystem is very
> large (eg. billions of files), this will consume a large amount of memory.
> 
> Does it make sense to compare compression xattrs during pass1,
> and only track the set of different
> encryption context/type/master key
> sets that exist in the filesystem?  Since these will typically be common
> among large numbers of files, the memory will be largely reduced,
> maybe one or two ints per inode (either an inode+ID pair for sparse
> inodes, or just an ID for dense range of similarly-encrypted inodes with a
> start+count for the whole range. 
> 
> Cheers, Andreas
> 

That's correct.  I wanted to propose something simpler first to see what people
thought, but yes if this is really a concern, what we should do is assign a u32
id to each new encryption policy that is seen, and store just that id per inode.

To do that we need a proper map data structure for the policy => ID mapping,
which as usual is nontrivial to do in C.  lib/ext2fs/rbtree.h could do, though.
There's also lib/ext2fs/hashmap.c, but it doesn't implement resizing.

- Eric

  reply	other threads:[~2019-07-19 23:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-18  1:13 [PATCH] e2fsck: check for consistent encryption policies Eric Biggers
2019-07-18  2:12 ` Andreas Dilger
2019-07-19 23:18   ` Eric Biggers [this message]
2019-07-19 23:47     ` Theodore Y. Ts'o
2019-07-18  6:25 ` Andreas Dilger
2019-07-19 23:58   ` Eric Biggers

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=20190719231843.GH1422@gmail.com \
    --to=ebiggers@kernel.org \
    --cc=adilger@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fscrypt@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;
as well as URLs for NNTP newsgroup(s).