Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 047ee99d authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

Merge remote-tracking branch 'origin/upstream-f2fs-stable-linux-3.18.y' into android-3.18



Cherry-picked from origin/upstream-f2fs-stable-linux-3.18.y:

190b8267 treewide: Use array_size in f2fs_kvzalloc()
d68da142 treewide: Use array_size() in f2fs_kzalloc()
5468418c treewide: Use array_size() in f2fs_kmalloc()
b99dfff7 overflow.h: Add allocation size calculation helpers
58492de6 f2fs: fix to clear FI_VOLATILE_FILE correctly
08cf7cf4 f2fs: let sync node IO interrupt async one
5dc93797 f2fs: don't change wbc->sync_mode
2b14c4d5 f2fs: fix to update mtime correctly
1003663b fs: f2fs: insert space around that ':' and ', '
9a7fee86 fs: f2fs: add missing blank lines after declarations
b99500b3 fs: f2fs: changed variable type of offset "unsigned" to "loff_t"
b6fcfe46 f2fs: clean up symbol namespace
687046a9 f2fs: make set_de_type() static
dca849e7 f2fs: make __f2fs_write_data_pages() static
52981c8b f2fs: fix to avoid accessing cross the boundary
93b451b0 f2fs: fix to let caller retry allocating block address
85f6ff36 disable loading f2fs module on PAGE_SIZE > 4KB
20579b36 f2fs: fix error path of move_data_page
6f392e8f f2fs: don't drop dentry pages after fs shutdown
ed6e66b8 f2fs: fix to avoid race during access gc_thread pointer
d7f03212 f2fs: clean up with clear_radix_tree_dirty_tag
ffa60f34 f2fs: fix to don't trigger writeback during recovery
1dddf79a f2fs: clear discard_wake earlier
b89cb8f8 f2fs: let discard thread wait a little longer if dev is busy
07c31862 f2fs: avoid stucking GC due to atomic write
9e64b034 f2fs: introduce sbi->gc_mode to determine the policy
44759560 f2fs: keep migration IO order in LFS mode
b293719d f2fs: fix to wait page writeback during revoking atomic write
dd44aec8 f2fs: Fix deadlock in shutdown ioctl
fd36b4ba f2fs: detect synchronous writeback more earlier
767fcf33 mm: remove nr_pages argument from pagevec_lookup_{,range}_tag()
3962b4cd ceph: use pagevec_lookup_range_nr_tag()
8d4fb49e mm: add variant of pagevec_lookup_range_tag() taking number of pages
5a9fa929 mm: use pagevec_lookup_range_tag() in write_cache_pages()
027f74ce mm: use pagevec_lookup_range_tag() in __filemap_fdatawait_range()
fe9d861b nilfs2: use pagevec_lookup_range_tag()
4050363a gfs2: use pagevec_lookup_range_tag()
9b45683c f2fs: use find_get_pages_tag() for looking up single page
068903b7 f2fs: simplify page iteration loops
4b05a760 f2fs: use pagevec_lookup_range_tag()
399df387 ext4: use pagevec_lookup_range_tag()
7aceaf5c ceph: use pagevec_lookup_range_tag()
31c3bb46 btrfs: use pagevec_lookup_range_tag()
e413f9de mm: implement find_get_pages_range_tag()
c262e001 f2fs: clean up with is_valid_blkaddr()
8a0a325d f2fs: fix to initialize min_mtime with ULLONG_MAX
c9fb6742 f2fs: fix to let checkpoint guarantee atomic page persistence
be38f4be f2fs: fix to initialize i_current_depth according to inode type
9e2d8dc0 Revert "f2fs: add ovp valid_blocks check for bg gc victim to fg_gc"
5927b129 f2fs: don't drop any page on f2fs_cp_error() case
02114f51 f2fs: fix spelling mistake: "extenstion" -> "extension"
ed95774b f2fs: enhance sanity_check_raw_super() to avoid potential overflows
f85501db f2fs: treat volatile file's data as hot one
a6491e35 f2fs: introduce release_discard_addr() for cleanup
77a3dc3f f2fs: fix potential overflow
9bc9ef96 f2fs: rename dio_rwsem to i_gc_rwsem
305b2dee f2fs: move mnt_want_write_file after range check
7a01aa64 f2fs: enforce fsync_mode=strict for renamed directory
5caf80f3 f2fs: sanity check for total valid node blocks
6fcb0e12 f2fs: sanity check on sit entry
94c17928 f2fs: avoid bug_on on corrupted inode
dce5b263 f2fs: give message and set need_fsck given broken node id
bbf83779 f2fs: clean up commit_inmem_pages()
45209f0c f2fs: do not check F2FS_INLINE_DOTS in recover
b37f57bb f2fs: stop issue discard if something wrong with f2fs
520f423b f2fs: fix return value in f2fs_ioc_commit_atomic_write
7343b569 f2fs: allocate hot_data for atomic write more strictly
c6b22cb1 f2fs: check if inmem_pages list is empty correctly
78c65118 f2fs: fix race in between GC and atomic open
ae85d0b3 f2fs: change le32 to le16 of f2fs_inode->i_extra_size
f4d06493 f2fs: check cur_valid_map_mir & raw_sit block count when flush sit entries
20d4b4a4 f2fs: correct return value of f2fs_trim_fs
e21b3152 f2fs: fix to show missing bits in FS_IOC_GETFLAGS
f75ff22e f2fs: remove unneeded F2FS_PROJINHERIT_FL
b294d6aa f2fs: don't use GFP_ZERO for page caches
15cc7ac4 f2fs: issue all big range discards in umount process
64130200 f2fs: remove redundant block plug
6cea5b25 f2fs: remove unmatched zero_user_segment when convert inline dentry
82e0d107 f2fs: introduce private inode status mapping
99b3021b fscrypt: log the crypto algorithm implementations
3b217a27 fscrypt: add Speck128/256 support
fec5996d fscrypt: only derive the needed portion of the key
8d5caf0e fscrypt: separate key lookup from key derivation
1f8ab63a fscrypt: use a common logging function
a81973d8 fscrypt: remove internal key size constants
43b048de fscrypt: remove unnecessary check for non-logon key type
ee136fee fscrypt: make fscrypt_operations.max_namelen an integer
5f867d37 fscrypt: drop empty name check from fname_decrypt()
27433717 fscrypt: drop max_namelen check from fname_decrypt()
1e60d10b fscrypt: don't special-case EOPNOTSUPP from fscrypt_get_encryption_info()
5d06dc06 fscrypt: don't clear flags on crypto transform
d04f0f3c fscrypt: remove stale comment from fscrypt_d_revalidate()
3f337455 fscrypt: remove error messages for skcipher_request_alloc() failure
347264d8 fscrypt: remove unnecessary NULL check when allocating skcipher
f6b4b095 fscrypt: clean up after fscrypt_prepare_lookup() conversions
7d048c02 fscrypt: use unbound workqueue for decryption

