Skip to content
This repository has been archived by the owner on Jul 7, 2021. It is now read-only.

Commit

Permalink
Merge tag '5.7-rc1-4.14' of https://kernel.googlesource.com/pub/scm/l…
Browse files Browse the repository at this point in the history
…inux/kernel/git/jaegeuk/f2fs-stable into neutrino-msm-hotdogb-4.14

* tag '5.7-rc1-4.14':
  f2fs: fix build error on PAGE_KERNEL_RO
  mm/swapfile.c: move inode_lock out of claim_swapfile
  f2fs: fix to wait all node page writeback
  f2fs: fix the panic in do_checkpoint()
  f2fs: fix leaking uninitialized memory in compressed clusters
  f2fs: fix to avoid NULL pointer dereference
  f2fs: recycle unused compress_data.chksum feild
  f2fs: add missing function name in kernel message
  f2fs: fix to avoid potential deadlock
  f2fs: fix to check i_compr_blocks correctly
  f2fs: cover last_disk_size update with spinlock
  f2fs: remove i_sem lock coverage in f2fs_setxattr()
  f2fs: fix inconsistent comments
  f2fs: fix to avoid using uninitialized variable
  f2fs: fix to avoid use-after-free in f2fs_write_multi_pages()
  f2fs: fix wrong check on F2FS_IOC_FSSETXATTR
  f2fs: fix to account compressed inode correctly
  f2fs: fix to check dirty pages during compressed inode conversion
  f2fs: allow to clear F2FS_COMPR_FL flag
  f2fs: Use scnprintf() for avoiding potential buffer overflow
  f2fs: show mounted time
  f2fs: clean up codes with {f2fs_,}data_blkaddr()
  f2fs: clean up parameter of macro XATTR_SIZE()
  f2fs: fix to show norecovery mount option
  f2fs: clean up lfs/adaptive mount option
  f2fs: clean up bggc mount option
  f2fs: add migration count iff migration happens
  f2fs: skip GC when section is full
  f2fs: introduce DEFAULT_IO_TIMEOUT
  f2fs: add prefix for f2fs slab cache name
  f2fs: fix to avoid triggering IO in write path
  f2fs: introduce F2FS_IOC_GET_COMPRESS_BLOCKS
  f2fs: avoid __GFP_NOFAIL in f2fs_bio_alloc
  f2fs: fix to show tracepoint correctly
  f2fs: skip migration only when BG_GC is called
  f2fs: Fix mount failure due to SPO after a successful online resize FS
  f2fs: Add a new CP flag to help fsck fix resize SPO issues
  f2fs: fix to update f2fs_super_block fields under sb_lock
  f2fs: xattr.h: Replace zero-length array with flexible-array member
  f2fs: fix to account compressed blocks in f2fs_compressed_blocks()
  f2fs: don't mark compressed inode dirty during f2fs_iget()
  f2fs: delete DIO read lock
  f2fs: fix potential deadlock on compressed quota file
  f2fs: don't change inode status under page lock
  f2fs: fix to avoid potential deadlock
  f2fs: clean up f2fs_may_encrypt()
  f2fs: fix NULL pointer dereference in f2fs_write_begin()
  f2fs: don't trigger data flush in foreground operation
  f2fs: don't call fscrypt_get_encryption_info() explicitly in f2fs_tmpfile()
  f2fs: fix to clear PG_error if fsverity failed
  f2fs: fix NULL pointer dereference in f2fs_verity_work()
  f2fs: fix potential .flags overflow on 32bit architecture
  f2fs: fix to avoid double unlock
  f2fs: xattr.h: Make stub helpers inline
  f2fs: fix to use f2fs_readpage_limit() in f2fs_read_multi_pages()
  f2fs: clean up {cic,dic}.ref handling
  f2fs: change default compression algorithm
  f2fs: compress: fix to call missing destroy_compress_ctx()
  f2fs: compress: add .{init,destroy}_decompress_ctx callback
  f2fs: compress: support zstd compress algorithm
  f2fs: clean up dic->tpages assignment
  f2fs: show compression in statx
  f2fs: fix to verify tpage before releasing in f2fs_free_dic()
  f2fs: switch discard_policy.timeout to bool type
  f2fs: add missing CONFIG_F2FS_FS_COMPRESSION
  f2fs: fix to disable compression on directory
  f2fs: keep inline_data when compression conversion

