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

Commit 3aeb58ab authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull btrfs update frm Chris Mason:
 "This is our usual merge window set of bug fixes, performance
  improvements and cleanups.  Miao Xie has some really nice
  optimizations for writeback.

  Josef also expanded our sanity checks quite a bit; these make up a big
  chunk of the new lines"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: (98 commits)
  Btrfs: rename btrfs_start_all_delalloc_inodes
  Btrfs: don't wait for the completion of all the ordered extents
  Btrfs: don't wait for all the async delalloc when shrinking delalloc
  Btrfs: fix the confusion between delalloc bytes and metadata bytes
  Btrfs: pick up the code for the item number calculation in flush_space()
  Btrfs: wait for the ordered extent only when we want
  Btrfs: remove unnecessary initialization and memory barrior in shrink_delalloc()
  Btrfs: avoid unnecessary scrub workers allocation
  Btrfs: check file extent type before anything else
  btrfs: Remove useless variable in write_ctree_super()
  btrfs: Fix checkpatch.pl warning of spacing issues
  btrfs: Replace kmalloc with kmalloc_array
  btrfs: Enclose macros with complex values within parenthesis
  btrfs: Use WARN_ON()'s return value in place of WARN_ON(1)
  btrfs: Remove redundant local zero structure
  btrfs: Pack struct btrfs_device
  btrfs: Replace multiple atomic_inc() with atomic_add()
  btrfs: Add helper function for free_root_pointers()
  Btrfs: fix a crash when running balance and defrag concurrently
  Btrfs: do not run snapshot-aware defragment on error
  ...
parents 4fbf888a 91aef86f
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -14,4 +14,6 @@ btrfs-y += super.o ctree.o extent-tree.o print-tree.o root-tree.o dir-item.o \
btrfs-$(CONFIG_BTRFS_FS_POSIX_ACL) += acl.o
btrfs-$(CONFIG_BTRFS_FS_CHECK_INTEGRITY) += check-integrity.o

btrfs-$(CONFIG_BTRFS_FS_RUN_SANITY_TESTS) += tests/free-space-tests.o
btrfs-$(CONFIG_BTRFS_FS_RUN_SANITY_TESTS) += tests/free-space-tests.o \
	tests/extent-buffer-tests.o tests/btrfs-tests.o \
	tests/extent-io-tests.o tests/inode-tests.o
