Re: [f2fs-dev] [PATCH] f2fs: make f2fs_read_inline_data() more readable

2022-05-18 Thread Chao Liu
On Wed, May 18, 2022 at 11:23 PM Chao Yu wrote: > > On 2022/5/18 10:33, Chao Liu wrote: > > In f2fs_read_inline_data(), it is confused with checking of > > inline_data flag, as we checked it before calling. So this > > patch add some comments for f2fs_has_inline_data(). > > > > Signed-off-by: Chao

Re: [f2fs-dev] [PATCH v6 7/8] ext4: Move CONFIG_UNICODE defguards into the code flow

2022-05-18 Thread Eric Biggers
On Wed, May 18, 2022 at 09:40:43PM -0400, Gabriel Krisman Bertazi wrote: > Instead of a bunch of ifdefs, make the unicode built checks part of the > code flow where possible, as requested by Torvalds. > > Signed-off-by: Gabriel Krisman Bertazi > > --- > Changes since v5: > - Drop err variable

Re: [f2fs-dev] [PATCH v6 5/8] f2fs: Reuse generic_ci_match for ci comparisons

2022-05-18 Thread Eric Biggers
On Wed, May 18, 2022 at 09:40:41PM -0400, Gabriel Krisman Bertazi wrote: > Now that ci_match is part of libfs, make f2fs reuse it instead of having > a different implementation. > > Signed-off-by: Gabriel Krisman Bertazi > > --- > Changes since v3: > - Drop cast (eric) > - fix unused variabl

Re: [f2fs-dev] [PATCH v6 4/8] ext4: Reuse generic_ci_match for ci comparisons

2022-05-18 Thread Eric Biggers
On Wed, May 18, 2022 at 09:40:40PM -0400, Gabriel Krisman Bertazi wrote: > Instead of reimplementing ext4_match_ci, use the new libfs helper. > > It should be fine to drop the fname->cf_name in the encrypted directory > case for the hash verification optimization because the only two ways > for fn

Re: [f2fs-dev] [PATCH v6 3/8] libfs: Introduce case-insensitive string comparison helper