[@0ctobot: This omits the following problematic crypto patches:
  3dcb4bd ("ubifs: wire up FS_IOC_GET_ENCRYPTION_NONCE")
  9e24ce3 ("f2fs: wire up FS_IOC_GET_ENCRYPTION_NONCE")
  b56fd48 ("ext4: wire up FS_IOC_GET_ENCRYPTION_NONCE")
  a10564b ("fscrypt: add FS_IOC_GET_ENCRYPTION_NONCE ioctl")
  53f2446 ("fscrypt: don't evict dirty inodes after removing key")
  7c18ae3 ("fs-verity: use u64_to_user_ptr()")
  4d9ce18 ("fs-verity: use mempool for hash requests")
  18ddf07 ("fs-verity: implement readahead of Merkle tree pages")
  2ff972e ("ext4: readpages() should submit IO as read-ahead")
  693ad1e ("fs-verity: implement readahead for FS_IOC_ENABLE_VERITY")
  fe6e855 ("fscrypt: improve format of no-key names")
  7fd1c00 ("ubifs: allow both hash and disk name to be provided in no-key names")
  89aca68 ("ubifs: don't trigger assertion on invalid no-key filename")
  216d8ca ("fscrypt: clarify what is meant by a per-file key")
  7e25032 ("fscrypt: derive dirhash key for casefolded directories")
  e16d849 ("fscrypt: don't allow v1 policies with casefolding")
  0bc68c1 ("fscrypt: add "fscrypt_" prefix to fname_encrypt()")
  85b9c3e ("fscrypt: don't print name of busy file when removing key")
  9c5c8c5 ("fscrypt: document gfp_flags for bounce page allocation")
  bee5bd5 ("fscrypt: optimize fscrypt_zeroout_range()")
  1c88eea ("fscrypt: remove redundant bi_status check")
  04f5184 ("fscrypt: Allow modular crypto algorithms")
  737ae90 ("fscrypt: include <linux/ioctl.h> in UAPI header")
  8842133 ("fscrypt: don't check for ENOKEY from fscrypt_get_encryption_info()")
  b21b79d ("fscrypt: remove fscrypt_is_direct_key_policy()")
  19b132b ("fscrypt: move fscrypt_valid_enc_modes() to policy.c")
  add6ac4 ("fscrypt: check for appropriate use of DIRECT_KEY flag earlier")
  2454b5b ("fscrypt: split up fscrypt_supported_policy() by policy version")
  bfa4ca6 ("fscrypt: introduce fscrypt_needs_contents_encryption()")
  3871977 ("fscrypt: move fscrypt_d_revalidate() to fname.c")
  39a0acc ("fscrypt: constify inode parameter to filename encryption functions")
  3942229 ("fscrypt: constify struct fscrypt_hkdf parameter to fscrypt_hkdf_expand()")
  a7b6398 ("fscrypt: verify that the crypto_skcipher has the correct ivsize")
  9c1b3af ("fscrypt: use crypto_skcipher_driver_name()")
  3529026 ("fscrypt: support passing a keyring key to FS_IOC_ADD_ENCRYPTION_KEY")
  d4fdc94 ("keys: Export lookup_user_key to external users")]
Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>

Conflicts:
	Documentation/filesystems/fscrypt.rst
	fs/crypto/Kconfig
	fs/crypto/bio.c
	fs/crypto/crypto.c
	fs/crypto/fname.c
	fs/crypto/fscrypt_private.h
	fs/crypto/hkdf.c
	fs/crypto/keyring.c
	fs/crypto/keysetup.c
	fs/crypto/keysetup_v1.c
	fs/crypto/policy.c
	fs/ext4/ext4.h
	fs/ext4/ioctl.c
	fs/ext4/readpage.c
	fs/ext4/verity.c
	fs/f2fs/checkpoint.c
	fs/f2fs/compress.c
	fs/f2fs/data.c
	fs/f2fs/f2fs.h
	fs/f2fs/file.c
	fs/f2fs/gc.c
	fs/f2fs/sysfs.c
	fs/f2fs/verity.c
	fs/ubifs/dir.c
	fs/ubifs/ioctl.c
	fs/verity/enable.c
	fs/verity/fsverity_private.h
	fs/verity/hash_algs.c
	fs/verity/open.c
	fs/verity/verify.c
	include/linux/fscrypt.h
	include/linux/fsverity.h
	include/uapi/linux/fscrypt.h
  • Loading branch information
0ctobot committed Jun 8, 2020
2 parents cba435d + 3dcb4bd commit 96058cb
Show file tree
Hide file tree
Showing 25 changed files with 808 additions and 435 deletions.
5 changes: 5 additions & 0 deletions Documentation/ABI/testing/sysfs-fs-f2fs
Expand Up @@ -318,3 +318,8 @@ Date: September 2019
Contact: "Hridya Valsaraju" <hridya@google.com>
Description: Average number of valid blocks.
Available when CONFIG_F2FS_STAT_FS=y.

