Commit 94514bbe authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull btrfs updates from David Sterba:
 "There are a several user visible changes, the rest is mostly invisible
  and continues to clean up the whole code base.

  User visible changes:
   - new mount option nossd_spread (pair for ssd_spread)

   - mount option subvolid will detect junk after the number and fail
     the mount

   - add message after cancelled device replace

   - direct module dependency on libcrc32, removed own crc wrappers

   - removed user space transaction ioctls

   - use lighter locking when reading /proc/self/mounts, RCU instead of
     mutex to avoid unnecessary contention

  Enhancements:
   - skip writeback of last page when truncating file to same size

   - send: do not issue unnecessary truncate operations

   - mount option token specifiers: use %u for unsigned values, more
     validation

   - selftests: more tree block validations

  qgroups:
   - preparatory work for splitting reservation types for data and
     metadata, this should allow for more accurate tracking and fix some
     issues with underflows or do further enhancements

   - split metadata reservations for started and joined transaction so
     they do not get mixed up and are accounted correctly at commit time

   - with the above, it's possible to revert patch that potentially
     deadlocks when trying to make more space by explicitly committing
     when the quota limit is hit

   - fix root item corruption when multiple same source snapshots are
     created with quota enabled

  RAID56:
   - make sure target is identical to source when raid56 rebuild fails
     after dev-replace

   - faster rebuild during scrub, batch by stripes and not
     block-by-block

   - make more use of cached data when rebuilding from a missing device

  Fixes:
   - null pointer deref when device replace target is missing

   - fix fsync after hole punching when using no-holes feature

   - fix lockdep splat when allocating percpu data with wrong GFP flags

  Cleanups, refactoring, core changes:
   - drop redunant parameters from various functions

   - kill and opencode trivial helpers

   - __cold/__exit function annotations

   - dead code removal

   - continued audit and documentation of memory barriers

   - error handling: handle removal from uuid tree

   - error handling: remove handling of impossible condtitons

   - more debugging or error messages

   - updated tracepoints

   - one VLA use removal (and one still left)"

* tag 'for-4.17-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: (164 commits)
  btrfs: lift errors from add_extent_changeset to the callers
  Btrfs: print error messages when failing to read trees
  btrfs: user proper type for btrfs_mask_flags flags
  btrfs: split dev-replace locking helpers for read and write
  btrfs: remove stale comments about fs_mutex
  btrfs: use RCU in btrfs_show_devname for device list traversal
  btrfs: update barrier in should_cow_block
  btrfs: use lockdep_assert_held for mutexes
  btrfs: use lockdep_assert_held for spinlocks
  btrfs: Validate child tree block's level and first key
  btrfs: tests/qgroup: Fix wrong tree backref level
  Btrfs: fix copy_items() return value when logging an inode
  Btrfs: fix fsync after hole punching when using no-holes feature
  btrfs: use helper to set ulist aux from a qgroup
  Revert "btrfs: qgroups: Retry after commit on getting EDQUOT"
  btrfs: qgroup: Update trace events for metadata reservation
  btrfs: qgroup: Use root::qgroup_meta_rsv_* to record qgroup meta reserved space
  btrfs: delayed-inode: Use new qgroup meta rsv for delayed inode and item
  btrfs: qgroup: Use separate meta reservation type for delalloc
  btrfs: qgroup: Introduce function to convert META_PREALLOC into META_PERTRANS
  ...
parents 547c43d7 57599c7e
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
config BTRFS_FS
config BTRFS_FS
	tristate "Btrfs filesystem support"
	tristate "Btrfs filesystem support"
	select CRYPTO
	select LIBCRC32C
	select CRYPTO_CRC32C
	select ZLIB_INFLATE
	select ZLIB_INFLATE
	select ZLIB_DEFLATE
	select ZLIB_DEFLATE
	select LZO_COMPRESS
	select LZO_COMPRESS
+1 −1
Original line number Original line Diff line number Diff line
@@ -10,7 +10,7 @@ btrfs-y += super.o ctree.o extent-tree.o print-tree.o root-tree.o dir-item.o \
	   export.o tree-log.o free-space-cache.o zlib.o lzo.o zstd.o \
	   export.o tree-log.o free-space-cache.o zlib.o lzo.o zstd.o \
	   compression.o delayed-ref.o relocation.o delayed-inode.o scrub.o \
	   compression.o delayed-ref.o relocation.o delayed-inode.o scrub.o \
	   reada.o backref.o ulist.o qgroup.o send.o dev-replace.o raid56.o \
	   reada.o backref.o ulist.o qgroup.o send.o dev-replace.o raid56.o \
	   uuid-tree.o props.o hash.o free-space-tree.o tree-checker.o
	   uuid-tree.o props.o free-space-tree.o tree-checker.o


btrfs-$(CONFIG_BTRFS_FS_POSIX_ACL) += acl.o
btrfs-$(CONFIG_BTRFS_FS_POSIX_ACL) += acl.o
btrfs-$(CONFIG_BTRFS_FS_CHECK_INTEGRITY) += check-integrity.o
btrfs-$(CONFIG_BTRFS_FS_CHECK_INTEGRITY) += check-integrity.o
+3 −11
Original line number Original line Diff line number Diff line
@@ -46,12 +46,12 @@ struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
		BUG();
		BUG();
	}
	}


	size = __btrfs_getxattr(inode, name, "", 0);
	size = btrfs_getxattr(inode, name, "", 0);
	if (size > 0) {
	if (size > 0) {
		value = kzalloc(size, GFP_KERNEL);
		value = kzalloc(size, GFP_KERNEL);
		if (!value)
		if (!value)
			return ERR_PTR(-ENOMEM);
			return ERR_PTR(-ENOMEM);
		size = __btrfs_getxattr(inode, name, value, size);
		size = btrfs_getxattr(inode, name, value, size);
	}
	}
	if (size > 0) {
	if (size > 0) {
		acl = posix_acl_from_xattr(&init_user_ns, value, size);
		acl = posix_acl_from_xattr(&init_user_ns, value, size);
@@ -65,9 +65,6 @@ struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
	return acl;
	return acl;
}
}


