Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/mason/btrfs-unstable

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable: (39 commits)
  Btrfs: deal with errors from updating the tree log
  Btrfs: allow subvol deletion by unprivileged user with -o user_subvol_rm_allowed
  Btrfs: make SNAP_DESTROY async
  Btrfs: add SNAP_CREATE_ASYNC ioctl
  Btrfs: add START_SYNC, WAIT_SYNC ioctls
  Btrfs: async transaction commit
  Btrfs: fix deadlock in btrfs_commit_transaction
  Btrfs: fix lockdep warning on clone ioctl
  Btrfs: fix clone ioctl where range is adjacent to extent
  Btrfs: fix delalloc checks in clone ioctl
  Btrfs: drop unused variable in block_alloc_rsv
  Btrfs: cleanup warnings from gcc 4.6 (nonbugs)
  Btrfs: Fix variables set but not read (bugs found by gcc 4.6)
  Btrfs: Use ERR_CAST helpers
  Btrfs: use memdup_user helpers
  Btrfs: fix raid code for removing missing drives
  Btrfs: Switch the extent buffer rbtree into a radix tree
  Btrfs: restructure try_release_extent_buffer()
  Btrfs: use the flusher threads for delalloc throttling
  Btrfs: tune the chunk allocation to 5% of the FS as metadata
  ...

Fix up trivial conflicts in fs/btrfs/super.c and fs/fs-writeback.c, and
remove use of INIT_RCU_HEAD in fs/btrfs/extent_io.c (that init macro was
useless and removed in commit 5e8067a: "rcu head remove init")
  • Loading branch information
