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

Commit 90e7a900 authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

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



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

f950fa48 treewide: Use array_size in f2fs_kvzalloc()
61f48646 treewide: Use array_size() in f2fs_kzalloc()
c4eb50da treewide: Use array_size() in f2fs_kmalloc()
96a23292 overflow.h: Add allocation size calculation helpers
9a857bde f2fs: fix to clear FI_VOLATILE_FILE correctly
deb78d4c f2fs: let sync node IO interrupt async one
7507ad25 f2fs: don't change wbc->sync_mode
accb4064 f2fs: fix to update mtime correctly
6285d972 fs: f2fs: insert space around that ':' and ', '
9ef10313 fs: f2fs: add missing blank lines after declarations
ee62ea28 fs: f2fs: changed variable type of offset "unsigned" to "loff_t"
6b4d6a81 f2fs: clean up symbol namespace
6de81c8d f2fs: make set_de_type() static
fdd569a7 f2fs: make __f2fs_write_data_pages() static
48fa5343 f2fs: fix to avoid accessing cross the boundary
34880e00 f2fs: fix to let caller retry allocating block address
8c469651 disable loading f2fs module on PAGE_SIZE > 4KB
408285a4 f2fs: fix error path of move_data_page
9780d68d f2fs: don't drop dentry pages after fs shutdown
b9921f02 f2fs: fix to avoid race during access gc_thread pointer
bcbcda43 f2fs: clean up with clear_radix_tree_dirty_tag
4636af96 f2fs: fix to don't trigger writeback during recovery
5bc68f30 f2fs: clear discard_wake earlier
8d74ddc1 f2fs: let discard thread wait a little longer if dev is busy
caf10c6f f2fs: avoid stucking GC due to atomic write
0390d83f f2fs: introduce sbi->gc_mode to determine the policy
bbab2dcb f2fs: keep migration IO order in LFS mode
2f7e488b f2fs: fix to wait page writeback during revoking atomic write
664de599 f2fs: Fix deadlock in shutdown ioctl
458e47f3 f2fs: detect synchronous writeback more earlier
4d93a43d mm: remove nr_pages argument from pagevec_lookup_{,range}_tag()
12034c75 ceph: use pagevec_lookup_range_nr_tag()
565d7441 mm: add variant of pagevec_lookup_range_tag() taking number of pages
bef1c391 mm: use pagevec_lookup_range_tag() in write_cache_pages()
7e95dd50 mm: use pagevec_lookup_range_tag() in __filemap_fdatawait_range()
88c6c1f2 nilfs2: use pagevec_lookup_range_tag()
aa70b701 gfs2: use pagevec_lookup_range_tag()
c4464307 f2fs: use find_get_pages_tag() for looking up single page
45ec63b2 f2fs: simplify page iteration loops
e0673658 f2fs: use pagevec_lookup_range_tag()
d7a592f6 ext4: use pagevec_lookup_range_tag()
b4331516 ceph: use pagevec_lookup_range_tag()
e286666c btrfs: use pagevec_lookup_range_tag()
fb296a23 mm: implement find_get_pages_range_tag()
158d9bbb f2fs: clean up with is_valid_blkaddr()
20893172 f2fs: fix to initialize min_mtime with ULLONG_MAX
a301e761 f2fs: fix to let checkpoint guarantee atomic page persistence
2d96ad5b f2fs: fix to initialize i_current_depth according to inode type
6b7c7b41 Revert "f2fs: add ovp valid_blocks check for bg gc victim to fg_gc"
04fa5dce f2fs: don't drop any page on f2fs_cp_error() case
0aca14fc f2fs: fix spelling mistake: "extenstion" -> "extension"
6abb0338 f2fs: enhance sanity_check_raw_super() to avoid potential overflows
f921fa84 f2fs: treat volatile file's data as hot one
a2cbd9b5 f2fs: introduce release_discard_addr() for cleanup
54f43787 f2fs: fix potential overflow
f6bd7d45 f2fs: rename dio_rwsem to i_gc_rwsem
48698e46 f2fs: move mnt_want_write_file after range check
707f7ae7 f2fs: fix missing clear FI_NO_PREALLOC in some error case
d487b158 f2fs: enforce fsync_mode=strict for renamed directory
1c7d5f02 f2fs: sanity check for total valid node blocks
0f0b18ad f2fs: sanity check on sit entry
60143bfd f2fs: avoid bug_on on corrupted inode
b733d017 f2fs: give message and set need_fsck given broken node id
0b4d0d03 f2fs: clean up commit_inmem_pages()
80ee152c f2fs: do not check F2FS_INLINE_DOTS in recover
78d089f5 f2fs: remove duplicated dquot_initialize and fix error handling
198f637c f2fs: stop issue discard if something wrong with f2fs
2f903ef9 f2fs: fix return value in f2fs_ioc_commit_atomic_write
5bdfc7ee f2fs: allocate hot_data for atomic write more strictly
51ad1795 f2fs: check if inmem_pages list is empty correctly
72823f4c f2fs: fix race in between GC and atomic open
97d0c4e7 f2fs: change le32 to le16 of f2fs_inode->i_extra_size
5a60d4cd f2fs: check cur_valid_map_mir & raw_sit block count when flush sit entries
aa8b4b99 f2fs: correct return value of f2fs_trim_fs
03a22433 f2fs: fix to show missing bits in FS_IOC_GETFLAGS
a0bbb362 f2fs: remove unneeded F2FS_PROJINHERIT_FL
7aee058b f2fs: don't use GFP_ZERO for page caches
addb448b f2fs: issue all big range discards in umount process
dc93e586 f2fs: remove redundant block plug
d1aee08a f2fs: remove unmatched zero_user_segment when convert inline dentry
9bafde62 f2fs: introduce private inode status mapping
a4842a18 fscrypt: log the crypto algorithm implementations
c16d27eb fscrypt: add Speck128/256 support
08ac7224 fscrypt: only derive the needed portion of the key
24cc7a8c fscrypt: separate key lookup from key derivation
78275d80 fscrypt: use a common logging function
56733c62 fscrypt: remove internal key size constants
9add02d5 fscrypt: remove unnecessary check for non-logon key type
4ddc3a80 fscrypt: make fscrypt_operations.max_namelen an integer
6cf4ea2a fscrypt: drop empty name check from fname_decrypt()
e2a57840 fscrypt: drop max_namelen check from fname_decrypt()
d3679390 fscrypt: don't special-case EOPNOTSUPP from fscrypt_get_encryption_info()
1cfd1582 fscrypt: don't clear flags on crypto transform
cfd1d7ba fscrypt: remove stale comment from fscrypt_d_revalidate()
1e04ac8a fscrypt: remove error messages for skcipher_request_alloc() failure
c6b42b9b fscrypt: remove unnecessary NULL check when allocating skcipher
3866025c fscrypt: clean up after fscrypt_prepare_lookup() conversions
b711ad8a ext4: switch to fscrypt_prepare_lookup()
f9866deb fscrypt: use unbound workqueue for decryption