Change-Id: I450d208bdd91419f81dc42093aae7642d1893539
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@google.com>
parents ddfd4da1 190b8267
Loading
Loading
Loading
Loading
+626 −0

File added.

Preview size limit exceeded, changes collapsed.

+5 −5
Original line number Diff line number Diff line
@@ -507,14 +507,14 @@ static int adjoin(struct dm_table *table, struct dm_target *ti)
 * On the other hand, dm-switch needs to process bulk data using messages and
 * excessive use of GFP_NOIO could cause trouble.
 */
static char **realloc_argv(unsigned *array_size, char **old_argv)
static char **realloc_argv(unsigned *size, char **old_argv)
{
	char **argv;
	unsigned new_size;
	gfp_t gfp;

	if (*array_size) {
		new_size = *array_size * 2;
	if (*size) {
		new_size = *size * 2;
		gfp = GFP_KERNEL;
	} else {
		new_size = 8;
@@ -522,8 +522,8 @@ static char **realloc_argv(unsigned *array_size, char **old_argv)
	}
	argv = kmalloc(new_size * sizeof(*argv), gfp);
	if (argv) {
		memcpy(argv, old_argv, *array_size * sizeof(*argv));
		*array_size = new_size;
		memcpy(argv, old_argv, *size * sizeof(*argv));
		*size = new_size;
	}

	kfree(old_argv);
+4 −15
Original line number Diff line number Diff line
@@ -3836,8 +3836,8 @@ retry:
	if (wbc->sync_mode == WB_SYNC_ALL)
		tag_pages_for_writeback(mapping, index, end);
	while (!done && !nr_to_write_done && (index <= end) &&
	       (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, tag,
			min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1))) {
			(nr_pages = pagevec_lookup_range_tag(&pvec, mapping,
						&index, end, tag))) {
		unsigned i;

		scanned = 1;
@@ -3847,11 +3847,6 @@ retry:
			if (!PagePrivate(page))
				continue;

			if (!wbc->range_cyclic && page->index > end) {
				done = 1;
				break;
			}

			spin_lock(&mapping->private_lock);
			if (!PagePrivate(page)) {
				spin_unlock(&mapping->private_lock);
@@ -3980,8 +3975,8 @@ retry:
	if (wbc->sync_mode == WB_SYNC_ALL)
		tag_pages_for_writeback(mapping, index, end);
	while (!done && !nr_to_write_done && (index <= end) &&
	       (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, tag,
			min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1))) {
	       (nr_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, end,
			tag))) {
		unsigned i;

		scanned = 1;
@@ -4005,12 +4000,6 @@ retry:
				continue;
			}

			if (!wbc->range_cyclic && page->index > end) {
				done = 1;
				unlock_page(page);
				continue;
			}

			if (wbc->sync_mode != WB_SYNC_NONE) {
				if (PageWriteback(page))
					flush_fn(data);
+4 −10
Original line number Diff line number Diff line
@@ -758,8 +758,7 @@ retry:
		struct page **pages = NULL;
		mempool_t *pool = NULL;	/* Becomes non-null if mempool used */
		struct page *page;
		int want;
		u64 offset, len;
		u64 offset = 0, len = 0;
		long writeback_stat;

		next = 0;
@@ -768,14 +767,9 @@ retry:

get_more_pages:
		first = -1;
		want = min(end - index,
			   min((pgoff_t)PAGEVEC_SIZE,
			       max_pages - (pgoff_t)locked_pages) - 1)
			+ 1;
		pvec_pages = pagevec_lookup_tag(&pvec, mapping, &index,
						PAGECACHE_TAG_DIRTY,
						want);
		dout("pagevec_lookup_tag got %d\n", pvec_pages);
		pvec_pages = pagevec_lookup_range_tag(&pvec, mapping, &index,
						end, PAGECACHE_TAG_DIRTY);
		dout("pagevec_lookup_range_tag got %d\n", pvec_pages);
		if (!pvec_pages && !locked_pages)
			break;
		for (i = 0; i < pvec_pages && locked_pages < max_pages; i++) {
+36 −11
Original line number Diff line number Diff line
@@ -162,12 +162,8 @@ int fscrypt_do_page_crypto(const struct inode *inode, fscrypt_direction_t rw,
	}

	req = ablkcipher_request_alloc(tfm, gfp_flags);
	if (!req) {
		printk_ratelimited(KERN_ERR
				"%s: crypto_request_alloc() failed\n",
				__func__);
	if (!req)
		return -ENOMEM;
	}

	ablkcipher_request_set_callback(
		req, CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP,
@@ -184,9 +180,10 @@ int fscrypt_do_page_crypto(const struct inode *inode, fscrypt_direction_t rw,
		res = crypto_wait_req(crypto_ablkcipher_encrypt(req), &wait);
	ablkcipher_request_free(req);
	if (res) {
		printk_ratelimited(KERN_ERR
			"%s: crypto_ablkcipher_encrypt() returned %d\n",
			__func__, res);
		fscrypt_err(inode->i_sb,
			    "%scryption failed for inode %lu, block %llu: %d",
			    (rw == FS_DECRYPT ? "de" : "en"),
			    inode->i_ino, lblk_num, res);
		return res;
	}
	return 0;
@@ -332,7 +329,6 @@ static int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags)
		return 0;
	}

	/* this should eventually be an flag in d_flags */
	spin_lock(&dentry->d_lock);
	cached_with_key = dentry->d_flags & DCACHE_ENCRYPTED_WITH_KEY;
	spin_unlock(&dentry->d_lock);
@@ -359,7 +355,6 @@ static int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags)
const struct dentry_operations fscrypt_d_ops = {
	.d_revalidate = fscrypt_d_revalidate,
};
EXPORT_SYMBOL(fscrypt_d_ops);

void fscrypt_restore_control_page(struct page *page)
{
@@ -428,13 +423,43 @@ fail:
	return res;
}

void fscrypt_msg(struct super_block *sb, const char *level,
		 const char *fmt, ...)
{
	static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL,
				      DEFAULT_RATELIMIT_BURST);
	struct va_format vaf;
	va_list args;

	if (!__ratelimit(&rs))
		return;

	va_start(args, fmt);
	vaf.fmt = fmt;
	vaf.va = &args;
	if (sb)
		printk("%sfscrypt (%s): %pV\n", level, sb->s_id, &vaf);
	else
		printk("%sfscrypt: %pV\n", level, &vaf);
	va_end(args);
}

/**
 * fscrypt_init() - Set up for fs encryption.
 */
static int __init fscrypt_init(void)
{
	/*
	 * Use an unbound workqueue to allow bios to be decrypted in parallel
	 * even when they happen to complete on the same CPU.  This sacrifices
	 * locality, but it's worthwhile since decryption is CPU-intensive.
	 *
	 * Also use a high-priority workqueue to prioritize decryption work,
	 * which blocks reads from completing, over regular application tasks.
	 */
	fscrypt_read_workqueue = alloc_workqueue("fscrypt_read_queue",
							WQ_HIGHPRI, 0);
						 WQ_UNBOUND | WQ_HIGHPRI,
						 num_online_cpus());
	if (!fscrypt_read_workqueue)
		goto fail;

Loading