Commit 3dda13a8 authored by David Sterba's avatar David Sterba

Merge branch 'misc-4.10' into for-chris-4.10-20170104

parents 2939e1a8 c2931667
...@@ -2522,11 +2522,11 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, ...@@ -2522,11 +2522,11 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
if (ref && ref->seq && if (ref && ref->seq &&
btrfs_check_delayed_seq(fs_info, delayed_refs, ref->seq)) { btrfs_check_delayed_seq(fs_info, delayed_refs, ref->seq)) {
spin_unlock(&locked_ref->lock); spin_unlock(&locked_ref->lock);
btrfs_delayed_ref_unlock(locked_ref);
spin_lock(&delayed_refs->lock); spin_lock(&delayed_refs->lock);
locked_ref->processing = 0; locked_ref->processing = 0;
delayed_refs->num_heads_ready++; delayed_refs->num_heads_ready++;
spin_unlock(&delayed_refs->lock); spin_unlock(&delayed_refs->lock);
btrfs_delayed_ref_unlock(locked_ref);
locked_ref = NULL; locked_ref = NULL;
cond_resched(); cond_resched();
count++; count++;
...@@ -2572,7 +2572,10 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, ...@@ -2572,7 +2572,10 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
*/ */
if (must_insert_reserved) if (must_insert_reserved)
locked_ref->must_insert_reserved = 1; locked_ref->must_insert_reserved = 1;
spin_lock(&delayed_refs->lock);
locked_ref->processing = 0; locked_ref->processing = 0;
delayed_refs->num_heads_ready++;
spin_unlock(&delayed_refs->lock);
btrfs_debug(fs_info, btrfs_debug(fs_info,
"run_delayed_extent_op returned %d", "run_delayed_extent_op returned %d",
ret); ret);
...@@ -7384,7 +7387,8 @@ btrfs_lock_cluster(struct btrfs_block_group_cache *block_group, ...@@ -7384,7 +7387,8 @@ btrfs_lock_cluster(struct btrfs_block_group_cache *block_group,
spin_unlock(&cluster->refill_lock); spin_unlock(&cluster->refill_lock);
down_read(&used_bg->data_rwsem); /* We should only have one-level nested. */
down_read_nested(&used_bg->data_rwsem, SINGLE_DEPTH_NESTING);
spin_lock(&cluster->refill_lock); spin_lock(&cluster->refill_lock);
if (used_bg == cluster->block_group) if (used_bg == cluster->block_group)
......
...@@ -7623,11 +7623,18 @@ static void adjust_dio_outstanding_extents(struct inode *inode, ...@@ -7623,11 +7623,18 @@ static void adjust_dio_outstanding_extents(struct inode *inode,
* within our reservation, otherwise we need to adjust our inode * within our reservation, otherwise we need to adjust our inode
* counter appropriately. * counter appropriately.
*/ */
if (dio_data->outstanding_extents) { if (dio_data->outstanding_extents >= num_extents) {
dio_data->outstanding_extents -= num_extents; dio_data->outstanding_extents -= num_extents;
} else { } else {
/*
* If dio write length has been split due to no large enough
* contiguous space, we need to compensate our inode counter
* appropriately.
*/
u64 num_needed = num_extents - dio_data->outstanding_extents;
spin_lock(&BTRFS_I(inode)->lock); spin_lock(&BTRFS_I(inode)->lock);
BTRFS_I(inode)->outstanding_extents += num_extents; BTRFS_I(inode)->outstanding_extents += num_needed;
spin_unlock(&BTRFS_I(inode)->lock); spin_unlock(&BTRFS_I(inode)->lock);
} }
} }
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
*/ */
#define LOG_INODE_ALL 0 #define LOG_INODE_ALL 0
#define LOG_INODE_EXISTS 1 #define LOG_INODE_EXISTS 1
#define LOG_OTHER_INODE 2
/* /*
* directory trouble cases * directory trouble cases
...@@ -4641,7 +4642,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, ...@@ -4641,7 +4642,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
if (S_ISDIR(inode->i_mode) || if (S_ISDIR(inode->i_mode) ||
(!test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, (!test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
&BTRFS_I(inode)->runtime_flags) && &BTRFS_I(inode)->runtime_flags) &&
inode_only == LOG_INODE_EXISTS)) inode_only >= LOG_INODE_EXISTS))
max_key.type = BTRFS_XATTR_ITEM_KEY; max_key.type = BTRFS_XATTR_ITEM_KEY;
else else
max_key.type = (u8)-1; max_key.type = (u8)-1;
...@@ -4665,7 +4666,13 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, ...@@ -4665,7 +4666,13 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
return ret; return ret;
} }
if (inode_only == LOG_OTHER_INODE) {
inode_only = LOG_INODE_EXISTS;
mutex_lock_nested(&BTRFS_I(inode)->log_mutex,
SINGLE_DEPTH_NESTING);
} else {
mutex_lock(&BTRFS_I(inode)->log_mutex); mutex_lock(&BTRFS_I(inode)->log_mutex);
}
/* /*
* a brute force approach to making sure we get the most uptodate * a brute force approach to making sure we get the most uptodate
...@@ -4817,7 +4824,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, ...@@ -4817,7 +4824,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
* unpin it. * unpin it.
*/ */
err = btrfs_log_inode(trans, root, other_inode, err = btrfs_log_inode(trans, root, other_inode,
LOG_INODE_EXISTS, LOG_OTHER_INODE,
0, LLONG_MAX, ctx); 0, LLONG_MAX, ctx);
iput(other_inode); iput(other_inode);
if (err) if (err)
......
...@@ -352,7 +352,5 @@ int btrfs_uuid_tree_iterate(struct btrfs_fs_info *fs_info, ...@@ -352,7 +352,5 @@ int btrfs_uuid_tree_iterate(struct btrfs_fs_info *fs_info,
out: out:
btrfs_free_path(path); btrfs_free_path(path);
if (ret) return ret;
btrfs_warn(fs_info, "btrfs_uuid_tree_iterate failed %d", ret);
return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment