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

Commit 67f15b06 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
  Btrfs: check total number of devices when removing missing
  Btrfs: check return value of open_bdev_exclusive properly
  Btrfs: do not mark the chunk as readonly if in degraded mode
  Btrfs: run orphan cleanup on default fs root
  Btrfs: fix a memory leak in btrfs_init_acl
  Btrfs: Use correct values when updating inode i_size on fallocate
  Btrfs: remove tree_search() in extent_map.c
  Btrfs: Add mount -o compress-force
parents 94673e96 035fe03a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -244,6 +244,7 @@ int btrfs_init_acl(struct btrfs_trans_handle *trans,
						    ACL_TYPE_ACCESS);
			}
		}
		posix_acl_release(clone);
	}
failed:
	posix_acl_release(acl);
+1 −0
Original line number Diff line number Diff line
@@ -1161,6 +1161,7 @@ struct btrfs_root {
#define BTRFS_MOUNT_SSD_SPREAD		(1 << 8)
#define BTRFS_MOUNT_NOSSD		(1 << 9)
#define BTRFS_MOUNT_DISCARD		(1 << 10)
#define BTRFS_MOUNT_FORCE_COMPRESS      (1 << 11)

#define btrfs_clear_opt(o, opt)		((o) &= ~BTRFS_MOUNT_##opt)
#define btrfs_set_opt(o, opt)		((o) |= BTRFS_MOUNT_##opt)
+6 −0
Original line number Diff line number Diff line
@@ -1993,6 +1993,12 @@ struct btrfs_root *open_ctree(struct super_block *sb,
	if (!fs_info->fs_root)
		goto fail_trans_kthread;

	if (!(sb->s_flags & MS_RDONLY)) {
		down_read(&fs_info->cleanup_work_sem);
		btrfs_orphan_cleanup(fs_info->fs_root);
		up_read(&fs_info->cleanup_work_sem);
	}

	return tree_root;

fail_trans_kthread:
+0 −14
Original line number Diff line number Diff line
@@ -155,20 +155,6 @@ static struct rb_node *__tree_search(struct rb_root *root, u64 offset,
	return NULL;
}

/*
 * look for an offset in the tree, and if it can't be found, return
 * the first offset we can find smaller than 'offset'.
 */
static inline struct rb_node *tree_search(struct rb_root *root, u64 offset)
{
	struct rb_node *prev;
	struct rb_node *ret;
	ret = __tree_search(root, offset, &prev, NULL);
	if (!ret)
		return prev;
	return ret;
}

/* check to see if two extent_map structs are adjacent and safe to merge */
static int mergable_maps(struct extent_map *prev, struct extent_map *next)
{
+11 −11
Original line number Diff line number Diff line
@@ -483,6 +483,7 @@ static noinline int compress_file_range(struct inode *inode,
		nr_pages_ret = 0;

		/* flag the file so we don't compress in the future */
		if (!btrfs_test_opt(root, FORCE_COMPRESS))
			BTRFS_I(inode)->flags |= BTRFS_INODE_NOCOMPRESS;
	}
	if (will_compress) {
@@ -3796,12 +3797,6 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)

	if (location.type == BTRFS_INODE_ITEM_KEY) {
		inode = btrfs_iget(dir->i_sb, &location, root);
		if (unlikely(root->clean_orphans) &&
		    !(inode->i_sb->s_flags & MS_RDONLY)) {
			down_read(&root->fs_info->cleanup_work_sem);
			btrfs_orphan_cleanup(root);
			up_read(&root->fs_info->cleanup_work_sem);
		}
		return inode;
	}

@@ -5799,7 +5794,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
}

static int prealloc_file_range(struct inode *inode, u64 start, u64 end,
			       u64 alloc_hint, int mode)
			u64 alloc_hint, int mode, loff_t actual_len)
{
	struct btrfs_trans_handle *trans;
	struct btrfs_root *root = BTRFS_I(inode)->root;
@@ -5808,6 +5803,7 @@ static int prealloc_file_range(struct inode *inode, u64 start, u64 end,
	u64 cur_offset = start;
	u64 num_bytes = end - start;
	int ret = 0;
	u64 i_size;

	while (num_bytes > 0) {
		alloc_size = min(num_bytes, root->fs_info->max_extent);
@@ -5846,8 +5842,12 @@ static int prealloc_file_range(struct inode *inode, u64 start, u64 end,
		BTRFS_I(inode)->flags |= BTRFS_INODE_PREALLOC;
		if (!(mode & FALLOC_FL_KEEP_SIZE) &&
		    cur_offset > inode->i_size) {
			i_size_write(inode, cur_offset);
			btrfs_ordered_update_i_size(inode, cur_offset, NULL);
			if (cur_offset > actual_len)
				i_size  = actual_len;
			else
				i_size = cur_offset;
			i_size_write(inode, i_size);
			btrfs_ordered_update_i_size(inode, i_size, NULL);
		}

		ret = btrfs_update_inode(trans, root, inode);
@@ -5940,7 +5940,7 @@ static long btrfs_fallocate(struct inode *inode, int mode,
		     !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))) {
			ret = prealloc_file_range(inode,
						  cur_offset, last_byte,
						  alloc_hint, mode);
						alloc_hint, mode, offset+len);
			if (ret < 0) {
				free_extent_map(em);
				break;
Loading