Linus Torvalds committed Oct 30, 2010
2 parents cdf01dd + 6418c96 commit 925d169
Show file tree
Hide file tree
Showing 27 changed files with 2,405 additions and 519 deletions.
2 changes: 0 additions & 2 deletions fs/btrfs/compression.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ static int check_compressed_csum(struct inode *inode,
*/
static void end_compressed_bio_read(struct bio *bio, int err)
{
struct extent_io_tree *tree;
struct compressed_bio *cb = bio->bi_private;
struct inode *inode;
struct page *page;
Expand All @@ -187,7 +186,6 @@ static void end_compressed_bio_read(struct bio *bio, int err)
/* ok, we're the last bio for this extent, lets start
* the decompression.
*/
tree = &BTRFS_I(inode)->io_tree;
ret = btrfs_zlib_decompress_biovec(cb->compressed_pages,
cb->start,
cb->orig_bio->bi_io_vec,
Expand Down
57 changes: 30 additions & 27 deletions fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,
struct extent_buffer **cow_ret, u64 new_root_objectid)
{
struct extent_buffer *cow;
u32 nritems;
int ret = 0;
int level;
struct btrfs_disk_key disk_key;
Expand All @@ -210,7 +209,6 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,
WARN_ON(root->ref_cows && trans->transid != root->last_trans);

level = btrfs_header_level(buf);
nritems = btrfs_header_nritems(buf);
if (level == 0)
btrfs_item_key(buf, &disk_key, 0);
else
Expand Down Expand Up @@ -1008,7 +1006,6 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
int wret;
int pslot;
int orig_slot = path->slots[level];
int err_on_enospc = 0;
u64 orig_ptr;

if (level == 0)
Expand Down Expand Up @@ -1071,8 +1068,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
BTRFS_NODEPTRS_PER_BLOCK(root) / 4)
return 0;

if (btrfs_header_nritems(mid) < 2)
err_on_enospc = 1;
btrfs_header_nritems(mid);

left = read_node_slot(root, parent, pslot - 1);
if (left) {
Expand Down Expand Up @@ -1103,8 +1099,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
wret = push_node_left(trans, root, left, mid, 1);
if (wret < 0)
ret = wret;
if (btrfs_header_nritems(mid) < 2)
err_on_enospc = 1;
btrfs_header_nritems(mid);
}

/*
Expand Down Expand Up @@ -1224,14 +1219,12 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans,
int wret;
int pslot;
int orig_slot = path->slots[level];
u64 orig_ptr;

if (level == 0)
return 1;

mid = path->nodes[level];
WARN_ON(btrfs_header_generation(mid) != trans->transid);
orig_ptr = btrfs_node_blockptr(mid, orig_slot);

if (level < BTRFS_MAX_LEVEL - 1)
parent = path->nodes[level + 1];
Expand Down Expand Up @@ -1577,13 +1570,33 @@ read_block_for_search(struct btrfs_trans_handle *trans,
blocksize = btrfs_level_size(root, level - 1);

tmp = btrfs_find_tree_block(root, blocknr, blocksize);
if (tmp && btrfs_buffer_uptodate(tmp, gen)) {
/*
* we found an up to date block without sleeping, return
* right away
*/
*eb_ret = tmp;
return 0;
if (tmp) {
if (btrfs_buffer_uptodate(tmp, 0)) {
if (btrfs_buffer_uptodate(tmp, gen)) {
/*
* we found an up to date block without
* sleeping, return
* right away
*/
*eb_ret = tmp;
return 0;
}
/* the pages were up to date, but we failed
* the generation number check. Do a full
* read for the generation number that is correct.
* We must do this without dropping locks so
* we can trust our generation number
*/
free_extent_buffer(tmp);
tmp = read_tree_block(root, blocknr, blocksize, gen);
if (tmp && btrfs_buffer_uptodate(tmp, gen)) {
*eb_ret = tmp;
return 0;
}
free_extent_buffer(tmp);
btrfs_release_path(NULL, p);
return -EIO;
}
}

/*
Expand All @@ -1596,8 +1609,7 @@ read_block_for_search(struct btrfs_trans_handle *trans,
btrfs_unlock_up_safe(p, level + 1);
btrfs_set_path_blocking(p);

if (tmp)
free_extent_buffer(tmp);
free_extent_buffer(tmp);
if (p->reada)
reada_for_search(root, p, level, slot, key->objectid);

Expand Down Expand Up @@ -2548,7 +2560,6 @@ static noinline int __push_leaf_left(struct btrfs_trans_handle *trans,
{
struct btrfs_disk_key disk_key;
struct extent_buffer *right = path->nodes[0];
int slot;
int i;
int push_space = 0;
int push_items = 0;
Expand All @@ -2560,8 +2571,6 @@ static noinline int __push_leaf_left(struct btrfs_trans_handle *trans,
u32 this_item_size;
u32 old_left_item_size;

slot = path->slots[1];

if (empty)
nr = min(right_nritems, max_slot);
else
Expand Down Expand Up @@ -3330,7 +3339,6 @@ int btrfs_truncate_item(struct btrfs_trans_handle *trans,
{
int ret = 0;
int slot;
int slot_orig;
struct extent_buffer *leaf;
struct btrfs_item *item;
u32 nritems;
Expand All @@ -3340,7 +3348,6 @@ int btrfs_truncate_item(struct btrfs_trans_handle *trans,
unsigned int size_diff;
int i;

slot_orig = path->slots[0];
leaf = path->nodes[0];
slot = path->slots[0];

Expand Down Expand Up @@ -3445,7 +3452,6 @@ int btrfs_extend_item(struct btrfs_trans_handle *trans,
{
int ret = 0;
int slot;
int slot_orig;
struct extent_buffer *leaf;
struct btrfs_item *item;
u32 nritems;
Expand All @@ -3454,7 +3460,6 @@ int btrfs_extend_item(struct btrfs_trans_handle *trans,
unsigned int old_size;
int i;

slot_orig = path->slots[0];
leaf = path->nodes[0];

nritems = btrfs_header_nritems(leaf);
Expand Down Expand Up @@ -3787,7 +3792,6 @@ int btrfs_insert_empty_items(struct btrfs_trans_handle *trans,
struct btrfs_key *cpu_key, u32 *data_size,
int nr)
{
struct extent_buffer *leaf;
int ret = 0;
int slot;
int i;
Expand All @@ -3804,7 +3808,6 @@ int btrfs_insert_empty_items(struct btrfs_trans_handle *trans,
if (ret < 0)
goto out;

leaf = path->nodes[0];
slot = path->slots[0];
BUG_ON(slot < 0);

Expand Down
Loading

0 comments on commit 925d169

Please sign in to comment.