Re: [f2fs-dev] [PATCH 6/9] f2fs: zstd: Switch to the zstd-1.4.6 API

2020-09-16 Thread Chao Yu
Hi Nick, On 2020/9/17 2:39, Nick Terrell wrote: On Sep 15, 2020, at 11:31 PM, Chao Yu wrote: Hi Nick, remove not related mailing list. On 2020/9/16 11:43, Nick Terrell wrote: From: Nick Terrell Move away from the compatibility wrapper to the zstd-1.4.6 API. This code is more efficient b

Re: [f2fs-dev] F2fs failed on fresh installation 1st boot

2020-09-16 Thread Chris Ruehl
On 14/9/2020 3:55 pm, Chao Yu wrote: Hi Chris, On 2020/9/14 15:38, Chris Ruehl wrote: I must say sorry for the noise, I checked the Ram and CPU, we have a bad RAM which can't follow the 992Mhz and causes the problem, once limit the CPU speed to 800Mhz the problem is gone. Both 4.9 & 5.4 Ok

[f2fs-dev] [PATCH v3 09/13] fscrypt: stop pretending that key setup is nofs-safe

2020-09-16 Thread Eric Biggers
From: Eric Biggers fscrypt_get_encryption_info() has never actually been safe to call in a context that needs GFP_NOFS, since it calls crypto_alloc_skcipher(). crypto_alloc_skcipher() isn't GFP_NOFS-safe, even if called under memalloc_nofs_save(). This is because it may load kernel modules, and

[f2fs-dev] [PATCH v3 07/13] fscrypt: remove fscrypt_inherit_context()

2020-09-16 Thread Eric Biggers
From: Eric Biggers Now that all filesystems have been converted to use fscrypt_prepare_new_inode() and fscrypt_set_context(), fscrypt_inherit_context() is no longer used. Remove it. Signed-off-by: Eric Biggers --- fs/crypto/policy.c | 37 - include/lin

[f2fs-dev] [PATCH v3 10/13] fscrypt: make "#define fscrypt_policy" user-only

2020-09-16 Thread Eric Biggers
From: Eric Biggers The fscrypt UAPI header defines fscrypt_policy to fscrypt_policy_v1, for source compatibility with old userspace programs. Internally, the kernel doesn't want that compatibility definition. Instead, fscrypt_private.h #undefs it and re-defines it to a union. That works for now

[f2fs-dev] [PATCH v3 04/13] f2fs: use fscrypt_prepare_new_inode() and fscrypt_set_context()

2020-09-16 Thread Eric Biggers
From: Eric Biggers Convert f2fs to use the new functions fscrypt_prepare_new_inode() and fscrypt_set_context(). This avoids calling fscrypt_get_encryption_info() from under f2fs_lock_op(), which can deadlock because fscrypt_get_encryption_info() isn't GFP_NOFS-safe. For more details about this

[f2fs-dev] [PATCH v3 12/13] fscrypt: handle test_dummy_encryption in more logical way

2020-09-16 Thread Eric Biggers
From: Eric Biggers The behavior of the test_dummy_encryption mount option is that when a new file (or directory or symlink) is created in an unencrypted directory, it's automatically encrypted using a dummy encryption policy. That's it; in particular, the encryption (or lack thereof) of existing

[f2fs-dev] [PATCH v3 11/13] fscrypt: move fscrypt_prepare_symlink() out-of-line

2020-09-16 Thread Eric Biggers
From: Eric Biggers In preparation for moving the logic for "get the encryption policy inherited by new files in this directory" to a single place, make fscrypt_prepare_symlink() a regular function rather than an inline function that wraps __fscrypt_prepare_symlink(). This way, the new function f

[f2fs-dev] [PATCH v3 00/13] fscrypt: improve file creation flow

2020-09-16 Thread Eric Biggers
Hello, This series reworks the implementation of creating new encrypted files by introducing new helper functions that allow filesystems to set up the inodes' keys earlier, prior to taking too many filesystem locks. This fixes deadlocks that are possible during memory reclaim because fscrypt_get_

[f2fs-dev] [PATCH v3 08/13] fscrypt: require that fscrypt_encrypt_symlink() already has key

2020-09-16 Thread Eric Biggers
From: Eric Biggers Now that all filesystems have been converted to use fscrypt_prepare_new_inode(), the encryption key for new symlink inodes is now already set up whenever we try to encrypt the symlink target. Enforce this rather than try to set up the key again when it may be too late to do so

[f2fs-dev] [PATCH v3 06/13] fscrypt: adjust logging for in-creation inodes

2020-09-16 Thread Eric Biggers
From: Eric Biggers Now that a fscrypt_info may be set up for inodes that are currently being created and haven't yet had an inode number assigned, avoid logging confusing messages about "inode 0". Signed-off-by: Eric Biggers --- fs/crypto/crypto.c | 4 +++- fs/crypto/keyring.c | 9 +++--

[f2fs-dev] [PATCH v3 01/13] fscrypt: add fscrypt_prepare_new_inode() and fscrypt_set_context()

2020-09-16 Thread Eric Biggers
From: Eric Biggers fscrypt_get_encryption_info() is intended to be GFP_NOFS-safe. But actually it isn't, since it uses functions like crypto_alloc_skcipher() which aren't GFP_NOFS-safe, even when called under memalloc_nofs_save(). Therefore it can deadlock when called from a context that needs G

[f2fs-dev] [PATCH v3 05/13] ubifs: use fscrypt_prepare_new_inode() and fscrypt_set_context()

2020-09-16 Thread Eric Biggers
From: Eric Biggers Convert ubifs to use the new functions fscrypt_prepare_new_inode() and fscrypt_set_context(). Unlike ext4 and f2fs, this doesn't appear to fix any deadlock bug. But it does shorten the code slightly and get all filesystems using the same helper functions, so that fscrypt_inhe

[f2fs-dev] [PATCH v3 03/13] ext4: use fscrypt_prepare_new_inode() and fscrypt_set_context()

2020-09-16 Thread Eric Biggers
From: Eric Biggers Convert ext4 to use the new functions fscrypt_prepare_new_inode() and fscrypt_set_context(). This avoids calling fscrypt_get_encryption_info() from within a transaction, which can deadlock because fscrypt_get_encryption_info() isn't GFP_NOFS-safe. For more details about this

[f2fs-dev] [PATCH v3 02/13] ext4: factor out ext4_xattr_credits_for_new_inode()

2020-09-16 Thread Eric Biggers
From: Eric Biggers To compute a new inode's xattr credits, we need to know whether the inode will be encrypted or not. When we switch to use the new helper function fscrypt_prepare_new_inode(), we won't find out whether the inode will be encrypted until slightly later than is currently the case.

[f2fs-dev] [PATCH v3 13/13] fscrypt: make fscrypt_set_test_dummy_encryption() take a 'const char *'

2020-09-16 Thread Eric Biggers
From: Eric Biggers fscrypt_set_test_dummy_encryption() requires that the optional argument to the test_dummy_encryption mount option be specified as a substring_t. That doesn't work well with filesystems that use the new mount API, since the new way of parsing mount options doesn't use substring_

Re: [f2fs-dev] [PATCH] f2fs: fix wrong total_sections check

