mbox series

[RFC,0/6] ext4: Move out crypto ops to ext4_crypto.c

Message ID cover.1650517532.git.ritesh.list@gmail.com (mailing list archive)
Headers show
Series ext4: Move out crypto ops to ext4_crypto.c | expand

Message

Ritesh Harjani (IBM) April 21, 2022, 5:23 a.m. UTC
Hello,

This is 1st in the series to cleanup ext4/super.c, since it has grown quite large.
This moves out crypto related ops and few definitions to fs/ext4/ext4_crypto.c

Testing
=========
1. Tested "-g encrypt" with default configs.
2. Compiled tested on x86 & Power.


Ritesh Harjani (6):
  fscrypt: Provide definition of fscrypt_set_test_dummy_encryption
  ext4: Move ext4 crypto code to its own file ext4_crypto.c
  ext4: Directly opencode ext4_set_test_dummy_encryption
  ext4: Cleanup function defs from ext4.h into ext4_crypto.c
  ext4: Move all encryption related into a common #ifdef
  ext4: Use provided macro for checking dummy_enc_policy

 fs/ext4/Makefile        |   1 +
 fs/ext4/ext4.h          |  81 +++--------------
 fs/ext4/ext4_crypto.c   | 192 ++++++++++++++++++++++++++++++++++++++++
 fs/ext4/super.c         | 158 ++++-----------------------------
 include/linux/fscrypt.h |   7 ++
 5 files changed, 227 insertions(+), 212 deletions(-)
 create mode 100644 fs/ext4/ext4_crypto.c

--
2.31.1

Comments

Eric Biggers April 21, 2022, 7:24 a.m. UTC | #1
On Thu, Apr 21, 2022 at 10:53:16AM +0530, Ritesh Harjani wrote:
> Hello,
> 
> This is 1st in the series to cleanup ext4/super.c, since it has grown quite large.
> This moves out crypto related ops and few definitions to fs/ext4/ext4_crypto.c
> 
> Testing
> =========
> 1. Tested "-g encrypt" with default configs.
> 2. Compiled tested on x86 & Power.
> 
> 
> Ritesh Harjani (6):
>   fscrypt: Provide definition of fscrypt_set_test_dummy_encryption
>   ext4: Move ext4 crypto code to its own file ext4_crypto.c
>   ext4: Directly opencode ext4_set_test_dummy_encryption
>   ext4: Cleanup function defs from ext4.h into ext4_crypto.c
>   ext4: Move all encryption related into a common #ifdef
>   ext4: Use provided macro for checking dummy_enc_policy
> 
>  fs/ext4/Makefile        |   1 +
>  fs/ext4/ext4.h          |  81 +++--------------
>  fs/ext4/ext4_crypto.c   | 192 ++++++++++++++++++++++++++++++++++++++++
>  fs/ext4/super.c         | 158 ++++-----------------------------
>  include/linux/fscrypt.h |   7 ++
>  5 files changed, 227 insertions(+), 212 deletions(-)
>  create mode 100644 fs/ext4/ext4_crypto.c

How about calling it crypto.c instead of ext4_crypto.c?  It is already in the
ext4 directory, so ext4 is implied.

Otherwise this patchset looks good to me.

Did you consider moving any of the other CONFIG_FS_ENCRYPTION code blocks into
the new file as well?  The implementation of FS_IOC_GET_ENCRYPTION_PWSALT might
be a good candidate too.

- Eric
Ritesh Harjani (IBM) April 21, 2022, 3:07 p.m. UTC | #2
On 22/04/21 12:24AM, Eric Biggers wrote:
> On Thu, Apr 21, 2022 at 10:53:16AM +0530, Ritesh Harjani wrote:
> > Hello,
> >
> > This is 1st in the series to cleanup ext4/super.c, since it has grown quite large.
> > This moves out crypto related ops and few definitions to fs/ext4/ext4_crypto.c
> >
> > Testing
> > =========
> > 1. Tested "-g encrypt" with default configs.
> > 2. Compiled tested on x86 & Power.
> >
> >
> > Ritesh Harjani (6):
> >   fscrypt: Provide definition of fscrypt_set_test_dummy_encryption
> >   ext4: Move ext4 crypto code to its own file ext4_crypto.c
> >   ext4: Directly opencode ext4_set_test_dummy_encryption
> >   ext4: Cleanup function defs from ext4.h into ext4_crypto.c
> >   ext4: Move all encryption related into a common #ifdef
> >   ext4: Use provided macro for checking dummy_enc_policy
> >
> >  fs/ext4/Makefile        |   1 +
> >  fs/ext4/ext4.h          |  81 +++--------------
> >  fs/ext4/ext4_crypto.c   | 192 ++++++++++++++++++++++++++++++++++++++++
> >  fs/ext4/super.c         | 158 ++++-----------------------------
> >  include/linux/fscrypt.h |   7 ++
> >  5 files changed, 227 insertions(+), 212 deletions(-)
> >  create mode 100644 fs/ext4/ext4_crypto.c
>
> How about calling it crypto.c instead of ext4_crypto.c?  It is already in the
> ext4 directory, so ext4 is implied.