2022-05-18 Thread Eric Biggers
On Wed, May 18, 2022 at 09:40:39PM -0400, Gabriel Krisman Bertazi wrote: > diff --git a/fs/libfs.c b/fs/libfs.c > index 974125270a42..c8f40ee35743 100644 > --- a/fs/libfs.c > +++ b/fs/libfs.c > @@ -1465,6 +1465,74 @@ static const struct dentry_operations > generic_ci_dentry_ops = { > .d_hash

Re: [f2fs-dev] [PATCH v3 2/5] ext4: only allow test_dummy_encryption when supported

2022-05-18 Thread Theodore Ts'o
On Fri, May 13, 2022 at 04:16:02PM -0700, Eric Biggers wrote: > From: Eric Biggers > > Make the test_dummy_encryption mount option require that the encrypt > feature flag be already enabled on the filesystem, rather than > automatically enabling it. Practically, this means that "-O encrypt" > wi

Re: [f2fs-dev] [PATCH v3 1/5] ext4: fix memory leak in parse_apply_sb_mount_options()

2022-05-18 Thread Theodore Ts'o
On Fri, May 13, 2022 at 04:16:01PM -0700, Eric Biggers wrote: > From: Eric Biggers > > If processing the on-disk mount options fails after any memory was > allocated in the ext4_fs_context, e.g. s_qf_names, then this memory is > leaked. Fix this by calling ext4_fc_free() instead of kfree() direc

[f2fs-dev] [PATCH v6 8/8] f2fs: Move CONFIG_UNICODE defguards into the code flow

2022-05-18 Thread Gabriel Krisman Bertazi
Instead of a bunch of ifdefs, make the unicode built checks part of the code flow where possible, as requested by Torvalds. Reviewed-by: Eric Biggers Signed-off-by: Gabriel Krisman Bertazi --- Changes since v4: - Drop stub removal for !CONFIG_UNICODE case (eric) --- fs/f2fs/namei.c | 11

[f2fs-dev] [PATCH v6 7/8] ext4: Move CONFIG_UNICODE defguards into the code flow

2022-05-18 Thread Gabriel Krisman Bertazi
Instead of a bunch of ifdefs, make the unicode built checks part of the code flow where possible, as requested by Torvalds. Signed-off-by: Gabriel Krisman Bertazi --- Changes since v5: - Drop err variable (eric) Changes since v4: - Create stub for !CONFIG_UNICODE case (eric) --- fs/ext4/ext

[f2fs-dev] [PATCH v6 5/8] f2fs: Reuse generic_ci_match for ci comparisons

2022-05-18 Thread Gabriel Krisman Bertazi
Now that ci_match is part of libfs, make f2fs reuse it instead of having a different implementation. Signed-off-by: Gabriel Krisman Bertazi --- Changes since v3: - Drop cast (eric) - fix unused variable iff !CONFIG_UNICODE (lkp) --- fs/f2fs/dir.c | 58 ---

[f2fs-dev] [PATCH v6 6/8] ext4: Log error when lookup of encoded dentry fails

2022-05-18 Thread Gabriel Krisman Bertazi
If the volume is in strict mode, ext4_ci_compare can report a broken encoding name. This will not trigger on a bad lookup, which is caught earlier, only if the actual disk name is bad. Reviewed-by: Eric Biggers Signed-off-by: Gabriel Krisman Bertazi --- changes since v4: - Reword error mess

[f2fs-dev] [PATCH v6 4/8] ext4: Reuse generic_ci_match for ci comparisons

2022-05-18 Thread Gabriel Krisman Bertazi
Instead of reimplementing ext4_match_ci, use the new libfs helper. It should be fine to drop the fname->cf_name in the encrypted directory case for the hash verification optimization because the only two ways for fname->cf_name to be NULL on a case-insensitive lookup is (1) if name under lookup

[f2fs-dev] [PATCH v6 2/8] f2fs: Simplify the handling of cached insensitive names

2022-05-18 Thread Gabriel Krisman Bertazi
Keeping it as qstr avoids the unnecessary conversion in f2fs_match Reviewed-by: Eric Biggers Signed-off-by: Gabriel Krisman Bertazi --- Changes since v4: - Fix inconsistent return on error (eric) --- fs/f2fs/dir.c | 51 ++ fs/f2fs/f2fs.h |

[f2fs-dev] [PATCH v6 0/8] Clean up the case-insensitive lookup path

2022-05-18 Thread Gabriel Krisman Bertazi
Hi Eric, Ted, Sorry for the second submission of this series on the same day. Just a batch of simple fixes, so I hope it is getting close to merging. This is v6 of this series (thank you for the feedback!) . This picks up a few r-b tags and apply the comments from Eric. No big changes, all doc

[f2fs-dev] [PATCH v6 1/8] ext4: Simplify the handling of cached insensitive names

2022-05-18 Thread Gabriel Krisman Bertazi
Keeping it as qstr avoids the unnecessary conversion in ext4_match Reviewed-by: Eric Biggers Signed-off-by: Gabriel Krisman Bertazi --- Changes since v1: - Simplify hunk (eric) --- fs/ext4/ext4.h | 2 +- fs/ext4/namei.c | 23 +++ 2 files changed, 12 insertions(+), 13 de

[f2fs-dev] [PATCH v6 3/8] libfs: Introduce case-insensitive string comparison helper

2022-05-18 Thread Gabriel Krisman Bertazi
generic_ci_match can be used by case-insensitive filesystems to compare strings under lookup with dirents in a case-insensitive way. This function is currently reimplemented by each filesystem supporting casefolding, so this reduces code duplication in filesystem-specific code. Signed-off-by: Gab

[f2fs-dev] [RFC PATCH v2 5/7] f2fs: don't allow DIO reads but not DIO writes

2022-05-18 Thread Eric Biggers
From: Eric Biggers Currently, if an f2fs filesystem is mounted with the mode=lfs and io_bits mount options, DIO reads are allowed but DIO writes are not. Allowing DIO reads but not DIO writes is an unusual restriction, which is likely to be surprising to applications, namely any application that

[f2fs-dev] [RFC PATCH v2 1/7] statx: add I/O alignment information

2022-05-18 Thread Eric Biggers
From: Eric Biggers Traditionally, the conditions for when DIO (direct I/O) is supported were fairly simple: filesystems either supported DIO aligned to the block device's logical block size, or didn't support DIO at all. However, due to filesystem features that have been added over time (e.g, da

[f2fs-dev] [RFC PATCH v2 2/7] fscrypt: change fscrypt_dio_supported() to prepare for STATX_IOALIGN

2022-05-18 Thread Eric Biggers
From: Eric Biggers To prepare for STATX_IOALIGN support, make two changes to fscrypt_dio_supported(). First, remove the filesystem-block-alignment check and make the filesystems handle it instead. It previously made sense to have it in fs/crypto/; however, to support STATX_IOALIGN the alignment

[f2fs-dev] [RFC PATCH v2 3/7] ext4: support STATX_IOALIGN

2022-05-18 Thread Eric Biggers
From: Eric Biggers Add support for STATX_IOALIGN to ext4, so that I/O alignment information is exposed to userspace in a consistent and easy-to-use way. Signed-off-by: Eric Biggers --- fs/ext4/ext4.h | 1 + fs/ext4/file.c | 15 --- fs/ext4/inode.c | 31 ++

[f2fs-dev] [RFC PATCH v2 6/7] f2fs: simplify f2fs_force_buffered_io()

2022-05-18 Thread Eric Biggers
From: Eric Biggers f2fs only allows direct I/O that is aligned to the filesystem block size. Given that fact, simplify f2fs_force_buffered_io() by removing the redundant call to block_unaligned_IO(). This makes it easier to reuse this code for STATX_IOALIGN. Signed-off-by: Eric Biggers --- f

[f2fs-dev] [RFC PATCH v2 4/7] f2fs: move f2fs_force_buffered_io() into file.c

2022-05-18 Thread Eric Biggers
From: Eric Biggers f2fs_force_buffered_io() is only used in file.c, so move it into there. No behavior change. This makes it easier to review later patches. Signed-off-by: Eric Biggers --- fs/f2fs/f2fs.h | 45 - fs/f2fs/file.c | 45 +

[f2fs-dev] [RFC PATCH v2 0/7] make statx() return I/O alignment information

2022-05-18 Thread Eric Biggers
This patchset makes the statx() system call return I/O alignment information, roughly following the design that was suggested at https://lore.kernel.org/linux-fsdevel/20220120071215.123274-1-ebigg...@kernel.org/T/#u This feature solves two problems: (a) it allows userspace to determine when a file

[f2fs-dev] [RFC PATCH v2 7/7] f2fs: support STATX_IOALIGN

2022-05-18 Thread Eric Biggers
From: Eric Biggers Add support for STATX_IOALIGN to f2fs, so that I/O alignment information is exposed to userspace in a consistent and easy-to-use way. Signed-off-by: Eric Biggers --- fs/f2fs/file.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/fs/f2fs/f

Re: [f2fs-dev] [PATCH v5 4/8] ext4: Reuse generic_ci_match for ci comparisons

2022-05-18 Thread Gabriel Krisman Bertazi
Eric Biggers writes: > On Wed, May 18, 2022 at 01:23:16PM -0400, Gabriel Krisman Bertazi wrote: >> Instead of reimplementing ext4_match_ci, use the new libfs helper. >> >> Signed-off-by: Gabriel Krisman Bertazi >> --- > [...] >> int ext4_fname_setup_ci_filename(struct inode *dir, const struct

Re: [f2fs-dev] [PATCH] f2fs: decompress data without workqueue

2022-05-18 Thread Jaegeuk Kim
Please hold any test, since this patch has a bug. On 05/18, Jaegeuk Kim wrote: > Let's decompress data under the same context to avoid workqueue delay. > > Signed-off-by: Jaegeuk Kim > --- > fs/f2fs/data.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/fs/f2fs/data

Re: [f2fs-dev] [PATCH v5 8/8] f2fs: Move CONFIG_UNICODE defguards into the code flow

2022-05-18 Thread Eric Biggers
On Wed, May 18, 2022 at 01:23:20PM -0400, Gabriel Krisman Bertazi wrote: > Instead of a bunch of ifdefs, make the unicode built checks part of the > code flow where possible, as requested by Torvalds. > > Signed-off-by: Gabriel Krisman Bertazi > > --- > Changes since v4: > - Drop stub removal

Re: [f2fs-dev] [PATCH v5 7/8] ext4: Move CONFIG_UNICODE defguards into the code flow

2022-05-18 Thread Eric Biggers
On Wed, May 18, 2022 at 01:23:19PM -0400, Gabriel Krisman Bertazi wrote: > Instead of a bunch of ifdefs, make the unicode built checks part of the > code flow where possible, as requested by Torvalds. > > Signed-off-by: Gabriel Krisman Bertazi > > --- > Changes since v4: > - Create stub for !C

Re: [f2fs-dev] [PATCH v5 6/8] ext4: Log error when lookup of encoded dentry fails

2022-05-18 Thread Eric Biggers
On Wed, May 18, 2022 at 01:23:18PM -0400, Gabriel Krisman Bertazi wrote: > If the volume is in strict mode, ext4_ci_compare can report a broken > encoding name. This will not trigger on a bad lookup, which is caught > earlier, only if the actual disk name is bad. > > Signed-off-by: Gabriel Krisma

Re: [f2fs-dev] [PATCH v5 5/8] f2fs: Reuse generic_ci_match for ci comparisons

2022-05-18 Thread Eric Biggers
On Wed, May 18, 2022 at 01:23:17PM -0400, Gabriel Krisman Bertazi wrote: > @@ -277,8 +225,10 @@ static inline int f2fs_match_name(const struct inode > *dir, > > #if IS_ENABLED(CONFIG_UNICODE) > if (fname->cf_name.name) > - return f2fs_match_ci_name(dir, &fname->cf_name, > -

Re: [f2fs-dev] [PATCH v5 4/8] ext4: Reuse generic_ci_match for ci comparisons

2022-05-18 Thread Eric Biggers
On Wed, May 18, 2022 at 01:23:16PM -0400, Gabriel Krisman Bertazi wrote: > Instead of reimplementing ext4_match_ci, use the new libfs helper. > > Signed-off-by: Gabriel Krisman Bertazi > --- [...] > int ext4_fname_setup_ci_filename(struct inode *dir, const struct qstr *iname, >

Re: [f2fs-dev] [PATCH v5 3/8] libfs: Introduce case-insensitive string comparison helper

2022-05-18 Thread Eric Biggers
On Wed, May 18, 2022 at 01:23:15PM -0400, Gabriel Krisman Bertazi wrote: > generic_ci_match can be used by case-insensitive filesystems to compare > strings under lookup with dirents in a case-insensitive way. This > function is currently reimplemented by each filesystem supporting > casefolding,

Re: [f2fs-dev] [PATCH v5 2/8] f2fs: Simplify the handling of cached insensitive names

2022-05-18 Thread Eric Biggers
On Wed, May 18, 2022 at 01:23:14PM -0400, Gabriel Krisman Bertazi wrote: > Keeping it as qstr avoids the unnecessary conversion in f2fs_match > > Signed-off-by: Gabriel Krisman Bertazi > Reviewed-by: Eric Biggers - Eric ___ Linux-f2fs-devel mailin

Re: [f2fs-dev] [PATCH v5 1/8] ext4: Simplify the handling of cached insensitive names

2022-05-18 Thread Eric Biggers
On Wed, May 18, 2022 at 01:23:13PM -0400, Gabriel Krisman Bertazi wrote: > Keeping it as qstr avoids the unnecessary conversion in ext4_match > > Signed-off-by: Gabriel Krisman Bertazi > > -- > Changes since v1: > - Simplify hunk (eric) > --- The changelog needs to be deleted (or moved below

[f2fs-dev] [PATCH] f2fs: decompress data without workqueue

2022-05-18 Thread Jaegeuk Kim
Let's decompress data under the same context to avoid workqueue delay. Signed-off-by: Jaegeuk Kim --- fs/f2fs/data.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 54a7a8ad994d..37aa7ac5d463 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/d

[f2fs-dev] [PATCH v5 7/8] ext4: Move CONFIG_UNICODE defguards into the code flow

2022-05-18 Thread Gabriel Krisman Bertazi
Instead of a bunch of ifdefs, make the unicode built checks part of the code flow where possible, as requested by Torvalds. Signed-off-by: Gabriel Krisman Bertazi --- Changes since v4: - Create stub for !CONFIG_UNICODE case (eric) --- fs/ext4/ext4.h | 37 -

[f2fs-dev] [PATCH v5 8/8] f2fs: Move CONFIG_UNICODE defguards into the code flow

2022-05-18 Thread Gabriel Krisman Bertazi
Instead of a bunch of ifdefs, make the unicode built checks part of the code flow where possible, as requested by Torvalds. Signed-off-by: Gabriel Krisman Bertazi --- Changes since v4: - Drop stub removal for !CONFIG_UNICODE case (eric) --- fs/f2fs/namei.c | 11 +-- fs/f2fs/super.c |

[f2fs-dev] [PATCH v5 6/8] ext4: Log error when lookup of encoded dentry fails

2022-05-18 Thread Gabriel Krisman Bertazi
If the volume is in strict mode, ext4_ci_compare can report a broken encoding name. This will not trigger on a bad lookup, which is caught earlier, only if the actual disk name is bad. Signed-off-by: Gabriel Krisman Bertazi --- changes since v4: - Reword error message (Eric) Changes since v

[f2fs-dev] [PATCH v5 2/8] f2fs: Simplify the handling of cached insensitive names

2022-05-18 Thread Gabriel Krisman Bertazi
Keeping it as qstr avoids the unnecessary conversion in f2fs_match Signed-off-by: Gabriel Krisman Bertazi --- Changes since v4: - Fix inconsistent return on error (eric) --- fs/f2fs/dir.c | 51 ++ fs/f2fs/f2fs.h | 15 +- fs/f2fs

[f2fs-dev] [PATCH v5 5/8] f2fs: Reuse generic_ci_match for ci comparisons

2022-05-18 Thread Gabriel Krisman Bertazi
Now that ci_match is part of libfs, make f2fs reuse it instead of having a different implementation. Signed-off-by: Gabriel Krisman Bertazi --- Changes since v3: - fix unused variable iff !CONFIG_UNICODE (lkp) --- fs/f2fs/dir.c | 58 --- 1 file

[f2fs-dev] [PATCH v5 1/8] ext4: Simplify the handling of cached insensitive names

2022-05-18 Thread Gabriel Krisman Bertazi
Keeping it as qstr avoids the unnecessary conversion in ext4_match Signed-off-by: Gabriel Krisman Bertazi -- Changes since v1: - Simplify hunk (eric) --- fs/ext4/ext4.h | 2 +- fs/ext4/namei.c | 23 +++ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/fs/

[f2fs-dev] [PATCH v5 4/8] ext4: Reuse generic_ci_match for ci comparisons

2022-05-18 Thread Gabriel Krisman Bertazi
Instead of reimplementing ext4_match_ci, use the new libfs helper. Signed-off-by: Gabriel Krisman Bertazi --- fs/ext4/namei.c | 81 +++-- 1 file changed, 17 insertions(+), 64 deletions(-) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 206fcf8fdc

[f2fs-dev] [PATCH v5 3/8] libfs: Introduce case-insensitive string comparison helper

2022-05-18 Thread Gabriel Krisman Bertazi
generic_ci_match can be used by case-insensitive filesystems to compare strings under lookup with dirents in a case-insensitive way. This function is currently reimplemented by each filesystem supporting casefolding, so this reduces code duplication in filesystem-specific code. Signed-off-by: Gab

[f2fs-dev] [PATCH v5 0/8] Clean up the case-insensitive lookup path

2022-05-18 Thread Gabriel Krisman Bertazi
Hi Eric, Ted, This reworks the entire series to apply Eric's comments. Thank you for the feedback, Eric! The biggest change is the removal of unicode_name and the split of the libfs patch. It made the series much better to follow. I also dropped the hash patch, but there is still a minor clean

Re: [f2fs-dev] [PATCH] f2fs: make f2fs_read_inline_data() more readable

2022-05-18 Thread Chao Yu
On 2022/5/18 10:33, Chao Liu wrote: In f2fs_read_inline_data(), it is confused with checking of inline_data flag, as we checked it before calling. So this patch add some comments for f2fs_has_inline_data(). Signed-off-by: Chao Liu It looks email address is missing, but it shows after I can app

Re: [f2fs-dev] [PATCH v4] f2fs: fix to do sanity check for inline inode

2022-05-18 Thread Chao Yu
On 2022/5/18 2:18, Jaegeuk Kim wrote: On 05/17, Chao Yu wrote: Yanming reported a kernel bug in Bugzilla kernel [1], which can be reproduced. The bug message is: The kernel message is shown below: kernel BUG at fs/inode.c:611! Call Trace: evict+0x282/0x4e0 __dentry_kill+0x2b2/0x4d0 dput+

[f2fs-dev] [PATCH v5] f2fs: fix to do sanity check for inline inode

2022-05-18 Thread Chao Yu
Yanming reported a kernel bug in Bugzilla kernel [1], which can be reproduced. The bug message is: The kernel message is shown below: kernel BUG at fs/inode.c:611! Call Trace: evict+0x282/0x4e0 __dentry_kill+0x2b2/0x4d0 dput+0x2dd/0x720 do_renameat2+0x596/0x970 __x64_sys_rename+0x78/0x90 do