2020-09-16 Thread wangxiaojun (N)
在 2020/9/16 17:49, Yuchao (T) 写道: > On 2020/9/16 14:56, wangxiaojun (N) wrote: >> 在 2020/9/16 10:57, Yuchao (T) 写道: >>> On 2020/9/16 9:54, Xiaojun Wang wrote: Meta area is not included in section_count computation. The code in mkfs/f2fs_format.c is: total_zones = get_sb(segment_co

Re: [f2fs-dev] [PATCH 3/9] lib: zstd: Upgrade to latest upstream zstd version 1.4.6

2020-09-16 Thread Nick Terrell via Linux-f2fs-devel
> On Sep 15, 2020, at 8:42 PM, Nick Terrell wrote: > > From: Nick Terrell > > Upgrade to the latest upstream zstd version 1.4.6. > > This patch is 100% generated from upstream zstd commit c4763f087c2b [0]. > > This patch is very large because it is transitioning from the custom > kernel zstd

Re: [f2fs-dev] [PATCH 6/9] f2fs: zstd: Switch to the zstd-1.4.6 API

2020-09-16 Thread Nick Terrell via Linux-f2fs-devel
> On Sep 15, 2020, at 11:31 PM, Chao Yu wrote: > > Hi Nick, > > remove not related mailing list. > > On 2020/9/16 11:43, Nick Terrell wrote: >> From: Nick Terrell >> Move away from the compatibility wrapper to the zstd-1.4.6 API. This >> code is more efficient because it uses the single-pass

Re: [f2fs-dev] [PATCH 5/9] btrfs: zstd: Switch to the zstd-1.4.6 API

2020-09-16 Thread Eric Biggers
On Wed, Sep 16, 2020 at 03:46:18PM +0100, Christoph Hellwig wrote: > On Wed, Sep 16, 2020 at 10:43:04AM -0400, Chris Mason wrote: > > Otherwise we just end up with drift and kernel-specific bugs that are harder > > to debug. To the extent those APIs make us contort the kernel code, I???m > > sure

Re: [f2fs-dev] [PATCH 5/9] btrfs: zstd: Switch to the zstd-1.4.6 API

2020-09-16 Thread Chris Mason via Linux-f2fs-devel
On 16 Sep 2020, at 10:46, Christoph Hellwig wrote: On Wed, Sep 16, 2020 at 10:43:04AM -0400, Chris Mason wrote: Otherwise we just end up with drift and kernel-specific bugs that are harder to debug. To the extent those APIs make us contort the kernel code, I???m sure Nick is interested in im

Re: [f2fs-dev] [PATCH 5/9] btrfs: zstd: Switch to the zstd-1.4.6 API

2020-09-16 Thread Christoph Hellwig
On Wed, Sep 16, 2020 at 10:43:04AM -0400, Chris Mason wrote: > Otherwise we just end up with drift and kernel-specific bugs that are harder > to debug. To the extent those APIs make us contort the kernel code, I???m > sure Nick is interested in improving things in both places. Seriously, we do no

Re: [f2fs-dev] [PATCH 5/9] btrfs: zstd: Switch to the zstd-1.4.6 API

2020-09-16 Thread Chris Mason via Linux-f2fs-devel
On 16 Sep 2020, at 10:30, Christoph Hellwig wrote: On Wed, Sep 16, 2020 at 10:20:52AM -0400, Chris Mason wrote: It???s not completely clear what you???re asking for here. If the API matches what???s in zstd-1.4.6, that seems like a reasonable way to label it. That???s what the upstream is f

Re: [f2fs-dev] [PATCH 5/9] btrfs: zstd: Switch to the zstd-1.4.6 API

2020-09-16 Thread Christoph Hellwig
On Wed, Sep 16, 2020 at 10:20:52AM -0400, Chris Mason wrote: > It???s not completely clear what you???re asking for here. If the API > matches what???s in zstd-1.4.6, that seems like a reasonable way to label > it. That???s what the upstream is for this code. > > I???m also not sure why we???re

Re: [f2fs-dev] [PATCH 5/9] btrfs: zstd: Switch to the zstd-1.4.6 API

2020-09-16 Thread Chris Mason via Linux-f2fs-devel
On 16 Sep 2020, at 4:49, Christoph Hellwig wrote: On Tue, Sep 15, 2020 at 08:42:59PM -0700, Nick Terrell wrote: From: Nick Terrell Move away from the compatibility wrapper to the zstd-1.4.6 API. This code is functionally equivalent. Again, please use sensible names And no one gives a fuck

Re: [f2fs-dev] [PATCH] f2fs: fix wrong total_sections check

2020-09-16 Thread Chao Yu
On 2020/9/16 14:56, wangxiaojun (N) wrote: 在 2020/9/16 10:57, Yuchao (T) 写道: On 2020/9/16 9:54, Xiaojun Wang wrote: Meta area is not included in section_count computation. The code in mkfs/f2fs_format.c is: total_zones = get_sb(segment_count) / (c.segs_per_zone) -

Re: [f2fs-dev] [PATCH 5/9] btrfs: zstd: Switch to the zstd-1.4.6 API

2020-09-16 Thread Christoph Hellwig
On Tue, Sep 15, 2020 at 08:42:59PM -0700, Nick Terrell wrote: > From: Nick Terrell > > Move away from the compatibility wrapper to the zstd-1.4.6 API. This > code is functionally equivalent. Again, please use sensible names And no one gives a fuck if this bad API is "zstd-1.4.6" as the Linux ke

Re: [f2fs-dev] [PATCH 4/9] crypto: zstd: Switch to zstd-1.4.6 API

2020-09-16 Thread Christoph Hellwig
> + const size_t wksp_size = ZSTD_estimateCCtxSize(ZSTD_DEF_LEVEL); > + > + if (ZSTD_isError(wksp_size)) { > + ret = -EINVAL; > + goto out_free; > + } Pleas switch to properly named functions when you touch this. The API names here look like a cat threw up on t

Re: [f2fs-dev] [PATCH 1/9] lib: zstd: Add zstd compatibility wrapper

2020-09-16 Thread Christoph Hellwig
On Tue, Sep 15, 2020 at 08:42:54PM -0700, Nick Terrell wrote: > From: Nick Terrell > > Adds zstd_compat.h which provides the necessary functions from the > current zstd.h API. It is only active for zstd versions 1.4.6 and newer. > That means it is disabled currently, but will become active when a

[f2fs-dev] [PATCH] f2fs: change return value of reserved_segments to unsigned int

2020-09-16 Thread Xiaojun Wang
The type of SM_I(sbi)->reserved_segments is unsigned int, so change the return value to unsigned int. The type cast can be removed in reserved_sections as a result. Signed-off-by: Xiaojun Wang --- fs/f2fs/segment.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/s