diff options
| author | Chris Mason <chris.mason@fusionio.com> | 2013-02-20 14:05:45 -0500 |
|---|---|---|
| committer | Chris Mason <chris.mason@fusionio.com> | 2013-02-20 14:05:45 -0500 |
| commit | b2c6b3e0611c58fbeb6b9c0892b6249f7bdfaf6b (patch) | |
| tree | de7cf0825605aa6acf33a8d107003efd7aedbe72 | |
| parent | 19f949f52599ba7c3f67a5897ac6be14bfcb1200 (diff) | |
| parent | 272d26d0ad8c0e326689f2fa3cdc6a5fcc8e74e0 (diff) | |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next into for-linus-3.9
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Conflicts:
fs/btrfs/disk-io.c
38 files changed, 1630 insertions, 702 deletions
diff --git a/fs/btrfs/backref.h b/fs/btrfs/backref.h index d61feca79455..310a7f6d09b1 100644 --- a/fs/btrfs/backref.h +++ b/fs/btrfs/backref.h | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | #ifndef __BTRFS_BACKREF__ | 19 | #ifndef __BTRFS_BACKREF__ |
| 20 | #define __BTRFS_BACKREF__ | 20 | #define __BTRFS_BACKREF__ |
| 21 | 21 | ||
| 22 | #include "ioctl.h" | 22 | #include <linux/btrfs.h> |
| 23 | #include "ulist.h" | 23 | #include "ulist.h" |
| 24 | #include "extent_io.h" | 24 | #include "extent_io.h" |
| 25 | 25 | ||
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index 2a8c242bc4f5..d9b97d4960e6 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h | |||
| @@ -40,6 +40,8 @@ | |||
| 40 | #define BTRFS_INODE_HAS_ASYNC_EXTENT 6 | 40 | #define BTRFS_INODE_HAS_ASYNC_EXTENT 6 |
| 41 | #define BTRFS_INODE_NEEDS_FULL_SYNC 7 | 41 | #define BTRFS_INODE_NEEDS_FULL_SYNC 7 |
| 42 | #define BTRFS_INODE_COPY_EVERYTHING 8 | 42 | #define BTRFS_INODE_COPY_EVERYTHING 8 |
| 43 | #define BTRFS_INODE_IN_DELALLOC_LIST 9 | ||
| 44 | #define BTRFS_INODE_READDIO_NEED_LOCK 10 | ||
| 43 | 45 | ||
| 44 | /* in memory btrfs inode */ | 46 | /* in memory btrfs inode */ |
| 45 | struct btrfs_inode { | 47 | struct btrfs_inode { |
| @@ -216,4 +218,22 @@ static inline int btrfs_inode_in_log(struct inode *inode, u64 generation) | |||
| 216 | return 0; | 218 | return 0; |
| 217 | } | 219 | } |
| 218 | 220 | ||
| 221 | /* | ||
| 222 | * Disable DIO read nolock optimization, so new dio readers will be forced | ||
| 223 | * to grab i_mutex. It is used to avoid the endless truncate due to | ||
| 224 | * nonlocked dio read. | ||
| 225 | */ | ||
| 226 | static inline void btrfs_inode_block_unlocked_dio(struct inode *inode) | ||
| 227 | { | ||
| 228 | set_bit(BTRFS_INODE_READDIO_NEED_LOCK, &BTRFS_I(inode)->runtime_flags); | ||
| 229 | smp_mb(); | ||
| 230 | } | ||
| 231 | |||
| 232 | static inline void btrfs_inode_resume_unlocked_dio(struct inode *inode) | ||
| 233 | { | ||
| 234 | smp_mb__before_clear_bit(); | ||
| 235 | clear_bit(BTRFS_INODE_READDIO_NEED_LOCK, | ||
| 236 | &BTRFS_I(inode)->runtime_flags); | ||
| 237 | } | ||
| 238 | |||
| 219 | #endif | 239 | #endif |
diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c index 11d47bfb62b4..18af6f48781a 100644 --- a/fs/btrfs/check-integrity.c +++ b/fs/btrfs/check-integrity.c | |||
| @@ -813,8 +813,7 @@ static int btrfsic_process_superblock_dev_mirror( | |||
| 813 | (bh->b_data + (dev_bytenr & 4095)); | 813 | (bh->b_data + (dev_bytenr & 4095)); |
| 814 | 814 | ||
| 815 | if (btrfs_super_bytenr(super_tmp) != dev_bytenr || | 815 | if (btrfs_super_bytenr(super_tmp) != dev_bytenr || |
| 816 | strncmp((char *)(&(super_tmp->magic)), BTRFS_MAGIC, | 816 | super_tmp->magic != cpu_to_le64(BTRFS_MAGIC) || |
| 817 | sizeof(super_tmp->magic)) || | ||
| 818 | memcmp(device->uuid, super_tmp->dev_item.uuid, BTRFS_UUID_SIZE) || | 817 | memcmp(device->uuid, super_tmp->dev_item.uuid, BTRFS_UUID_SIZE) || |
| 819 | btrfs_super_nodesize(super_tmp) != state->metablock_size || | 818 | btrfs_super_nodesize(super_tmp) != state->metablock_size || |
| 820 | btrfs_super_leafsize(super_tmp) != state->metablock_size || | 819 | btrfs_super_leafsize(super_tmp) != state->metablock_size || |
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index eea5da7a2b9a..ecd25a1b4e51 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
| @@ -1138,6 +1138,7 @@ __tree_mod_log_rewind(struct extent_buffer *eb, u64 time_seq, | |||
| 1138 | switch (tm->op) { | 1138 | switch (tm->op) { |
| 1139 | case MOD_LOG_KEY_REMOVE_WHILE_FREEING: | 1139 | case MOD_LOG_KEY_REMOVE_WHILE_FREEING: |
| 1140 | BUG_ON(tm->slot < n); | 1140 | BUG_ON(tm->slot < n); |
| 1141 | /* Fallthrough */ | ||
| 1141 | case MOD_LOG_KEY_REMOVE_WHILE_MOVING: | 1142 | case MOD_LOG_KEY_REMOVE_WHILE_MOVING: |
| 1142 | case MOD_LOG_KEY_REMOVE: | 1143 | case MOD_LOG_KEY_REMOVE: |
| 1143 | btrfs_set_node_key(eb, &tm->key, tm->slot); | 1144 | btrfs_set_node_key(eb, &tm->key, tm->slot); |
| @@ -1222,7 +1223,7 @@ tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct extent_buffer *eb, | |||
| 1222 | 1223 | ||
| 1223 | __tree_mod_log_rewind(eb_rewin, time_seq, tm); | 1224 | __tree_mod_log_rewind(eb_rewin, time_seq, tm); |
| 1224 | WARN_ON(btrfs_header_nritems(eb_rewin) > | 1225 | WARN_ON(btrfs_header_nritems(eb_rewin) > |
| 1225 | BTRFS_NODEPTRS_PER_BLOCK(fs_info->fs_root)); | 1226 | BTRFS_NODEPTRS_PER_BLOCK(fs_info->tree_root)); |
| 1226 | 1227 | ||
| 1227 | return eb_rewin; | 1228 | return eb_rewin; |
| 1228 | } | 1229 | } |
| @@ -1441,7 +1442,7 @@ int btrfs_comp_cpu_keys(struct btrfs_key *k1, struct btrfs_key *k2) | |||
| 1441 | */ | 1442 | */ |
| 1442 | int btrfs_realloc_node(struct btrfs_trans_handle *trans, | 1443 | int btrfs_realloc_node(struct btrfs_trans_handle *trans, |
| 1443 | struct btrfs_root *root, struct extent_buffer *parent, | 1444 | struct btrfs_root *root, struct extent_buffer *parent, |
| 1444 | int start_slot, int cache_only, u64 *last_ret, | 1445 | int start_slot, u64 *last_ret, |
| 1445 | struct btrfs_key *progress) | 1446 | struct btrfs_key *progress) |
| 1446 | { | 1447 | { |
| 1447 | struct extent_buffer *cur; | 1448 | struct extent_buffer *cur; |
| @@ -1461,8 +1462,6 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans, | |||
| 1461 | struct btrfs_disk_key disk_key; | 1462 | struct btrfs_disk_key disk_key; |
| 1462 | 1463 | ||
| 1463 | parent_level = btrfs_header_level(parent); | 1464 | parent_level = btrfs_header_level(parent); |
| 1464 | if (cache_only && parent_level != 1) | ||
| 1465 | return 0; | ||
| 1466 | 1465 | ||
| 1467 | WARN_ON(trans->transaction != root->fs_info->running_transaction); | 1466 | WARN_ON(trans->transaction != root->fs_info->running_transaction); |
| 1468 | WARN_ON(trans->transid != root->fs_info->generation); | 1467 | WARN_ON(trans->transid != root->fs_info->generation); |
| @@ -1508,10 +1507,6 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans, | |||
| 1508 | else | 1507 | else |
| 1509 | uptodate = 0; | 1508 | uptodate = 0; |
| 1510 | if (!cur || !uptodate) { | 1509 | if (!cur || !uptodate) { |
| 1511 | if (cache_only) { | ||
| 1512 | free_extent_buffer(cur); | ||
| 1513 | continue; | ||
| 1514 | } | ||
| 1515 | if (!cur) { | 1510 | if (!cur) { |
| 1516 | cur = read_tree_block(root, blocknr, | 1511 | cur = read_tree_block(root, blocknr, |
| 1517 | blocksize, gen); | 1512 | blocksize, gen); |
| @@ -4825,8 +4820,8 @@ int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path) | |||
| 4825 | 4820 | ||
| 4826 | /* | 4821 | /* |
| 4827 | * A helper function to walk down the tree starting at min_key, and looking | 4822 | * A helper function to walk down the tree starting at min_key, and looking |
| 4828 | * for nodes or leaves that are either in cache or have a minimum | 4823 | * for nodes or leaves that are have a minimum transaction id. |
| 4829 | * transaction id. This is used by the btree defrag code, and tree logging | 4824 | * This is used by the btree defrag code, and tree logging |
| 4830 | * | 4825 | * |
| 4831 | * This does not cow, but it does stuff the starting key it finds back | 4826 | * This does not co |
