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

Commit 795d580b authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
  Btrfs: add check for changed leaves in setup_leaf_for_split
  Btrfs: create snapshot references in same commit as snapshot
  Btrfs: fix small race with delalloc flushing waitqueue's
  Btrfs: use add_to_page_cache_lru, use __page_cache_alloc
  Btrfs: fix chunk allocate size calculation
  Btrfs: kill max_extent mount option
  Btrfs: fail to mount if we have problems reading the block groups
  Btrfs: check btrfs_get_extent return for IS_ERR()
  Btrfs: handle kmalloc() failure in inode lookup ioctl
  Btrfs: dereferencing freed memory
  Btrfs: Simplify num_stripes's calculation logical for __btrfs_alloc_chunk()
  Btrfs: Add error handle for btrfs_search_slot() in btrfs_read_chunk_tree()
  Btrfs: Remove unnecessary finish_wait() in wait_current_trans()
  Btrfs: add NULL check for do_walk_down()
  Btrfs: remove duplicate include in ioctl.c

Fix trivial conflict in fs/btrfs/compression.c due to slab.h include
cleanups.
parents 449cedf0 109f6aef
Loading
Loading
Loading
Loading
+4 −18
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@
#include <linux/swap.h>
#include <linux/writeback.h>
#include <linux/bit_spinlock.h>
#include <linux/pagevec.h>
#include <linux/slab.h>
#include "compat.h"
#include "ctree.h"
@@ -446,7 +445,6 @@ static noinline int add_ra_bio_pages(struct inode *inode,
	unsigned long nr_pages = 0;
	struct extent_map *em;
	struct address_space *mapping = inode->i_mapping;
	struct pagevec pvec;
	struct extent_map_tree *em_tree;
	struct extent_io_tree *tree;
	u64 end;
@@ -462,7 +460,6 @@ static noinline int add_ra_bio_pages(struct inode *inode,

	end_index = (i_size_read(inode) - 1) >> PAGE_CACHE_SHIFT;

	pagevec_init(&pvec, 0);
	while (last_offset < compressed_end) {
		page_index = last_offset >> PAGE_CACHE_SHIFT;

@@ -479,26 +476,17 @@ static noinline int add_ra_bio_pages(struct inode *inode,
			goto next;
		}

		page = alloc_page(mapping_gfp_mask(mapping) & ~__GFP_FS);
		page = __page_cache_alloc(mapping_gfp_mask(mapping) &
								~__GFP_FS);
		if (!page)
			break;

		page->index = page_index;
		/*
		 * what we want to do here is call add_to_page_cache_lru,
		 * but that isn't exported, so we reproduce it here
		 */
		if (add_to_page_cache(page, mapping,
				      page->index, GFP_NOFS)) {
		if (add_to_page_cache_lru(page, mapping, page_index,
								GFP_NOFS)) {
			page_cache_release(page);
			goto next;
		}

		/* open coding of lru_cache_add, also not exported */
		page_cache_get(page);
		if (!pagevec_add(&pvec, page))
			__pagevec_lru_add_file(&pvec);

		end = last_offset + PAGE_CACHE_SIZE - 1;
		/*
		 * at this point, we have a locked page in the page cache
@@ -552,8 +540,6 @@ static noinline int add_ra_bio_pages(struct inode *inode,
next:
		last_offset += PAGE_CACHE_SIZE;
	}
	if (pagevec_count(&pvec))
		__pagevec_lru_add_file(&pvec);
	return 0;
}

+4 −0
Original line number Diff line number Diff line
@@ -3041,6 +3041,10 @@ static noinline int setup_leaf_for_split(struct btrfs_trans_handle *trans,
	if (ret > 0 || item_size != btrfs_item_size_nr(leaf, path->slots[0]))
		goto err;

	/* the leaf has  changed, it now has room.  return now */
	if (btrfs_leaf_free_space(root, path->nodes[0]) >= ins_len)
		goto err;

	if (key.type == BTRFS_EXTENT_DATA_KEY) {
		fi = btrfs_item_ptr(leaf, path->slots[0],
				    struct btrfs_file_extent_item);
+0 −1
Original line number Diff line number Diff line
@@ -835,7 +835,6 @@ struct btrfs_fs_info {
	u64 last_trans_log_full_commit;
	u64 open_ioctl_trans;
	unsigned long mount_opt;
	u64 max_extent;
	u64 max_inline;
	u64 alloc_start;
	struct btrfs_transaction *running_transaction;
+8 −4
Original line number Diff line number Diff line
@@ -1635,7 +1635,6 @@ struct btrfs_root *open_ctree(struct super_block *sb,
	atomic_set(&fs_info->async_submit_draining, 0);
	atomic_set(&fs_info->nr_async_bios, 0);
	fs_info->sb = sb;
	fs_info->max_extent = (u64)-1;
	fs_info->max_inline = 8192 * 1024;
	fs_info->metadata_ratio = 0;

@@ -1923,7 +1922,11 @@ struct btrfs_root *open_ctree(struct super_block *sb,

	csum_root->track_dirty = 1;

	btrfs_read_block_groups(extent_root);
	ret = btrfs_read_block_groups(extent_root);
	if (ret) {
		printk(KERN_ERR "Failed to read block groups: %d\n", ret);
		goto fail_block_groups;
	}

	fs_info->generation = generation;
	fs_info->last_trans_committed = generation;
@@ -1933,7 +1936,7 @@ struct btrfs_root *open_ctree(struct super_block *sb,
	fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root,
					       "btrfs-cleaner");
	if (IS_ERR(fs_info->cleaner_kthread))
		goto fail_csum_root;
		goto fail_block_groups;

	fs_info->transaction_kthread = kthread_run(transaction_kthread,
						   tree_root,
@@ -2021,7 +2024,8 @@ fail_cleaner:
	filemap_write_and_wait(fs_info->btree_inode->i_mapping);
	invalidate_inode_pages2(fs_info->btree_inode->i_mapping);

fail_csum_root:
fail_block_groups:
	btrfs_free_block_groups(fs_info);
	free_extent_buffer(csum_root->node);
	free_extent_buffer(csum_root->commit_root);
fail_dev_root:
+14 −9
Original line number Diff line number Diff line
@@ -2677,6 +2677,8 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags,

	INIT_LIST_HEAD(&found->block_groups);
	init_rwsem(&found->groups_sem);
	init_waitqueue_head(&found->flush_wait);
	init_waitqueue_head(&found->allocate_wait);
	spin_lock_init(&found->lock);
	found->flags = flags;
	found->total_bytes = total_bytes;
@@ -2847,7 +2849,7 @@ int btrfs_unreserve_metadata_for_delalloc(struct btrfs_root *root,
	}
	spin_unlock(&BTRFS_I(inode)->accounting_lock);

	BTRFS_I(inode)->reserved_extents--;
	BTRFS_I(inode)->reserved_extents -= num_items;
	BUG_ON(BTRFS_I(inode)->reserved_extents < 0);

	if (meta_sinfo->bytes_delalloc < num_bytes) {
@@ -2945,12 +2947,10 @@ static void flush_delalloc(struct btrfs_root *root,

	spin_lock(&info->lock);

	if (!info->flushing) {
	if (!info->flushing)
		info->flushing = 1;
		init_waitqueue_head(&info->flush_wait);
	} else {
	else
		wait = true;
	}

	spin_unlock(&info->lock);

@@ -3012,7 +3012,6 @@ static int maybe_allocate_chunk(struct btrfs_root *root,
	if (!info->allocating_chunk) {
		info->force_alloc = 1;
		info->allocating_chunk = 1;
		init_waitqueue_head(&info->allocate_wait);
	} else {
		wait = true;
	}
@@ -3112,7 +3111,7 @@ again:
		return -ENOSPC;
	}

	BTRFS_I(inode)->reserved_extents++;
	BTRFS_I(inode)->reserved_extents += num_items;
	check_force_delalloc(meta_sinfo);
	spin_unlock(&meta_sinfo->lock);

@@ -4171,6 +4170,10 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
	ins->offset = 0;

	space_info = __find_space_info(root->fs_info, data);
	if (!space_info) {
		printk(KERN_ERR "No space info for %d\n", data);
		return -ENOSPC;
	}

	if (orig_root->ref_cows || empty_size)
		allowed_chunk_alloc = 1;
@@ -5206,6 +5209,8 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans,
	next = btrfs_find_tree_block(root, bytenr, blocksize);
	if (!next) {
		next = btrfs_find_create_tree_block(root, bytenr, blocksize);
		if (!next)
			return -ENOMEM;
		reada = 1;
	}
	btrfs_tree_lock(next);
@@ -5418,7 +5423,8 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans,
		if (ret > 0) {
			path->slots[level]++;
			continue;
		}
		} else if (ret < 0)
			return ret;
		level = wc->level;
	}
	return 0;
@@ -7370,7 +7376,6 @@ static int find_first_block_group(struct btrfs_root *root,
		}
		path->slots[0]++;
	}
	ret = -ENOENT;
out:
	return ret;
}
Loading