Skip to content

Commit d54d35c

Browse files
committed
Merge tag 'f2fs-for-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs
Pull f2fs updates from Jaegeuk Kim: "In this round, we've mainly focused on discard, aka unmap, control along with fstrim for Android-specific usage model. In addition, we've fixed writepage flow which returned EAGAIN previously resulting in EIO of fsync(2) due to mapping's error state. In order to avoid old MM bug [1], we decided not to use __GFP_ZERO for the mapping for node and meta page caches. As always, we've cleaned up many places for future fsverity and symbol conflicts. Enhancements: - do discard/fstrim in lower priority considering fs utilization - split large discard commands into smaller ones for better responsiveness - add more sanity checks to address syzbot reports - add a mount option, fsync_mode=nobarrier, which can reduce # of cache flushes - clean up symbol namespace with modified function names - be strict on block allocation and IO control in corner cases Bug fixes: - don't use __GFP_ZERO for mappings - fix error reports in writepage to avoid fsync() failure - avoid selinux denial on CAP_RESOURCE on resgid/resuid - fix some subtle race conditions in GC/atomic writes/shutdown - fix overflow bugs in sanity_check_raw_super - fix missing bits on get_flags Clean-ups: - prepare the generic flow for future fsverity integration - fix some broken coding standard" [1] https://lkml.org/lkml/2018/4/8/661 * tag 'f2fs-for-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: (79 commits) f2fs: fix to clear FI_VOLATILE_FILE correctly f2fs: let sync node IO interrupt async one f2fs: don't change wbc->sync_mode f2fs: fix to update mtime correctly fs: f2fs: insert space around that ':' and ', ' fs: f2fs: add missing blank lines after declarations fs: f2fs: changed variable type of offset "unsigned" to "loff_t" f2fs: clean up symbol namespace f2fs: make set_de_type() static f2fs: make __f2fs_write_data_pages() static f2fs: fix to avoid accessing cross the boundary f2fs: fix to let caller retry allocating block address disable loading f2fs module on PAGE_SIZE > 4KB f2fs: fix error path of move_data_page f2fs: don't drop dentry pages after fs shutdown f2fs: fix to avoid race during access gc_thread pointer f2fs: clean up with clear_radix_tree_dirty_tag f2fs: fix to don't trigger writeback during recovery f2fs: clear discard_wake earlier f2fs: let discard thread wait a little longer if dev is busy ...
2 parents a2225d9 + dfa7428 commit d54d35c

28 files changed

Lines changed: 1880 additions & 1388 deletions

‎Documentation/ABI/testing/sysfs-fs-f2fs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ Date: February 2015
101101
Contact: "Jaegeuk Kim" <jaegeuk@kernel.org>
102102
Description:
103103
Controls the trimming rate in batch mode.
104+
<deprecated>
104105

105106
What: /sys/fs/f2fs/<disk>/cp_interval
106107
Date: October 2015
@@ -140,7 +141,7 @@ Contact: "Shuoran Liu" <liushuoran@huawei.com>
140141
Description:
141142
Shows total written kbytes issued to disk.
142143

143-
What: /sys/fs/f2fs/<disk>/feature
144+
What: /sys/fs/f2fs/<disk>/features
144145
Date: July 2017
145146
Contact: "Jaegeuk Kim" <jaegeuk@kernel.org>
146147
Description:

‎Documentation/filesystems/f2fs.txt‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,15 @@ whint_mode=%s Control which write hints are passed down to block
182182
passes down hints with its policy.
183183
alloc_mode=%s Adjust block allocation policy, which supports "reuse"
184184
and "default".
185-
fsync_mode=%s Control the policy of fsync. Currently supports "posix"
186-
and "strict". In "posix" mode, which is default, fsync
187-
will follow POSIX semantics and does a light operation
188-
to improve the filesystem performance. In "strict" mode,
189-
fsync will be heavy and behaves in line with xfs, ext4
190-
and btrfs, where xfstest generic/342 will pass, but the
191-
performance will regress.
185+
fsync_mode=%s Control the policy of fsync. Currently supports "posix",
186+
"strict", and "nobarrier". In "posix" mode, which is
187+
default, fsync will follow POSIX semantics and does a
188+
light operation to improve the filesystem performance.
189+
In "strict" mode, fsync will be heavy and behaves in line
190+
with xfs, ext4 and btrfs, where xfstest generic/342 will
191+
pass, but the performance will regress. "nobarrier" is
192+
based on "posix", but doesn't issue flush command for
193+
non-atomic files likewise "nobarrier" mount option.
192194
test_dummy_encryption Enable dummy encryption, which provides a fake fscrypt
193195
context. The fake fscrypt context is used by xfstests.
194196