/*
 * Needs to be called with fs_mutex held
 */
static int __btrfs_set_acl(struct btrfs_trans_handle *trans,
static int __btrfs_set_acl(struct btrfs_trans_handle *trans,
			 struct inode *inode, struct posix_acl *acl, int type)
			 struct inode *inode, struct posix_acl *acl, int type)
{
{
@@ -101,7 +98,7 @@ static int __btrfs_set_acl(struct btrfs_trans_handle *trans,
			goto out;
			goto out;
	}
	}


	ret = __btrfs_setxattr(trans, inode, name, value, size, 0);
	ret = btrfs_setxattr(trans, inode, name, value, size, 0);
out:
out:
	kfree(value);
	kfree(value);


@@ -127,11 +124,6 @@ int btrfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
	return ret;
	return ret;
}
}


/*
 * btrfs_init_acl is already generally called under fs_mutex, so the locking
 * stuff has been fixed to work with that.  If the locking stuff changes, we
 * need to re-evaluate the acl locking stuff.
 */
int btrfs_init_acl(struct btrfs_trans_handle *trans,
int btrfs_init_acl(struct btrfs_trans_handle *trans,
		   struct inode *inode, struct inode *dir)
		   struct inode *inode, struct inode *dir)
{
{
+6 −7
Original line number Original line Diff line number Diff line
@@ -170,7 +170,7 @@ int __init btrfs_prelim_ref_init(void)
	return 0;
	return 0;
}
}


void btrfs_prelim_ref_exit(void)
void __cold btrfs_prelim_ref_exit(void)
{
{
	kmem_cache_destroy(btrfs_prelim_ref_cache);
	kmem_cache_destroy(btrfs_prelim_ref_cache);
}
}
@@ -738,7 +738,8 @@ static int add_missing_keys(struct btrfs_fs_info *fs_info,
		BUG_ON(ref->key_for_search.type);
		BUG_ON(ref->key_for_search.type);
		BUG_ON(!ref->wanted_disk_byte);
		BUG_ON(!ref->wanted_disk_byte);


		eb = read_tree_block(fs_info, ref->wanted_disk_byte, 0);
		eb = read_tree_block(fs_info, ref->wanted_disk_byte, 0,
				     ref->level - 1, NULL);
		if (IS_ERR(eb)) {
		if (IS_ERR(eb)) {
			free_pref(ref);
			free_pref(ref);
			return PTR_ERR(eb);
			return PTR_ERR(eb);
@@ -773,15 +774,12 @@ static int add_delayed_refs(const struct btrfs_fs_info *fs_info,
	struct btrfs_delayed_extent_op *extent_op = head->extent_op;
	struct btrfs_delayed_extent_op *extent_op = head->extent_op;
	struct btrfs_key key;
	struct btrfs_key key;
	struct btrfs_key tmp_op_key;
	struct btrfs_key tmp_op_key;
	struct btrfs_key *op_key = NULL;
	struct rb_node *n;
	struct rb_node *n;
	int count;
	int count;
	int ret = 0;
	int ret = 0;


	if (extent_op && extent_op->update_key) {
	if (extent_op && extent_op->update_key)
		btrfs_disk_key_to_cpu(&tmp_op_key, &extent_op->key);
		btrfs_disk_key_to_cpu(&tmp_op_key, &extent_op->key);
		op_key = &tmp_op_key;
	}


	spin_lock(&head->lock);
	spin_lock(&head->lock);
	for (n = rb_first(&head->ref_tree); n; n = rb_next(n)) {
	for (n = rb_first(&head->ref_tree); n; n = rb_next(n)) {
@@ -1291,7 +1289,8 @@ again:
			    ref->level == 0) {
			    ref->level == 0) {
				struct extent_buffer *eb;
				struct extent_buffer *eb;


				eb = read_tree_block(fs_info, ref->parent, 0);
				eb = read_tree_block(fs_info, ref->parent, 0,
						     ref->level, NULL);
				if (IS_ERR(eb)) {
				if (IS_ERR(eb)) {
					ret = PTR_ERR(eb);
					ret = PTR_ERR(eb);
					goto out;
					goto out;
+1 −1
Original line number Original line Diff line number Diff line
@@ -73,7 +73,7 @@ int btrfs_find_one_extref(struct btrfs_root *root, u64 inode_objectid,
int btrfs_check_shared(struct btrfs_root *root, u64 inum, u64 bytenr);
int btrfs_check_shared(struct btrfs_root *root, u64 inum, u64 bytenr);


int __init btrfs_prelim_ref_init(void);
int __init btrfs_prelim_ref_init(void);
void btrfs_prelim_ref_exit(void);
void __cold btrfs_prelim_ref_exit(void);


struct prelim_ref {
struct prelim_ref {
	struct rb_node rbnode;
	struct rb_node rbnode;
Loading