Sure will do so in next revision which can also cover any other comments from
others.

>
> Otherwise this patchset looks good to me.

Sure thanks. May I add your Reviewed-by in next version if I don't see any major
changes?

>
> Did you consider moving any of the other CONFIG_FS_ENCRYPTION code blocks into
> the new file as well?  The implementation of FS_IOC_GET_ENCRYPTION_PWSALT might
> be a good candidate too.

Sure, thanks for pointing out. I will take a look at it for next patch series or
so.

-ritesh
Eric Biggers May 1, 2022, 7:18 a.m. UTC | #3
On Thu, Apr 21, 2022 at 10:53:16AM +0530, Ritesh Harjani wrote:
> Hello,
> 
> This is 1st in the series to cleanup ext4/super.c, since it has grown quite large.
> This moves out crypto related ops and few definitions to fs/ext4/ext4_crypto.c
> 
> Testing
> =========
> 1. Tested "-g encrypt" with default configs.
> 2. Compiled tested on x86 & Power.
> 
> 
> Ritesh Harjani (6):
>   fscrypt: Provide definition of fscrypt_set_test_dummy_encryption
>   ext4: Move ext4 crypto code to its own file ext4_crypto.c
>   ext4: Directly opencode ext4_set_test_dummy_encryption
>   ext4: Cleanup function defs from ext4.h into ext4_crypto.c
>   ext4: Move all encryption related into a common #ifdef
>   ext4: Use provided macro for checking dummy_enc_policy

FYI, the patchset
https://lore.kernel.org/linux-ext4/20220501050857.538984-1-ebiggers@kernel.org
I just sent out cleans up how the test_dummy_encryption mount option is handled.
It would supersede patches 1, 3, 5, and 6 of this series (since those all only
deal with test_dummy_encryption-related code).

To avoid conflicting changes, maybe you should just focus on your patches 2 and
4 for now, along with possibly FS_IOC_GET_ENCRYPTION_PWSALT as I mentioned?
There shouldn't be any overlap that way.

- Eric
Ritesh Harjani (IBM) May 2, 2022, 2:26 p.m. UTC | #4
On 22/05/01 12:18AM, Eric Biggers wrote:
> On Thu, Apr 21, 2022 at 10:53:16AM +0530, Ritesh Harjani wrote:
> > Hello,
> >
> > This is 1st in the series to cleanup ext4/super.c, since it has grown quite large.
> > This moves out crypto related ops and few definitions to fs/ext4/ext4_crypto.c
> >
> > Testing
> > =========
> > 1. Tested "-g encrypt" with default configs.
> > 2. Compiled tested on x86 & Power.
> >
> >
> > Ritesh Harjani (6):
> >   fscrypt: Provide definition of fscrypt_set_test_dummy_encryption
> >   ext4: Move ext4 crypto code to its own file ext4_crypto.c
> >   ext4: Directly opencode ext4_set_test_dummy_encryption
> >   ext4: Cleanup function defs from ext4.h into ext4_crypto.c
> >   ext4: Move all encryption related into a common #ifdef
> >   ext4: Use provided macro for checking dummy_enc_policy
>
> FYI, the patchset
> https://lore.kernel.org/linux-ext4/20220501050857.538984-1-ebiggers@kernel.org
> I just sent out cleans up how the test_dummy_encryption mount option is handled.
> It would supersede patches 1, 3, 5, and 6 of this series (since those all only
> deal with test_dummy_encryption-related code).

Sure got it.

>
> To avoid conflicting changes, maybe you should just focus on your patches 2 and
> 4 for now, along with possibly FS_IOC_GET_ENCRYPTION_PWSALT as I mentioned?
> There shouldn't be any overlap that way.

Yes, agreed with al of above points Eric. Will make the changes and send a new
revision.

-ritesh