What: /sys/fs/f2fs/<disk>/mounted_time_sec
Date: February 2020
Contact: "Jaegeuk Kim" <jaegeuk@kernel.org>
Description: Show the mounted time in secs of this partition.
4 changes: 2 additions & 2 deletions Documentation/filesystems/f2fs.txt
Expand Up @@ -235,8 +235,8 @@ checkpoint=%s[:%u[%]] Set to "disable" to turn off checkpointing. Set to "en
hide up to all remaining free space. The actual space that
would be unusable can be viewed at /sys/fs/f2fs/<disk>/unusable
This space is reclaimed once checkpoint=enable.
compress_algorithm=%s Control compress algorithm, currently f2fs supports "lzo"
and "lz4" algorithm.
compress_algorithm=%s Control compress algorithm, currently f2fs supports "lzo",
"lz4" and "zstd" algorithm.
compress_log_size=%u Support configuring compress cluster size, the size will
be 4KB * (1 << %u), 16KB is minimum size, also it's
default size.
Expand Down
9 changes: 9 additions & 0 deletions fs/f2fs/Kconfig
Expand Up @@ -129,3 +129,12 @@ config F2FS_FS_LZ4
default y
help
Support LZ4 compress algorithm, if unsure, say Y.

config F2FS_FS_ZSTD
bool "ZSTD compression support"
depends on F2FS_FS_COMPRESSION
select ZSTD_COMPRESS
select ZSTD_DECOMPRESS
default y
help
Support ZSTD compress algorithm, if unsure, say Y.
28 changes: 11 additions & 17 deletions fs/f2fs/checkpoint.c
Expand Up @@ -50,9 +50,6 @@ struct page *f2fs_grab_meta_page(struct f2fs_sb_info *sbi, pgoff_t index)
return page;
}

/*
* We guarantee no failure on the returned page.
*/
static struct page *__get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index,
bool is_meta)
{
Expand Down Expand Up @@ -206,7 +203,7 @@ bool f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
}

/*
* Readahead CP/NAT/SIT/SSA pages
* Readahead CP/NAT/SIT/SSA/POR pages
*/
int f2fs_ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages,
int type, bool sync)
Expand Down Expand Up @@ -898,7 +895,7 @@ int f2fs_get_valid_checkpoint(struct f2fs_sb_info *sbi)
return -ENOMEM;
/*
* Finding out valid cp block involves read both
* sets( cp pack1 and cp pack 2)
* sets( cp pack 1 and cp pack 2)
*/
cp_start_blk_no = le32_to_cpu(fsb->cp_blkaddr);
cp1 = validate_checkpoint(sbi, cp_start_blk_no, &cp1_version);
Expand Down Expand Up @@ -1263,7 +1260,7 @@ void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, int type)
if (unlikely(f2fs_cp_error(sbi)))
break;

io_schedule_timeout(HZ/50);
io_schedule_timeout(DEFAULT_IO_TIMEOUT);
}
finish_wait(&sbi->cp_wait, &wait);
}
Expand Down Expand Up @@ -1301,10 +1298,14 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc)
else
__clear_ckpt_flags(ckpt, CP_ORPHAN_PRESENT_FLAG);

if (is_sbi_flag_set(sbi, SBI_NEED_FSCK) ||
is_sbi_flag_set(sbi, SBI_IS_RESIZEFS))
if (is_sbi_flag_set(sbi, SBI_NEED_FSCK))
__set_ckpt_flags(ckpt, CP_FSCK_FLAG);

if (is_sbi_flag_set(sbi, SBI_IS_RESIZEFS))
__set_ckpt_flags(ckpt, CP_RESIZEFS_FLAG);
else
__clear_ckpt_flags(ckpt, CP_RESIZEFS_FLAG);

if (is_sbi_flag_set(sbi, SBI_CP_DISABLED))
__set_ckpt_flags(ckpt, CP_DISABLED_FLAG);
else
Expand Down Expand Up @@ -1385,10 +1386,7 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
/* Flush all the NAT/SIT pages */
f2fs_sync_meta_pages(sbi, META, LONG_MAX, FS_CP_META_IO);

/*
* modify checkpoint
* version number is already updated
*/
/* start to update checkpoint, cp ver is already updated previously */
ckpt->elapsed_time = cpu_to_le64(get_mtime(sbi, true));
ckpt->free_segment_count = cpu_to_le32(free_segments(sbi));
for (i = 0; i < NR_CURSEG_NODE_TYPE; i++) {
Expand Down Expand Up @@ -1541,9 +1539,6 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
return unlikely(f2fs_cp_error(sbi)) ? -EIO : 0;
}

/*
* We guarantee that this checkpoint procedure will not fail.
*/
int f2fs_write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
{
struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);
Expand Down Expand Up @@ -1611,7 +1606,6 @@ int f2fs_write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)

f2fs_flush_sit_entries(sbi, cpc);

/* unlock all the fs_lock[] in do_checkpoint() */
err = do_checkpoint(sbi, cpc);
if (err)
f2fs_release_discard_addrs(sbi);
Expand All @@ -1624,7 +1618,7 @@ int f2fs_write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
if (cpc->reason & CP_RECOVERY)
f2fs_notice(sbi, "checkpoint: version = %llx", ckpt_ver);

/* do checkpoint periodically */
/* update CP_TIME to trigger checkpoint periodically */
f2fs_update_time(sbi, CP_TIME);
trace_f2fs_write_checkpoint(sbi->sb, cpc->reason, "finish checkpoint");
out:
Expand Down

0 comments on commit 96058cb

Please sign in to comment.