‎fs/crypto/bio.c‎

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,8 @@
2626
#include <linux/namei.h>
2727
#include "fscrypt_private.h"
2828

29-
/*
30-
* Call fscrypt_decrypt_page on every single page, reusing the encryption
31-
* context.
32-
*/
33-
static void completion_pages(struct work_struct *work)
29+
static void __fscrypt_decrypt_bio(struct bio *bio, bool done)
3430
{
35-
struct fscrypt_ctx *ctx =
36-
container_of(work, struct fscrypt_ctx, r.work);
37-
struct bio *bio = ctx->r.bio;
3831
struct bio_vec *bv;
3932
int i;
4033

@@ -46,22 +39,38 @@ static void completion_pages(struct work_struct *work)
4639
if (ret) {
4740
WARN_ON_ONCE(1);
4841
SetPageError(page);
49-
} else {
42+
} else if (done) {
5043
SetPageUptodate(page);
5144
}
52-
unlock_page(page);
45+
if (done)
46+
unlock_page(page);
5347
}
48+
}
49+
50+
void fscrypt_decrypt_bio(struct bio *bio)
51+
{
52+
__fscrypt_decrypt_bio(bio, false);
53+
}
54+
EXPORT_SYMBOL(fscrypt_decrypt_bio);
55+
56+
static void completion_pages(struct work_struct *work)
57+
{
58+
struct fscrypt_ctx *ctx =
59+
container_of(work, struct fscrypt_ctx, r.work);
60+
struct bio *bio = ctx->r.bio;
61+
62+
__fscrypt_decrypt_bio(bio, true);
5463
fscrypt_release_ctx(ctx);
5564
bio_put(bio);
5665
}
5766

58-
void fscrypt_decrypt_bio_pages(struct fscrypt_ctx *ctx, struct bio *bio)
67+
void fscrypt_enqueue_decrypt_bio(struct fscrypt_ctx *ctx, struct bio *bio)
5968
{
6069
INIT_WORK(&ctx->r.work, completion_pages);
6170
ctx->r.bio = bio;
62-
queue_work(fscrypt_read_workqueue, &ctx->r.work);
71+
fscrypt_enqueue_decrypt_work(&ctx->r.work);
6372
}
64-
EXPORT_SYMBOL(fscrypt_decrypt_bio_pages);
73+
EXPORT_SYMBOL(fscrypt_enqueue_decrypt_bio);
6574

6675
void fscrypt_pullback_bio_page(struct page **page, bool restore)
6776
{

‎fs/crypto/crypto.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,18 @@ static mempool_t *fscrypt_bounce_page_pool = NULL;
4545
static LIST_HEAD(fscrypt_free_ctxs);
4646
static DEFINE_SPINLOCK(fscrypt_ctx_lock);
4747

48-
struct workqueue_struct *fscrypt_read_workqueue;
48+
static struct workqueue_struct *fscrypt_read_workqueue;
4949
static DEFINE_MUTEX(fscrypt_init_mutex);
5050

5151
static struct kmem_cache *fscrypt_ctx_cachep;
5252
struct kmem_cache *fscrypt_info_cachep;
5353

54+
void fscrypt_enqueue_decrypt_work(struct work_struct *work)
55+
{
56+
queue_work(fscrypt_read_workqueue, work);
57+
}
58+
EXPORT_SYMBOL(fscrypt_enqueue_decrypt_work);
59+
5460
/**
5561
* fscrypt_release_ctx() - Releases an encryption context
5662
* @ctx: The encryption context to release.

‎fs/crypto/fscrypt_private.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ static inline bool fscrypt_valid_enc_modes(u32 contents_mode,
9393
/* crypto.c */
9494
extern struct kmem_cache *fscrypt_info_cachep;
9595
extern int fscrypt_initialize(unsigned int cop_flags);
96-
extern struct workqueue_struct *fscrypt_read_workqueue;
9796
extern int fscrypt_do_page_crypto(const struct inode *inode,
9897
fscrypt_direction_t rw, u64 lblk_num,
9998
struct page *src_page,

‎fs/ext4/readpage.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static void mpage_end_io(struct bio *bio)
7777
if (bio->bi_status) {
7878
fscrypt_release_ctx(bio->bi_private);
7979
} else {
80-
fscrypt_decrypt_bio_pages(bio->bi_private, bio);
80+
fscrypt_enqueue_decrypt_bio(bio->bi_private, bio);
8181
return;
8282
}
8383
}

0 commit comments

Comments
 (0)