+1 −1
Original line number Diff line number Diff line
@@ -229,7 +229,7 @@ int btrfs_init_acl(struct btrfs_trans_handle *trans,
		if (ret > 0) {
			/* we need an acl */
			ret = btrfs_set_acl(trans, inode, acl, ACL_TYPE_ACCESS);
		} else {
		} else if (ret < 0) {
			cache_no_acl(inode);
		}
	} else {
+5 −3
Original line number Diff line number Diff line
@@ -185,6 +185,9 @@ static int __add_prelim_ref(struct list_head *head, u64 root_id,
{
	struct __prelim_ref *ref;

	if (root_id == BTRFS_DATA_RELOC_TREE_OBJECTID)
		return 0;

	ref = kmem_cache_alloc(btrfs_prelim_ref_cache, gfp_mask);
	if (!ref)
		return -ENOMEM;
@@ -323,8 +326,7 @@ static int __resolve_indirect_ref(struct btrfs_fs_info *fs_info,

	eb = path->nodes[level];
	while (!eb) {
		if (!level) {
			WARN_ON(1);
		if (WARN_ON(!level)) {
			ret = 1;
			goto out;
		}
@@ -1619,7 +1621,7 @@ static int iterate_inode_refs(u64 inum, struct btrfs_root *fs_root,
		btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK);
		btrfs_release_path(path);

		item = btrfs_item_nr(eb, slot);
		item = btrfs_item_nr(slot);
		iref = btrfs_item_ptr(eb, slot, struct btrfs_inode_ref);

		for (cur = 0; cur < btrfs_item_size(eb, item); cur += len) {
+20 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#ifndef __BTRFS_I__
#define __BTRFS_I__

#include <linux/hash.h>
#include "extent_map.h"
#include "extent_io.h"
#include "ordered-data.h"
@@ -179,6 +180,25 @@ static inline struct btrfs_inode *BTRFS_I(struct inode *inode)
	return container_of(inode, struct btrfs_inode, vfs_inode);
}

static inline unsigned long btrfs_inode_hash(u64 objectid,
					     const struct btrfs_root *root)
{
	u64 h = objectid ^ (root->objectid * GOLDEN_RATIO_PRIME);

#if BITS_PER_LONG == 32
	h = (h >> 32) ^ (h & 0xffffffff);
#endif

	return (unsigned long)h;
}

static inline void btrfs_insert_inode_hash(struct inode *inode)
{
	unsigned long h = btrfs_inode_hash(inode->i_ino, BTRFS_I(inode)->root);

	__insert_inode_hash(inode, h);
}

static inline u64 btrfs_ino(struct inode *inode)
{
	u64 ino = BTRFS_I(inode)->location.objectid;
+8 −10
Original line number Diff line number Diff line
@@ -1038,7 +1038,7 @@ leaf_item_out_of_bounce_error:
						     disk_item_offset,
						     sizeof(struct btrfs_item));
			item_offset = btrfs_stack_item_offset(&disk_item);
			item_size = btrfs_stack_item_offset(&disk_item);
			item_size = btrfs_stack_item_size(&disk_item);
			disk_key = &disk_item.key;
			type = btrfs_disk_key_type(disk_key);

@@ -1900,7 +1900,9 @@ again:
							       dev_state,
							       dev_bytenr);
			}
			if (block->logical_bytenr != bytenr) {
			if (block->logical_bytenr != bytenr &&
			    !(!block->is_metadata &&
			      block->logical_bytenr == 0))
				printk(KERN_INFO
				       "Written block @%llu (%s/%llu/%d)"
				       " found in hash table, %c,"
@@ -1910,15 +1912,14 @@ again:
				       block->mirror_num,
				       btrfsic_get_block_type(state, block),
				       block->logical_bytenr);
				block->logical_bytenr = bytenr;
			} else if (state->print_mask &
				   BTRFSIC_PRINT_MASK_VERBOSE)
			else if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE)
				printk(KERN_INFO
				       "Written block @%llu (%s/%llu/%d)"
				       " found in hash table, %c.\n",
				       bytenr, dev_state->name, dev_bytenr,
				       block->mirror_num,
				       btrfsic_get_block_type(state, block));
			block->logical_bytenr = bytenr;
		} else {
			if (num_pages * PAGE_CACHE_SIZE <
			    state->datablock_size) {
@@ -2463,10 +2464,8 @@ static int btrfsic_process_written_superblock(
		}
	}

	if (-1 == btrfsic_check_all_ref_blocks(state, superblock, 0)) {
		WARN_ON(1);
	if (WARN_ON(-1 == btrfsic_check_all_ref_blocks(state, superblock, 0)))
		btrfsic_dump_tree(state);
	}

	return 0;
}
@@ -2906,7 +2905,7 @@ static void btrfsic_cmp_log_and_dev_bytenr(struct btrfsic_state *state,
		btrfsic_release_block_ctx(&block_ctx);
	}

	if (!match) {
	if (WARN_ON(!match)) {
		printk(KERN_INFO "btrfs: attempt to write M-block which contains logical bytenr that doesn't map to dev+physical bytenr of submit_bio,"
		       " buffer->log_bytenr=%llu, submit_bio(bdev=%s,"
		       " phys_bytenr=%llu)!\n",
@@ -2923,7 +2922,6 @@ static void btrfsic_cmp_log_and_dev_bytenr(struct btrfsic_state *state,
			       bytenr, block_ctx.dev->name,
			       block_ctx.dev_bytenr, mirror_num);
		}
		WARN_ON(1);
	}
}

Loading