Change-Id: Ia9a47ef30e9e47c4c3e1e9e91e37ae1dc018384f
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@google.com>
parents 8956c50b f950fa48
Loading
Loading
Loading
Loading
+626 −0

File added.

Preview size limit exceeded, changes collapsed.

+5 −5
Original line number Diff line number Diff line
@@ -511,14 +511,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;
@@ -526,8 +526,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
@@ -3830,8 +3830,8 @@ int btree_write_cache_pages(struct address_space *mapping,
	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;
@@ -3841,11 +3841,6 @@ int btree_write_cache_pages(struct address_space *mapping,
			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);
@@ -3978,8 +3973,8 @@ static int extent_write_cache_pages(struct extent_io_tree *tree,
		tag_pages_for_writeback(mapping, index, end);
	done_index = index;
	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;
@@ -4004,12 +3999,6 @@ static int extent_write_cache_pages(struct extent_io_tree *tree,
				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);
+3 −15
Original line number Diff line number Diff line
@@ -838,21 +838,15 @@ static int ceph_writepages_start(struct address_space *mapping,
		struct page **pages = NULL, **data_pages;
		mempool_t *pool = NULL;	/* Becomes non-null if mempool used */
		struct page *page;
		int want;
		u64 offset = 0, len = 0;

		max_pages = max_pages_ever;

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++) {
@@ -870,12 +864,6 @@ static int ceph_writepages_start(struct address_space *mapping,
				unlock_page(page);
				break;
			}
			if (!wbc->range_cyclic && page->index > end) {
				dout("end of range %p\n", page);
				done = 1;
				unlock_page(page);
				break;
			}
			if (strip_unit_end && (page->index > strip_unit_end)) {
				dout("end of strip unit %p\n", page);
				unlock_page(page);
+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 = skcipher_request_alloc(tfm, gfp_flags);
	if (!req) {
		printk_ratelimited(KERN_ERR
				"%s: crypto_request_alloc() failed\n",
				__func__);
	if (!req)
		return -ENOMEM;
	}

	skcipher_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_skcipher_encrypt(req), &wait);
	skcipher_request_free(req);
	if (res) {
		printk_ratelimited(KERN_ERR
			"%s: crypto_skcipher_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 @@ int fscrypt_initialize(unsigned int cop_flags)
	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