Skip to content

Commit

Permalink
Merge branch 'cleanups-post-3.19' of git://git.kernel.org/pub/scm/lin…
Browse files Browse the repository at this point in the history
…ux/kernel/git/kdave/linux into for-linus-4.1

Signed-off-by: Chris Mason <clm@fb.com>

Conflicts:
	fs/btrfs/disk-io.c
  • Loading branch information
Chris Mason committed Mar 25, 2015
2 parents 9deed22 + a4f3d2c commit fc4c3c8
Show file tree
Hide file tree
Showing 25 changed files with 384 additions and 350 deletions.
4 changes: 2 additions & 2 deletions fs/btrfs/async-thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ BTRFS_WORK_HELPER(scrubwrc_helper);
BTRFS_WORK_HELPER(scrubnc_helper);

static struct __btrfs_workqueue *
__btrfs_alloc_workqueue(const char *name, int flags, int max_active,
__btrfs_alloc_workqueue(const char *name, unsigned int flags, int max_active,
int thresh)
{
struct __btrfs_workqueue *ret = kzalloc(sizeof(*ret), GFP_NOFS);
Expand Down Expand Up @@ -132,7 +132,7 @@ static inline void
__btrfs_destroy_workqueue(struct __btrfs_workqueue *wq);

struct btrfs_workqueue *btrfs_alloc_workqueue(const char *name,
int flags,
unsigned int flags,
int max_active,
int thresh)
{
Expand Down
2 changes: 1 addition & 1 deletion fs/btrfs/async-thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ BTRFS_WORK_HELPER_PROTO(scrubwrc_helper);
BTRFS_WORK_HELPER_PROTO(scrubnc_helper);

struct btrfs_workqueue *btrfs_alloc_workqueue(const char *name,
int flags,
unsigned int flags,
int max_active,
int thresh);
void btrfs_init_work(struct btrfs_work *work, btrfs_work_func_t helper,
Expand Down
5 changes: 1 addition & 4 deletions fs/btrfs/check-integrity.c
Original file line number Diff line number Diff line change
Expand Up @@ -3241,8 +3241,5 @@ void btrfsic_unmount(struct btrfs_root *root,

mutex_unlock(&btrfsic_mutex);

if (is_vmalloc_addr(state))
vfree(state);
else
kfree(state);
kvfree(state);
}
2 changes: 1 addition & 1 deletion fs/btrfs/compression.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ static int comp_num_workspace[BTRFS_COMPRESS_TYPES];
static atomic_t comp_alloc_workspace[BTRFS_COMPRESS_TYPES];
static wait_queue_head_t comp_workspace_wait[BTRFS_COMPRESS_TYPES];

static struct btrfs_compress_op *btrfs_compress_op[] = {
static const struct btrfs_compress_op * const btrfs_compress_op[] = {
&btrfs_zlib_compress,
&btrfs_lzo_compress,
};
Expand Down
4 changes: 2 additions & 2 deletions fs/btrfs/compression.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ struct btrfs_compress_op {
size_t srclen, size_t destlen);
};

extern struct btrfs_compress_op btrfs_zlib_compress;
extern struct btrfs_compress_op btrfs_lzo_compress;
extern const struct btrfs_compress_op btrfs_zlib_compress;
extern const struct btrfs_compress_op btrfs_lzo_compress;

#endif
53 changes: 28 additions & 25 deletions fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans,
ret = btrfs_dec_ref(trans, root, buf, 1);
BUG_ON(ret); /* -ENOMEM */
}
clean_tree_block(trans, root, buf);
clean_tree_block(trans, root->fs_info, buf);
*last_ref = 1;
}
return 0;
Expand Down Expand Up @@ -1677,7 +1677,7 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,
continue;
}

cur = btrfs_find_tree_block(root, blocknr);
cur = btrfs_find_tree_block(root->fs_info, blocknr);
if (cur)
uptodate = btrfs_buffer_uptodate(cur, gen, 0);
else
Expand Down Expand Up @@ -1942,7 +1942,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,

path->locks[level] = 0;
path->nodes[level] = NULL;
clean_tree_block(trans, root, mid);
clean_tree_block(trans, root->fs_info, mid);
btrfs_tree_unlock(mid);
/* once for the path */
free_extent_buffer(mid);
Expand Down Expand Up @@ -1996,7 +1996,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
if (wret < 0 && wret != -ENOSPC)
ret = wret;
if (btrfs_header_nritems(right) == 0) {
clean_tree_block(trans, root, right);
clean_tree_block(trans, root->fs_info, right);
btrfs_tree_unlock(right);
del_ptr(root, path, level + 1, pslot + 1);
root_sub_used(root, right->len);
Expand Down Expand Up @@ -2040,7 +2040,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
BUG_ON(wret == 1);
}
if (btrfs_header_nritems(mid) == 0) {
clean_tree_block(trans, root, mid);
clean_tree_block(trans, root->fs_info, mid);
btrfs_tree_unlock(mid);
del_ptr(root, path, level + 1, pslot);
root_sub_used(root, mid->len);
Expand Down Expand Up @@ -2258,7 +2258,7 @@ static void reada_for_search(struct btrfs_root *root,

search = btrfs_node_blockptr(node, slot);
blocksize = root->nodesize;
eb = btrfs_find_tree_block(root, search);
eb = btrfs_find_tree_block(root->fs_info, search);
if (eb) {
free_extent_buffer(eb);
return;
Expand Down Expand Up @@ -2318,7 +2318,7 @@ static noinline void reada_for_balance(struct btrfs_root *root,
if (slot > 0) {
block1 = btrfs_node_blockptr(parent, slot - 1);
gen = btrfs_node_ptr_generation(parent, slot - 1);
eb = btrfs_find_tree_block(root, block1);
eb = btrfs_find_tree_block(root->fs_info, block1);
/*
* if we get -eagain from btrfs_buffer_uptodate, we
* don't want to return eagain here. That will loop
Expand All @@ -2331,7 +2331,7 @@ static noinline void reada_for_balance(struct btrfs_root *root,
if (slot + 1 < nritems) {
block2 = btrfs_node_blockptr(parent, slot + 1);
gen = btrfs_node_ptr_generation(parent, slot + 1);
eb = btrfs_find_tree_block(root, block2);
eb = btrfs_find_tree_block(root->fs_info, block2);
if (eb && btrfs_buffer_uptodate(eb, gen, 1) != 0)
block2 = 0;
free_extent_buffer(eb);
Expand Down Expand Up @@ -2449,7 +2449,7 @@ read_block_for_search(struct btrfs_trans_handle *trans,
blocknr = btrfs_node_blockptr(b, slot);
gen = btrfs_node_ptr_generation(b, slot);

tmp = btrfs_find_tree_block(root, blocknr);
tmp = btrfs_find_tree_block(root->fs_info, blocknr);
if (tmp) {
/* first we do an atomic uptodate check */
if (btrfs_buffer_uptodate(tmp, gen, 1) > 0) {
Expand Down Expand Up @@ -3125,7 +3125,8 @@ int btrfs_search_slot_for_read(struct btrfs_root *root,
* higher levels
*
*/
static void fixup_low_keys(struct btrfs_root *root, struct btrfs_path *path,
static void fixup_low_keys(struct btrfs_fs_info *fs_info,
struct btrfs_path *path,
struct btrfs_disk_key *key, int level)
{
int i;
Expand All @@ -3136,7 +3137,7 @@ static void fixup_low_keys(struct btrfs_root *root, struct btrfs_path *path,
if (!path->nodes[i])
break;
t = path->nodes[i];
tree_mod_log_set_node_key(root->fs_info, t, tslot, 1);
tree_mod_log_set_node_key(fs_info, t, tslot, 1);
btrfs_set_node_key(t, key, tslot);
btrfs_mark_buffer_dirty(path->nodes[i]);
if (tslot != 0)
Expand All @@ -3150,7 +3151,8 @@ static void fixup_low_keys(struct btrfs_root *root, struct btrfs_path *path,
* This function isn't completely safe. It's the caller's responsibility
* that the new key won't break the order
*/
void btrfs_set_item_key_safe(struct btrfs_root *root, struct btrfs_path *path,
void btrfs_set_item_key_safe(struct btrfs_fs_info *fs_info,
struct btrfs_path *path,
struct btrfs_key *new_key)
{
struct btrfs_disk_key disk_key;
Expand All @@ -3172,7 +3174,7 @@ void btrfs_set_item_key_safe(struct btrfs_root *root, struct btrfs_path *path,
btrfs_set_item_key(eb, &disk_key, slot);
btrfs_mark_buffer_dirty(eb);
if (slot == 0)
fixup_low_keys(root, path, &disk_key, 1);
fixup_low_keys(fs_info, path, &disk_key, 1);
}

/*
Expand Down Expand Up @@ -3691,7 +3693,7 @@ static noinline int __push_leaf_right(struct btrfs_trans_handle *trans,
if (left_nritems)
btrfs_mark_buffer_dirty(left);
else
clean_tree_block(trans, root, left);
clean_tree_block(trans, root->fs_info, left);

btrfs_mark_buffer_dirty(right);

Expand All @@ -3703,7 +3705,7 @@ static noinline int __push_leaf_right(struct btrfs_trans_handle *trans,
if (path->slots[0] >= left_nritems) {
path->slots[0] -= left_nritems;
if (btrfs_header_nritems(path->nodes[0]) == 0)
clean_tree_block(trans, root, path->nodes[0]);
clean_tree_block(trans, root->fs_info, path->nodes[0]);
btrfs_tree_unlock(path->nodes[0]);
free_extent_buffer(path->nodes[0]);
path->nodes[0] = right;
Expand Down Expand Up @@ -3927,10 +3929,10 @@ static noinline int __push_leaf_left(struct btrfs_trans_handle *trans,
if (right_nritems)
btrfs_mark_buffer_dirty(right);
else
clean_tree_block(trans, root, right);
clean_tree_block(trans, root->fs_info, right);

btrfs_item_key(right, &disk_key, 0);
fixup_low_keys(root, path, &disk_key, 1);
fixup_low_keys(root->fs_info, path, &disk_key, 1);

/* then fixup the leaf pointer in the path */
if (path->slots[0] < push_items) {
Expand Down Expand Up @@ -4167,6 +4169,7 @@ static noinline int split_leaf(struct btrfs_trans_handle *trans,
int mid;
int slot;
struct extent_buffer *right;
struct btrfs_fs_info *fs_info = root->fs_info;
int ret = 0;
int wret;
int split;
Expand Down Expand Up @@ -4270,10 +4273,10 @@ static noinline int split_leaf(struct btrfs_trans_handle *trans,
btrfs_set_header_backref_rev(right, BTRFS_MIXED_BACKREF_REV);
btrfs_set_header_owner(right, root->root_key.objectid);
btrfs_set_header_level(right, 0);
write_extent_buffer(right, root->fs_info->fsid,
write_extent_buffer(right, fs_info->fsid,
btrfs_header_fsid(), BTRFS_FSID_SIZE);

write_extent_buffer(right, root->fs_info->chunk_tree_uuid,
write_extent_buffer(right, fs_info->chunk_tree_uuid,
btrfs_header_chunk_tree_uuid(right),
BTRFS_UUID_SIZE);

Expand All @@ -4296,7 +4299,7 @@ static noinline int split_leaf(struct btrfs_trans_handle *trans,
path->nodes[0] = right;
path->slots[0] = 0;
if (path->slots[1] == 0)
fixup_low_keys(root, path, &disk_key, 1);
fixup_low_keys(fs_info, path, &disk_key, 1);
}
btrfs_mark_buffer_dirty(right);
return ret;
Expand Down Expand Up @@ -4614,7 +4617,7 @@ void btrfs_truncate_item(struct btrfs_root *root, struct btrfs_path *path,
btrfs_set_disk_key_offset(&disk_key, offset + size_diff);
btrfs_set_item_key(leaf, &disk_key, slot);
if (slot == 0)
fixup_low_keys(root, path, &disk_key, 1);
fixup_low_keys(root->fs_info, path, &disk_key, 1);
}

item = btrfs_item_nr(slot);
Expand Down Expand Up @@ -4715,7 +4718,7 @@ void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *path,

if (path->slots[0] == 0) {
btrfs_cpu_key_to_disk(&disk_key, cpu_key);
fixup_low_keys(root, path, &disk_key, 1);
fixup_low_keys(root->fs_info, path, &disk_key, 1);
}
btrfs_unlock_up_safe(path, 1);

Expand Down Expand Up @@ -4887,7 +4890,7 @@ static void del_ptr(struct btrfs_root *root, struct btrfs_path *path,
struct btrfs_disk_key disk_key;

btrfs_node_key(parent, &disk_key, 0);
fixup_low_keys(root, path, &disk_key, level + 1);
fixup_low_keys(root->fs_info, path, &disk_key, level + 1);
}
btrfs_mark_buffer_dirty(parent);
}
Expand Down Expand Up @@ -4980,7 +4983,7 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
btrfs_set_header_level(leaf, 0);
} else {
btrfs_set_path_blocking(path);
clean_tree_block(trans, root, leaf);
clean_tree_block(trans, root->fs_info, leaf);
btrfs_del_leaf(trans, root, path, leaf);
}
} else {
Expand All @@ -4989,7 +4992,7 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
struct btrfs_disk_key disk_key;

btrfs_item_key(leaf, &disk_key, 0);
fixup_low_keys(root, path, &disk_key, 1);
fixup_low_keys(root->fs_info, path, &disk_key, 1);
}

/* delete the leaf if it is mostly empty */
Expand Down
3 changes: 2 additions & 1 deletion fs/btrfs/ctree.h
Original file line number Diff line number Diff line change
Expand Up @@ -3488,7 +3488,8 @@ int btrfs_previous_item(struct btrfs_root *root,
int type);
int btrfs_previous_extent_item(struct btrfs_root *root,
struct btrfs_path *path, u64 min_objectid);
void btrfs_set_item_key_safe(struct btrfs_root *root, struct btrfs_path *path,
void btrfs_set_item_key_safe(struct btrfs_fs_info *fs_info,
struct btrfs_path *path,
struct btrfs_key *new_key);
struct extent_buffer *btrfs_root_node(struct btrfs_root *root);
struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root);
Expand Down
9 changes: 5 additions & 4 deletions fs/btrfs/delayed-inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ static void btrfs_async_run_delayed_root(struct btrfs_work *work)


static int btrfs_wq_run_delayed_node(struct btrfs_delayed_root *delayed_root,
struct btrfs_root *root, int nr)
struct btrfs_fs_info *fs_info, int nr)
{
struct btrfs_async_delayed_work *async_work;

Expand All @@ -1399,7 +1399,7 @@ static int btrfs_wq_run_delayed_node(struct btrfs_delayed_root *delayed_root,
btrfs_async_run_delayed_root, NULL, NULL);
async_work->nr = nr;

btrfs_queue_work(root->fs_info->delayed_workers, &async_work->work);
btrfs_queue_work(fs_info->delayed_workers, &async_work->work);
return 0;
}

Expand All @@ -1426,6 +1426,7 @@ static int could_end_wait(struct btrfs_delayed_root *delayed_root, int seq)
void btrfs_balance_delayed_items(struct btrfs_root *root)
{
struct btrfs_delayed_root *delayed_root;
struct btrfs_fs_info *fs_info = root->fs_info;

delayed_root = btrfs_get_delayed_root(root);

Expand All @@ -1438,7 +1439,7 @@ void btrfs_balance_delayed_items(struct btrfs_root *root)

seq = atomic_read(&delayed_root->items_seq);

ret = btrfs_wq_run_delayed_node(delayed_root, root, 0);
ret = btrfs_wq_run_delayed_node(delayed_root, fs_info, 0);
if (ret)
return;

Expand All @@ -1447,7 +1448,7 @@ void btrfs_balance_delayed_items(struct btrfs_root *root)
return;
}

btrfs_wq_run_delayed_node(delayed_root, root, BTRFS_DELAYED_BATCH);
btrfs_wq_run_delayed_node(delayed_root, fs_info, BTRFS_DELAYED_BATCH);
}

/* Will return 0 or -ENOMEM */
Expand Down
Loading

0 comments on commit fc4c3c8

Please sign in to comment.