diff options
author | Chris Mason <clm@fb.com> | 2014-10-04 12:56:45 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-10-04 12:56:45 -0400 |
commit | bbf65cf0b5b67843ca094df01019222b85af2183 (patch) | |
tree | 35e1a8c54876cc8a105a2ad0230526195d3cafbf /fs/btrfs | |
parent | bf8e8ca6fd4ac6e8edc58b92cffb2ffd51933138 (diff) | |
parent | fccb84c94a9755f48668e43d0a44d6ecc750900f (diff) |
Merge branch 'cleanup/misc-for-3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux into for-linus
Signed-off-by: Chris Mason <clm@fb.com>
Conflicts:
fs/btrfs/extent_io.c
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/compression.c | 11 | ||||
-rw-r--r-- | fs/btrfs/ctree.c | 8 | ||||
-rw-r--r-- | fs/btrfs/ctree.h | 26 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 61 | ||||
-rw-r--r-- | fs/btrfs/disk-io.h | 6 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 16 | ||||
-rw-r--r-- | fs/btrfs/extent_io.c | 66 | ||||
-rw-r--r-- | fs/btrfs/extent_io.h | 10 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 3 | ||||
-rw-r--r-- | fs/btrfs/ioctl.c | 8 | ||||
-rw-r--r-- | fs/btrfs/qgroup.c | 10 | ||||
-rw-r--r-- | fs/btrfs/relocation.c | 3 | ||||
-rw-r--r-- | fs/btrfs/scrub.c | 17 | ||||
-rw-r--r-- | fs/btrfs/send.c | 2 | ||||
-rw-r--r-- | fs/btrfs/super.c | 14 | ||||
-rw-r--r-- | fs/btrfs/transaction.c | 2 | ||||
-rw-r--r-- | fs/btrfs/transaction.h | 2 |
17 files changed, 130 insertions, 135 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index eeee13842cd0..d3220d31d3cb 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
@@ -388,7 +388,8 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start, | |||
388 | * freed before we're done setting it up | 388 | * freed before we're done setting it up |
389 | */ | 389 | */ |
390 | atomic_inc(&cb->pending_bios); | 390 | atomic_inc(&cb->pending_bios); |
391 | ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0); | 391 | ret = btrfs_bio_wq_end_io(root->fs_info, bio, |
392 | BTRFS_WQ_ENDIO_DATA); | ||
392 | BUG_ON(ret); /* -ENOMEM */ | 393 | BUG_ON(ret); /* -ENOMEM */ |
393 | 394 | ||
394 | if (!skip_sum) { | 395 | if (!skip_sum) { |
@@ -419,7 +420,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start, | |||
419 | } | 420 | } |
420 | bio_get(bio); | 421 | bio_get(bio); |
421 | 422 | ||
422 | ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0); | 423 | ret = btrfs_bio_wq_end_io(root->fs_info, bio, BTRFS_WQ_ENDIO_DATA); |
423 | BUG_ON(ret); /* -ENOMEM */ | 424 | BUG_ON(ret); /* -ENOMEM */ |
424 | 425 | ||
425 | if (!skip_sum) { | 426 | if (!skip_sum) { |
@@ -668,7 +669,8 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | |||
668 | PAGE_CACHE_SIZE) { | 669 | PAGE_CACHE_SIZE) { |
669 | bio_get(comp_bio); | 670 | bio_get(comp_bio); |
670 | 671 | ||
671 | ret = btrfs_bio_wq_end_io(root->fs_info, comp_bio, 0); | 672 | ret = btrfs_bio_wq_end_io(root->fs_info, comp_bio, |
673 | BTRFS_WQ_ENDIO_DATA); | ||
672 | BUG_ON(ret); /* -ENOMEM */ | 674 | BUG_ON(ret); /* -ENOMEM */ |
673 | 675 | ||
674 | /* | 676 | /* |
@@ -706,7 +708,8 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | |||
706 | } | 708 | } |
707 | bio_get(comp_bio); | 709 | bio_get(comp_bio); |
708 | 710 | ||
709 | ret = btrfs_bio_wq_end_io(root->fs_info, comp_bio, 0); | 711 | ret = btrfs_bio_wq_end_io(root->fs_info, comp_bio, |
712 | BTRFS_WQ_ENDIO_DATA); | ||
710 | BUG_ON(ret); /* -ENOMEM */ | 713 | BUG_ON(ret); /* -ENOMEM */ |
711 | 714 | ||
712 | if (!(BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM)) { | 715 | if (!(BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM)) { |
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 8d0703cc7402..b289d2a9bbf5 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -1506,10 +1506,9 @@ static inline int should_cow_block(struct btrfs_trans_handle *trans, | |||
1506 | struct btrfs_root *root, | 1506 | struct btrfs_root *root, |
1507 | struct extent_buffer *buf) | 1507 | struct extent_buffer *buf) |
1508 | { | 1508 | { |
1509 | #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS | 1509 | if (btrfs_test_is_dummy_root(root)) |
1510 | if (unlikely(test_bit(BTRFS_ROOT_DUMMY_ROOT, &root->state))) | ||
1511 | return 0; | 1510 | return 0; |
1512 | #endif | 1511 | |
1513 | /* ensure we can see the force_cow */ | 1512 | /* ensure we can see the force_cow */ |
1514 | smp_rmb(); | 1513 | smp_rmb(); |
1515 | 1514 | ||
@@ -4625,8 +4624,7 @@ void btrfs_truncate_item(struct btrfs_root *root, struct btrfs_path *path, | |||
4625 | ptr = btrfs_item_ptr_offset(leaf, slot); | 4624 | ptr = btrfs_item_ptr_offset(leaf, slot); |
4626 | memmove_extent_buffer(leaf, ptr, | 4625 | memmove_extent_buffer(leaf, ptr, |
4627 | (unsigned long)fi, | 4626 | (unsigned long)fi, |
4628 | offsetof(struct btrfs_file_extent_item, | 4627 | BTRFS_FILE_EXTENT_INLINE_DATA_START); |
4629 | disk_bytenr)); | ||
4630 | } | 4628 | } |
4631 | } | 4629 | } |
4632 | 4630 | ||
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 67ef9d1a1d9b..baa4031602c1 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -385,9 +385,11 @@ struct btrfs_header { | |||
385 | sizeof(struct btrfs_key_ptr)) | 385 | sizeof(struct btrfs_key_ptr)) |
386 | #define __BTRFS_LEAF_DATA_SIZE(bs) ((bs) - sizeof(struct btrfs_header)) | 386 | #define __BTRFS_LEAF_DATA_SIZE(bs) ((bs) - sizeof(struct btrfs_header)) |
387 | #define BTRFS_LEAF_DATA_SIZE(r) (__BTRFS_LEAF_DATA_SIZE(r->nodesize)) | 387 | #define BTRFS_LEAF_DATA_SIZE(r) (__BTRFS_LEAF_DATA_SIZE(r->nodesize)) |
388 | #define BTRFS_FILE_EXTENT_INLINE_DATA_START \ | ||
389 | (offsetof(struct btrfs_file_extent_item, disk_bytenr)) | ||
388 | #define BTRFS_MAX_INLINE_DATA_SIZE(r) (BTRFS_LEAF_DATA_SIZE(r) - \ | 390 | #define BTRFS_MAX_INLINE_DATA_SIZE(r) (BTRFS_LEAF_DATA_SIZE(r) - \ |
389 | sizeof(struct btrfs_item) - \ | 391 | sizeof(struct btrfs_item) - \ |
390 | offsetof(struct btrfs_file_extent_item, disk_bytenr)) | 392 | BTRFS_FILE_EXTENT_INLINE_DATA_START) |
391 | #define BTRFS_MAX_XATTR_SIZE(r) (BTRFS_LEAF_DATA_SIZE(r) - \ | 393 | #define BTRFS_MAX_XATTR_SIZE(r) (BTRFS_LEAF_DATA_SIZE(r) - \ |
392 | sizeof(struct btrfs_item) -\ | 394 | sizeof(struct btrfs_item) -\ |
393 | sizeof(struct btrfs_dir_item)) | 395 | sizeof(struct btrfs_dir_item)) |
@@ -896,6 +898,8 @@ struct btrfs_file_extent_item { | |||
896 | /* | 898 | /* |
897 | * disk space consumed by the extent, checksum blocks are included | 899 | * disk space consumed by the extent, checksum blocks are included |
898 | * in these numbers | 900 | * in these numbers |
901 | * | ||
902 | * At this offset in the structure, the inline extent data start. | ||
899 | */ | 903 | */ |
900 | __le64 disk_bytenr; | 904 | __le64 disk_bytenr; |
901 | __le64 disk_num_bytes; | 905 | __le64 disk_num_bytes; |
@@ -2089,6 +2093,7 @@ struct btrfs_ioctl_defrag_range_args { | |||
2089 | #define BTRFS_MOUNT_CHANGE_INODE_CACHE (1 << 24) | 2093 | #define BTRFS_MOUNT_CHANGE_INODE_CACHE (1 << 24) |
2090 | 2094 | ||
2091 | #define BTRFS_DEFAULT_COMMIT_INTERVAL (30) | 2095 | #define BTRFS_DEFAULT_COMMIT_INTERVAL (30) |
2096 | #define BTRFS_DEFAULT_MAX_INLINE (8192) | ||
2092 | 2097 | ||
2093 | #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) | 2098 | #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) |
2094 | #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) | 2099 | #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) |
@@ -3042,14 +3047,12 @@ BTRFS_SETGET_STACK_FUNCS(stack_file_extent_compression, | |||
3042 | static inline unsigned long | 3047 | static inline unsigned long |
3043 | btrfs_file_extent_inline_start(struct btrfs_file_extent_item *e) | 3048 | btrfs_file_extent_inline_start(struct btrfs_file_extent_item *e) |
3044 | { | 3049 | { |
3045 | unsigned long offset = (unsigned long)e; | 3050 | return (unsigned long)e + BTRFS_FILE_EXTENT_INLINE_DATA_START; |
3046 | offset += offsetof(struct btrfs_file_extent_item, disk_bytenr); | ||
3047 | return offset; | ||
3048 | } | 3051 | } |
3049 | 3052 | ||
3050 | static inline u32 btrfs_file_extent_calc_inline_size(u32 datasize) | 3053 | static inline u32 btrfs_file_extent_calc_inline_size(u32 datasize) |
3051 | { | 3054 | { |
3052 | return offsetof(struct btrfs_file_extent_item, disk_bytenr) + datasize; | 3055 | return BTRFS_FILE_EXTENT_INLINE_DATA_START + datasize; |
3053 | } | 3056 | } |
3054 | 3057 | ||
3055 | BTRFS_SETGET_FUNCS(file_extent_disk_bytenr, struct btrfs_file_extent_item, | 3058 | BTRFS_SETGET_FUNCS(file_extent_disk_bytenr, struct btrfs_file_extent_item, |
@@ -3079,9 +3082,7 @@ BTRFS_SETGET_FUNCS(file_extent_other_encoding, struct btrfs_file_extent_item, | |||
3079 | static inline u32 btrfs_file_extent_inline_item_len(struct extent_buffer *eb, | 3082 | static inline u32 btrfs_file_extent_inline_item_len(struct extent_buffer *eb, |
3080 | struct btrfs_item *e) | 3083 | struct btrfs_item *e) |
3081 | { | 3084 | { |
3082 | unsigned long offset; | 3085 | return btrfs_item_size(eb, e) - BTRFS_FILE_EXTENT_INLINE_DATA_START; |
3083 | offset = offsetof(struct btrfs_file_extent_item, disk_bytenr); | ||
3084 | return btrfs_item_size(eb, e) - offset; | ||
3085 | } | 3086 | } |
3086 | 3087 | ||
3087 | /* this returns the number of file bytes represented by the inline item. | 3088 | /* this returns the number of file bytes represented by the inline item. |
@@ -4128,4 +4129,13 @@ static inline int btrfs_defrag_cancelled(struct btrfs_fs_info *fs_info) | |||
4128 | void btrfs_test_destroy_inode(struct inode *inode); | 4129 | void btrfs_test_destroy_inode(struct inode *inode); |
4129 | #endif | 4130 | #endif |
4130 | 4131 | ||
4132 | static inline int btrfs_test_is_dummy_root(struct btrfs_root *root) | ||
4133 | { | ||
4134 | #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS | ||
4135 | if (unlikely(test_bit(BTRFS_ROOT_DUMMY_ROOT, &root->state))) | ||
4136 | return 1; | ||
4137 | #endif | ||
4138 | return 0; | ||
4139 | } | ||
4140 | |||
4131 | #endif | 4141 | #endif |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index fc8dfaa27967..07d9e83f8954 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -72,21 +72,41 @@ static int btrfs_cleanup_transaction(struct btrfs_root *root); | |||
72 | static void btrfs_error_commit_super(struct btrfs_root *root); | 72 | static void btrfs_error_commit_super(struct btrfs_root *root); |
73 | 73 | ||
74 | /* | 74 | /* |
75 | * end_io_wq structs are used to do processing in task context when an IO is | 75 | * btrfs_end_io_wq structs are used to do processing in task context when an IO |
76 | * complete. This is used during reads to verify checksums, and it is used | 76 | * is complete. This is used during reads to verify checksums, and it is used |
77 | * by writes to insert metadata for new file extents after IO is complete. | 77 | * by writes to insert metadata for new file extents after IO is complete. |
78 | */ | 78 | */ |
79 | struct end_io_wq { | 79 | struct btrfs_end_io_wq { |
80 | struct bio *bio; | 80 | struct bio *bio; |
81 | bio_end_io_t *end_io; | 81 | bio_end_io_t *end_io; |
82 | void *private; | 82 | void *private; |
83 | struct btrfs_fs_info *info; | 83 | struct btrfs_fs_info *info; |
84 | int error; | 84 | int error; |
85 | int metadata; | 85 | enum btrfs_wq_endio_type metadata; |
86 | struct list_head list; | 86 | struct list_head list; |
87 | struct btrfs_work work; | 87 | struct btrfs_work work; |
88 | }; | 88 | }; |
89 | 89 | ||
90 | static struct kmem_cache *btrfs_end_io_wq_cache; | ||
91 | |||
92 | int __init btrfs_end_io_wq_init(void) | ||
93 | { | ||
94 | btrfs_end_io_wq_cache = kmem_cache_create("btrfs_end_io_wq", | ||
95 | sizeof(struct btrfs_end_io_wq), | ||
96 | 0, | ||
97 | SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, | ||
98 | NULL); | ||
99 | if (!btrfs_end_io_wq_cache) | ||
100 | return -ENOMEM; | ||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | void btrfs_end_io_wq_exit(void) | ||
105 | { | ||
106 | if (btrfs_end_io_wq_cache) | ||
107 | kmem_cache_destroy(btrfs_end_io_wq_cache); | ||
108 | } | ||
109 | |||
90 | /* | 110 | /* |
91 | * async submit bios are used to offload expensive checksumming | 111 | * async submit bios are used to offload expensive checksumming |
92 | * onto the worker threads. They checksum file and metadata bios | 112 | * onto the worker threads. They checksum file and metadata bios |
@@ -327,8 +347,7 @@ static int verify_parent_transid(struct extent_io_tree *io_tree, | |||
327 | { | 347 | { |
328 | struct extent_state *cached_state = NULL; | 348 | struct extent_state *cached_state = NULL; |
329 | int ret; | 349 | int ret; |
330 | bool need_lock = (current->journal_info == | 350 | bool need_lock = (current->journal_info == BTRFS_SEND_TRANS_STUB); |
331 | (void *)BTRFS_SEND_TRANS_STUB); | ||
332 | 351 | ||
333 | if (!parent_transid || btrfs_header_generation(eb) == parent_transid) | 352 | if (!parent_transid || btrfs_header_generation(eb) == parent_transid) |
334 | return 0; | 353 | return 0; |
@@ -690,7 +709,7 @@ static int btree_io_failed_hook(struct page *page, int failed_mirror) | |||
690 | 709 | ||
691 | static void end_workqueue_bio(struct bio *bio, int err) | 710 | static void end_workqueue_bio(struct bio *bio, int err) |
692 | { | 711 | { |
693 | struct end_io_wq *end_io_wq = bio->bi_private; | 712 | struct btrfs_end_io_wq *end_io_wq = bio->bi_private; |
694 | struct btrfs_fs_info *fs_info; | 713 | struct btrfs_fs_info *fs_info; |
695 | struct btrfs_workqueue *wq; | 714 | struct btrfs_workqueue *wq; |
696 | btrfs_work_func_t func; | 715 | btrfs_work_func_t func; |
@@ -733,20 +752,12 @@ static void end_workqueue_bio(struct bio *bio, int err) | |||
733 | btrfs_queue_work(wq, &end_io_wq->work); | 752 | btrfs_queue_work(wq, &end_io_wq->work); |
734 | } | 753 | } |
735 | 754 | ||
736 | /* | ||
737 | * For the metadata arg you want | ||
738 | * | ||
739 | * 0 - if data | ||
740 | * 1 - if normal metadta | ||
741 | * 2 - if writing to the free space cache area | ||
742 | * 3 - raid parity work | ||
743 | */ | ||
744 | int btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio, | 755 | int btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio, |
745 | int metadata) | 756 | enum btrfs_wq_endio_type metadata) |
746 | { | 757 | { |
747 | struct end_io_wq *end_io_wq; | 758 | struct btrfs_end_io_wq *end_io_wq; |
748 | 759 | ||
749 | end_io_wq = kmalloc(sizeof(*end_io_wq), GFP_NOFS); | 760 | end_io_wq = kmem_cache_alloc(btrfs_end_io_wq_cache, GFP_NOFS); |
750 | if (!end_io_wq) | 761 | if (!end_io_wq) |
751 | return -ENOMEM; | 762 | return -ENOMEM; |
752 | 763 | ||
@@ -930,7 +941,7 @@ static int btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio, | |||
930 | * can happen in the async kernel threads | 941 | * can happen in the async kernel threads |
931 | */ | 942 | */ |
932 | ret = btrfs_bio_wq_end_io(BTRFS_I(inode)->root->fs_info, | 943 | ret = btrfs_bio_wq_end_io(BTRFS_I(inode)->root->fs_info, |
933 | bio, 1); | 944 | bio, BTRFS_WQ_ENDIO_METADATA); |
934 | if (ret) | 945 | if (ret) |
935 | goto out_w_error; | 946 | goto out_w_error; |
936 | ret = btrfs_map_bio(BTRFS_I(inode)->root, rw, bio, | 947 | ret = btrfs_map_bio(BTRFS_I(inode)->root, rw, bio, |
@@ -1119,11 +1130,9 @@ struct extent_buffer *btrfs_find_tree_block(struct btrfs_root *root, | |||
1119 | struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root, | 1130 | struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root, |
1120 | u64 bytenr, u32 blocksize) | 1131 | u64 bytenr, u32 blocksize) |
1121 | { | 1132 | { |
1122 | #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS | 1133 | if (btrfs_test_is_dummy_root(root)) |
1123 | if (unlikely(test_bit(BTRFS_ROOT_DUMMY_ROOT, &root->state))) | ||
1124 | return alloc_test_extent_buffer(root->fs_info, bytenr, | 1134 | return alloc_test_extent_buffer(root->fs_info, bytenr, |
1125 | blocksize); | 1135 | blocksize); |
1126 | #endif | ||
1127 | return alloc_extent_buffer(root->fs_info, bytenr, blocksize); | 1136 | return alloc_extent_buffer(root->fs_info, bytenr, blocksize); |
1128 | } | 1137 | } |
1129 | 1138 | ||
@@ -1731,16 +1740,16 @@ static int setup_bdi(struct btrfs_fs_info *info, struct backing_dev_info *bdi) | |||
1731 | static void end_workqueue_fn(struct btrfs_work *work) | 1740 | static void end_workqueue_fn(struct btrfs_work *work) |
1732 | { | 1741 | { |
1733 | struct bio *bio; | 1742 | struct bio *bio; |
1734 | struct end_io_wq *end_io_wq; | 1743 | struct btrfs_end_io_wq *end_io_wq; |
1735 | int error; | 1744 | int error; |
1736 | 1745 | ||
1737 | end_io_wq = container_of(work, struct end_io_wq, work); | 1746 | end_io_wq = container_of(work, struct btrfs_end_io_wq, work); |
1738 | bio = end_io_wq->bio; | 1747 | bio = end_io_wq->bio; |
1739 | 1748 | ||
1740 | error = end_io_wq->error; | 1749 | error = end_io_wq->error; |
1741 | bio->bi_private = end_io_wq->private; | 1750 | bio->bi_private = end_io_wq->private; |
1742 | bio->bi_end_io = end_io_wq->end_io; | 1751 | bio->bi_end_io = end_io_wq->end_io; |
1743 | kfree(end_io_wq); | 1752 | kmem_cache_free(btrfs_end_io_wq_cache, end_io_wq); |
1744 | bio_endio_nodec(bio, error); | 1753 | bio_endio_nodec(bio, error); |
1745 | } | 1754 | } |
1746 | 1755 | ||
@@ -2260,7 +2269,7 @@ int open_ctree(struct super_block *sb, | |||
2260 | atomic_set(&fs_info->qgroup_op_seq, 0); | 2269 | atomic_set(&fs_info->qgroup_op_seq, 0); |
2261 | atomic64_set(&fs_info->tree_mod_seq, 0); | 2270 | atomic64_set(&fs_info->tree_mod_seq, 0); |
2262 | fs_info->sb = sb; | 2271 | fs_info->sb = sb; |
2263 | fs_info->max_inline = 8192 * 1024; | 2272 | fs_info->max_inline = BTRFS_DEFAULT_MAX_INLINE; |
2264 | fs_info->metadata_ratio = 0; | 2273 | fs_info->metadata_ratio = 0; |
2265 | fs_info->defrag_inodes = RB_ROOT; | 2274 | fs_info->defrag_inodes = RB_ROOT; |
2266 | fs_info->free_chunk_space = 0; | 2275 | fs_info->free_chunk_space = 0; |
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h index 14d06ee1e143..9ac233923ca3 100644 --- a/fs/btrfs/disk-io.h +++ b/fs/btrfs/disk-io.h | |||
@@ -25,7 +25,7 @@ | |||
25 | #define BTRFS_SUPER_MIRROR_MAX 3 | 25 | #define BTRFS_SUPER_MIRROR_MAX 3 |
26 | #define BTRFS_SUPER_MIRROR_SHIFT 12 | 26 | #define BTRFS_SUPER_MIRROR_SHIFT 12 |
27 | 27 | ||
28 | enum { | 28 | enum btrfs_wq_endio_type { |
29 | BTRFS_WQ_ENDIO_DATA = 0, | 29 | BTRFS_WQ_ENDIO_DATA = 0, |
30 | BTRFS_WQ_ENDIO_METADATA = 1, | 30 | BTRFS_WQ_ENDIO_METADATA = 1, |
31 | BTRFS_WQ_ENDIO_FREE_SPACE = 2, | 31 | BTRFS_WQ_ENDIO_FREE_SPACE = 2, |
@@ -120,7 +120,7 @@ int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid); | |||
120 | u32 btrfs_csum_data(char *data, u32 seed, size_t len); | 120 | u32 btrfs_csum_data(char *data, u32 seed, size_t len); |
121 | void btrfs_csum_final(u32 crc, char *result); | 121 | void btrfs_csum_final(u32 crc, char *result); |
122 | int btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio, | 122 | int btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio, |
123 | int metadata); | 123 | enum btrfs_wq_endio_type metadata); |
124 | int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode, | 124 | int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode, |
125 | int rw, struct bio *bio, int mirror_num, | 125 | int rw, struct bio *bio, int mirror_num, |
126 | unsigned long bio_flags, u64 bio_offset, | 126 | unsigned long bio_flags, u64 bio_offset, |
@@ -142,6 +142,8 @@ int btree_lock_page_hook(struct page *page, void *data, | |||
142 | void (*flush_fn)(void *)); | 142 | void (*flush_fn)(void *)); |
143 | int btrfs_calc_num_tolerated_disk_barrier_failures( | 143 | int btrfs_calc_num_tolerated_disk_barrier_failures( |
144 | struct btrfs_fs_info *fs_info); | 144 | struct btrfs_fs_info *fs_info); |
145 | int __init btrfs_end_io_wq_init(void); | ||
146 | void btrfs_end_io_wq_exit(void); | ||
145 | 147 | ||
146 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 148 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
147 | void btrfs_init_lockdep(void); | 149 | void btrfs_init_lockdep(void); |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 8ebe6bf66e78..23940cc207e8 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -3073,10 +3073,10 @@ static int __btrfs_mod_ref(struct btrfs_trans_handle *trans, | |||
3073 | int (*process_func)(struct btrfs_trans_handle *, struct btrfs_root *, | 3073 | int (*process_func)(struct btrfs_trans_handle *, struct btrfs_root *, |
3074 | u64, u64, u64, u64, u64, u64, int); | 3074 | u64, u64, u64, u64, u64, u64, int); |
3075 | 3075 | ||
3076 | #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS | 3076 | |
3077 | if (unlikely(test_bit(BTRFS_ROOT_DUMMY_ROOT, &root->state))) | 3077 | if (btrfs_test_is_dummy_root(root)) |
3078 | return 0; | 3078 | return 0; |
3079 | #endif | 3079 | |
3080 | ref_root = btrfs_header_owner(buf); | 3080 | ref_root = btrfs_header_owner(buf); |
3081 | nritems = btrfs_header_nritems(buf); | 3081 | nritems = btrfs_header_nritems(buf); |
3082 | level = btrfs_header_level(buf); | 3082 | level = btrfs_header_level(buf); |
@@ -6264,10 +6264,9 @@ int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root *root, | |||
6264 | int ret; | 6264 | int ret; |
6265 | struct btrfs_fs_info *fs_info = root->fs_info; | 6265 | struct btrfs_fs_info *fs_info = root->fs_info; |
6266 | 6266 | ||
6267 | #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS | 6267 | if (btrfs_test_is_dummy_root(root)) |
6268 | if (unlikely(test_bit(BTRFS_ROOT_DUMMY_ROOT, &root->state))) | ||
6269 | return 0; | 6268 | return 0; |
6270 | #endif | 6269 | |
6271 | add_pinned_bytes(root->fs_info, num_bytes, owner, root_objectid); | 6270 | add_pinned_bytes(root->fs_info, num_bytes, owner, root_objectid); |
6272 | 6271 | ||
6273 | /* | 6272 | /* |
@@ -7338,15 +7337,14 @@ struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, | |||
7338 | bool skinny_metadata = btrfs_fs_incompat(root->fs_info, | 7337 | bool skinny_metadata = btrfs_fs_incompat(root->fs_info, |
7339 | SKINNY_METADATA); | 7338 | SKINNY_METADATA); |
7340 | 7339 | ||
7341 | #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS | 7340 | if (btrfs_test_is_dummy_root(root)) { |
7342 | if (unlikely(test_bit(BTRFS_ROOT_DUMMY_ROOT, &root->state))) { | ||
7343 | buf = btrfs_init_new_buffer(trans, root, root->alloc_bytenr, | 7341 | buf = btrfs_init_new_buffer(trans, root, root->alloc_bytenr, |
7344 | blocksize, level); | 7342 | blocksize, level); |
7345 | if (!IS_ERR(buf)) | 7343 | if (!IS_ERR(buf)) |
7346 | root->alloc_bytenr += blocksize; | 7344 | root->alloc_bytenr += blocksize; |
7347 | return buf; | 7345 | return buf; |
7348 | } | 7346 | } |
7349 | #endif | 7347 | |
7350 | block_rsv = use_block_rsv(trans, root, blocksize); | 7348 | block_rsv = use_block_rsv(trans, root, blocksize); |
7351 | if (IS_ERR(block_rsv)) | 7349 | if (IS_ERR(block_rsv)) |
7352 | return ERR_CAST(block_rsv); | 7350 | return ERR_CAST(block_rsv); |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 215603b911f1..bf3f424e0013 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -2064,7 +2064,7 @@ int repair_eb_io_failure(struct btrfs_root *root, struct extent_buffer *eb, | |||
2064 | return -EROFS; | 2064 | return -EROFS; |
2065 | 2065 | ||
2066 | for (i = 0; i < num_pages; i++) { | 2066 | for (i = 0; i < num_pages; i++) { |
2067 | struct page *p = extent_buffer_page(eb, i); | 2067 | struct page *p = eb->pages[i]; |
2068 | 2068 | ||
2069 | ret = repair_io_failure(root->fs_info->btree_inode, start, | 2069 | ret = repair_io_failure(root->fs_info->btree_inode, start, |
2070 | PAGE_CACHE_SIZE, start, p, | 2070 | PAGE_CACHE_SIZE, start, p, |
@@ -3580,7 +3580,7 @@ lock_extent_buffer_for_io(struct extent_buffer *eb, | |||
3580 | 3580 | ||
3581 | num_pages = num_extent_pages(eb->start, eb->len); | 3581 | num_pages = num_extent_pages(eb->start, eb->len); |
3582 | for (i = 0; i < num_pages; i++) { | 3582 | for (i = 0; i < num_pages; i++) { |
3583 | struct page *p = extent_buffer_page(eb, i); | 3583 | struct page *p = eb->pages[i]; |
3584 | 3584 | ||
3585 | if (!trylock_page(p)) { | 3585 | if (!trylock_page(p)) { |
3586 | if (!flush) { | 3586 | if (!flush) { |
@@ -3712,7 +3712,7 @@ static noinline_for_stack int write_one_eb(struct extent_buffer *eb, | |||
3712 | bio_flags = EXTENT_BIO_TREE_LOG; | 3712 | bio_flags = EXTENT_BIO_TREE_LOG; |
3713 | 3713 | ||
3714 | for (i = 0; i < num_pages; i++) { | 3714 | for (i = 0; i < num_pages; i++) { |
3715 | struct page *p = extent_buffer_page(eb, i); | 3715 | struct page *p = eb->pages[i]; |
3716 | 3716 | ||
3717 | clear_page_dirty_for_io(p); | 3717 | clear_page_dirty_for_io(p); |
3718 | set_page_writeback(p); | 3718 | set_page_writeback(p); |
@@ -3736,7 +3736,7 @@ static noinline_for_stack int write_one_eb(struct extent_buffer *eb, | |||
3736 | 3736 | ||
3737 | if (unlikely(ret)) { | 3737 | if (unlikely(ret)) { |
3738 | for (; i < num_pages; i++) { | 3738 | for (; i < num_pages; i++) { |
3739 | struct page *p = extent_buffer_page(eb, i); | 3739 | struct page *p = eb->pages[i]; |
3740 | clear_page_dirty_for_io(p); | 3740 | clear_page_dirty_for_io(p); |
3741 | unlock_page(p); | 3741 | unlock_page(p); |
3742 | } | 3742 | } |
@@ -4512,24 +4512,21 @@ int extent_buffer_under_io(struct extent_buffer *eb) | |||
4512 | /* | 4512 | /* |
4513 | * Helper for releasing extent buffer page. | 4513 | * Helper for releasing extent buffer page. |
4514 | */ | 4514 | */ |
4515 | static void btrfs_release_extent_buffer_page(struct extent_buffer *eb, | 4515 | static void btrfs_release_extent_buffer_page(struct extent_buffer *eb) |
4516 | unsigned long start_idx) | ||
4517 | { | 4516 | { |
4518 | unsigned long index; | 4517 | unsigned long index; |
4519 | unsigned long num_pages; | ||
4520 | struct page *page; | 4518 | struct page *page; |
4521 | int mapped = !test_bit(EXTENT_BUFFER_DUMMY, &eb->bflags); | 4519 | int mapped = !test_bit(EXTENT_BUFFER_DUMMY, &eb->bflags); |
4522 | 4520 | ||
4523 | BUG_ON(extent_buffer_under_io(eb)); | 4521 | BUG_ON(extent_buffer_under_io(eb)); |
4524 | 4522 | ||
4525 | num_pages = num_extent_pages(eb->start, eb->len); | 4523 | index = num_extent_pages(eb->start, eb->len); |
4526 | index = start_idx + num_pages; | 4524 | if (index == 0) |
4527 | if (start_idx >= index) | ||
4528 | return; | 4525 | return; |
4529 | 4526 | ||
4530 | do { | 4527 | do { |
4531 | index--; | 4528 | index--; |
4532 | page = extent_buffer_page(eb, index); | 4529 | page = eb->pages[index]; |
4533 | if (page && mapped) { | 4530 | if (page && mapped) { |
4534 | spin_lock(&page->mapping->private_lock); | 4531 | spin_lock(&page->mapping->private_lock); |
4535 | /* | 4532 | /* |
@@ -4560,7 +4557,7 @@ static void btrfs_release_extent_buffer_page(struct extent_buffer *eb, | |||
4560 | /* One for when we alloced the page */ | 4557 | /* One for when we alloced the page */ |
4561 | page_cache_release(page); | 4558 | page_cache_release(page); |
4562 | } | 4559 | } |
4563 | } while (index != start_idx); | 4560 | } while (index != 0); |
4564 | } | 4561 | } |
4565 | 4562 | ||
4566 | /* | 4563 | /* |
@@ -4568,7 +4565,7 @@ static void btrfs_release_extent_buffer_page(struct extent_buffer *eb, | |||
4568 | */ | 4565 | */ |
4569 | static inline void btrfs_release_extent_buffer(struct extent_buffer *eb) | 4566 | static inline void btrfs_release_extent_buffer(struct extent_buffer *eb) |
4570 | { | 4567 | { |
4571 | btrfs_release_extent_buffer_page(eb, 0); | 4568 | btrfs_release_extent_buffer_page(eb); |
4572 | __free_extent_buffer(eb); | 4569 | __free_extent_buffer(eb); |
4573 | } | 4570 | } |
4574 | 4571 | ||
@@ -4711,7 +4708,8 @@ static void mark_extent_buffer_accessed(struct extent_buffer *eb, | |||
4711 | 4708 | ||
4712 | num_pages = num_extent_pages(eb->start, eb->len); | 4709 | num_pages = num_extent_pages(eb->start, eb->len); |
4713 | for (i = 0; i < num_pages; i++) { | 4710 | for (i = 0; i < num_pages; i++) { |
4714 | struct page *p = extent_buffer_page(eb, i); | 4711 | struct page *p = eb->pages[i]; |
4712 | |||
4715 | if (p != accessed) | 4713 | if (p != accessed) |
4716 | mark_page_accessed(p); | 4714 | mark_page_accessed(p); |
4717 | } | 4715 | } |
@@ -4880,7 +4878,7 @@ again: | |||
4880 | */ | 4878 | */ |
4881 | SetPageChecked(eb->pages[0]); | 4879 | SetPageChecked(eb->pages[0]); |
4882 | for (i = 1; i < num_pages; i++) { | 4880 | for (i = 1; i < num_pages; i++) { |
4883 | p = extent_buffer_page(eb, i); | 4881 | p = eb->pages[i]; |
4884 | ClearPageChecked(p); | 4882 | ClearPageChecked(p); |
4885 | unlock_page(p); | 4883 | unlock_page(p); |
4886 | } | 4884 | } |
@@ -4925,7 +4923,7 @@ static int release_extent_buffer(struct extent_buffer *eb) | |||
4925 | } | 4923 | } |
4926 | 4924 | ||
4927 | /* Should be safe to release our pages at this point */ | 4925 | /* Should be safe to release our pages at this point */ |
4928 | btrfs_release_extent_buffer_page(eb, 0); | 4926 | btrfs_release_extent_buffer_page(eb); |
4929 | call_rcu(&eb->rcu_head, btrfs_release_extent_buffer_rcu); | 4927 | call_rcu(&eb->rcu_head, btrfs_release_extent_buffer_rcu); |
4930 | return 1; | 4928 | return 1; |
4931 | } | 4929 | } |
@@ -4991,7 +4989,7 @@ void clear_extent_buffer_dirty(struct extent_buffer *eb) | |||
4991 | num_pages = num_extent_pages(eb->start, eb->len); | 4989 | num_pages = num_extent_pages(eb->start, eb->len); |
4992 | 4990 | ||
4993 | for (i = 0; i < num_pages; i++) { | 4991 | for (i = 0; i < num_pages; i++) { |
4994 | page = extent_buffer_page(eb, i); | 4992 | page = eb->pages[i]; |
4995 | if (!PageDirty(page)) | 4993 | if (!PageDirty(page)) |
4996 | continue; | 4994 | continue; |
4997 | 4995 | ||
@@ -5027,7 +5025,7 @@ int set_extent_buffer_dirty(struct extent_buffer *eb) | |||
5027 | WARN_ON(!test_bit(EXTENT_BUFFER_TREE_REF, &eb->bflags)); | 5025 | WARN_ON(!test_bit(EXTENT_BUFFER_TREE_REF, &eb->bflags)); |
5028 | 5026 | ||
5029 | for (i = 0; i < num_pages; i++) | 5027 | for (i = 0; i < num_pages; i++) |
5030 | set_page_dirty(extent_buffer_page(eb, i)); | 5028 | set_page_dirty(eb->pages[i]); |
5031 | return was_dirty; | 5029 | return was_dirty; |
5032 | } | 5030 | } |
5033 | 5031 | ||
@@ -5040,7 +5038,7 @@ int clear_extent_buffer_uptodate(struct extent_buffer *eb) | |||
5040 | clear_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags); | 5038 | clear_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags); |
5041 | num_pages = num_extent_pages(eb->start, eb->len); | 5039 | num_pages = num_extent_pages(eb->start, eb->len); |
5042 | for (i = 0; i < num_pages; i++) { | 5040 | for (i = 0; i < num_pages; i++) { |
5043 | page = extent_buffer_page(eb, i); | 5041 | page = eb->pages[i]; |
5044 | if (page) | 5042 | if (page) |
5045 | ClearPageUptodate(page); | 5043 | ClearPageUptodate(page); |
5046 | } | 5044 | } |
@@ -5056,7 +5054,7 @@ int set_extent_buffer_uptodate(struct extent_buffer *eb) | |||
5056 | set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags); | 5054 | set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags); |
5057 | num_pages = num_extent_pages(eb->start, eb->len); | 5055 | num_pages = num_extent_pages(eb->start, eb->len); |
5058 | for (i = 0; i < num_pages; i++) { | 5056 | for (i = 0; i < num_pages; i++) { |
5059 | page = extent_buffer_page(eb, i); | 5057 | page = eb->pages[i]; |
5060 | SetPageUptodate(page); | 5058 | SetPageUptodate(page); |
5061 | } | 5059 | } |
5062 | return 0; | 5060 | return 0; |
@@ -5096,7 +5094,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, | |||
5096 | 5094 | ||
5097 | num_pages = num_extent_pages(eb->start, eb->len); | 5095 | num_pages = num_extent_pages(eb->start, eb->len); |
5098 | for (i = start_i; i < num_pages; i++) { | 5096 | for (i = start_i; i < num_pages; i++) { |
5099 | page = extent_buffer_page(eb, i); | 5097 | page = eb->pages[i]; |
5100 | if (wait == WAIT_NONE) { | 5098 | if (wait == WAIT_NONE) { |
5101 | if (!trylock_page(page)) | 5099 | if (!trylock_page(page)) |
5102 | goto unlock_exit; | 5100 | goto unlock_exit; |
@@ -5119,7 +5117,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, | |||
5119 | eb->read_mirror = 0; | 5117 | eb->read_mirror = 0; |
5120 | atomic_set(&eb->io_pages, num_reads); | 5118 | atomic_set(&eb->io_pages, num_reads); |
5121 | for (i = start_i; i < num_pages; i++) { | 5119 | for (i = start_i; i < num_pages; i++) { |
5122 | page = extent_buffer_page(eb, i); | 5120 | page = eb->pages[i]; |
5123 | if (!PageUptodate(page)) { | 5121 | if (!PageUptodate(page)) { |
5124 | ClearPageError(page); | 5122 | ClearPageError(page); |
5125 | err = __extent_read_full_page(tree, page, | 5123 | err = __extent_read_full_page(tree, page, |
@@ -5144,7 +5142,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, | |||
5144 | return ret; | 5142 | return ret; |
5145 | 5143 | ||
5146 | for (i = start_i; i < num_pages; i++) { | 5144 | for (i = start_i; i < num_pages; i++) { |
5147 | page = extent_buffer_page(eb, i); | 5145 | page = eb->pages[i]; |
5148 | wait_on_page_locked(page); | 5146 | wait_on_page_locked(page); |
5149 | if (!PageUptodate(page)) | 5147 | if (!PageUptodate(page)) |
5150 | ret = -EIO; | 5148 | ret = -EIO; |
@@ -5155,7 +5153,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, | |||
5155 | unlock_exit: | 5153 | unlock_exit: |
5156 | i = start_i; | 5154 | i = start_i; |
5157 | while (locked_pages > 0) { | 5155 | while (locked_pages > 0) { |
5158 | page = extent_buffer_page(eb, i); | 5156 | page = eb->pages[i]; |
5159 | i++; | 5157 | i++; |
5160 | unlock_page(page); | 5158 | unlock_page(page); |
5161 | locked_pages--; | 5159 | locked_pages--; |
@@ -5181,7 +5179,7 @@ void read_extent_buffer(struct extent_buffer *eb, void *dstv, | |||
5181 | offset = (start_offset + start) & (PAGE_CACHE_SIZE - 1); | 5179 | offset = (start_offset + start) & (PAGE_CACHE_SIZE - 1); |
5182 | 5180 | ||
5183 | while (len > 0) { | 5181 | while (len > 0) { |
5184 | page = extent_buffer_page(eb, i); | 5182 | page = eb->pages[i]; |
5185 | 5183 | ||
5186 | cur = min(len, (PAGE_CACHE_SIZE - offset)); | 5184 | cur = min(len, (PAGE_CACHE_SIZE - offset)); |
5187 | kaddr = page_address(page); | 5185 | kaddr = page_address(page); |
@@ -5213,7 +5211,7 @@ int read_extent_buffer_to_user(struct extent_buffer *eb, void __user *dstv, | |||
5213 | offset = (start_offset + start) & (PAGE_CACHE_SIZE - 1); | 5211 | offset = (start_offset + start) & (PAGE_CACHE_SIZE - 1); |
5214 | 5212 | ||
5215 | while (len > 0) { | 5213 | while (len > 0) { |
5216 | page = extent_buffer_page(eb, i); | 5214 | page = eb->pages[i]; |
5217 | 5215 | ||
5218 | cur = min(len, (PAGE_CACHE_SIZE - offset)); | 5216 | cur = min(len, (PAGE_CACHE_SIZE - offset)); |
5219 | kaddr = page_address(page); | 5217 | kaddr = page_address(page); |
@@ -5262,7 +5260,7 @@ int map_private_extent_buffer(struct extent_buffer *eb, unsigned long start, | |||
5262 | return -EINVAL; | 5260 | return -EINVAL; |
5263 | } | 5261 | } |
5264 | 5262 | ||
5265 | p = extent_buffer_page(eb, i); | 5263 | p = eb->pages[i]; |
5266 | kaddr = page_address(p); | 5264 | kaddr = page_address(p); |
5267 | *map = kaddr + offset; | 5265 | *map = kaddr + offset; |
5268 | *map_len = PAGE_CACHE_SIZE - offset; | 5266 | *map_len = PAGE_CACHE_SIZE - offset; |
@@ -5288,7 +5286,7 @@ int memcmp_extent_buffer(struct extent_buffer *eb, const void *ptrv, | |||
5288 | offset = (start_offset + start) & (PAGE_CACHE_SIZE - 1); | 5286 | offset = (start_offset + start) & (PAGE_CACHE_SIZE - 1); |
5289 | 5287 | ||
5290 | while (len > 0) { | 5288 | while (len > 0) { |
5291 | page = extent_buffer_page(eb, i); | 5289 | page = eb->pages[i]; |
5292 | 5290 | ||
5293 | cur = min(len, (PAGE_CACHE_SIZE - offset)); | 5291 | cur = min(len, (PAGE_CACHE_SIZE - offset)); |
5294 | 5292 | ||
@@ -5322,7 +5320,7 @@ void write_extent_buffer(struct extent_buffer *eb, const void *srcv, | |||
5322 | offset = (start_offset + start) & (PAGE_CACHE_SIZE - 1); | 5320 | offset = (start_offset + start) & (PAGE_CACHE_SIZE - 1); |
5323 | 5321 | ||
5324 | while (len > 0) { | 5322 | while (len > 0) { |
5325 | page = extent_buffer_page(eb, i); | 5323 | page = eb->pages[i]; |
5326 | WARN_ON(!PageUptodate(page)); | 5324 | WARN_ON(!PageUptodate(page)); |
5327 | 5325 | ||
5328 | cur = min(len, PAGE_CACHE_SIZE - offset); | 5326 | cur = min(len, PAGE_CACHE_SIZE - offset); |
@@ -5352,7 +5350,7 @@ void memset_extent_buffer(struct extent_buffer *eb, char c, | |||
5352 | offset = (start_offset + start) & (PAGE_CACHE_SIZE - 1); | 5350 | offset = (start_offset + start) & (PAGE_CACHE_SIZE - 1); |
5353 | 5351 | ||
5354 | while (len > 0) { | 5352 | while (len > 0) { |
5355 | page = extent_buffer_page(eb, i); | 5353 | page = eb->pages[i]; |
5356 | WARN_ON(!PageUptodate(page)); | 5354 | WARN_ON(!PageUptodate(page)); |
5357 | 5355 | ||
5358 | cur = min(len, PAGE_CACHE_SIZE - offset); | 5356 | cur = min(len, PAGE_CACHE_SIZE - offset); |
@@ -5383,7 +5381,7 @@ void copy_extent_buffer(struct extent_buffer *dst, struct extent_buffer *src, | |||
5383 | (PAGE_CACHE_SIZE - 1); | 5381 | (PAGE_CACHE_SIZE - 1); |
5384 | 5382 | ||
5385 | while (len > 0) { | 5383 | while (len > 0) { |
5386 | page = extent_buffer_page(dst, i); | 5384 | page = dst->pages[i]; |
5387 | WARN_ON(!PageUptodate(page)); | 5385 | WARN_ON(!PageUptodate(page)); |
5388 | 5386 | ||
5389 | cur = min(len, (unsigned long)(PAGE_CACHE_SIZE - offset)); | 5387 | cur = min(len, (unsigned long)(PAGE_CACHE_SIZE - offset)); |
@@ -5461,8 +5459,7 @@ void memcpy_extent_buffer(struct extent_buffer *dst, unsigned long dst_offset, | |||
5461 | cur = min_t(unsigned long, cur, | 5459 | cur = min_t(unsigned long, cur, |
5462 | (unsigned long)(PAGE_CACHE_SIZE - dst_off_in_page)); | 5460 | (unsigned long)(PAGE_CACHE_SIZE - dst_off_in_page)); |
5463 | 5461 | ||
5464 | copy_pages(extent_buffer_page(dst, dst_i), | 5462 | copy_pages(dst->pages[dst_i], dst->pages[src_i], |
5465 | extent_buffer_page(dst, src_i), | ||
5466 | dst_off_in_page, src_off_in_page, cur); | 5463 | dst_off_in_page, src_off_in_page, cur); |
5467 | 5464 | ||
5468 | src_offset += cur; | 5465 | src_offset += cur; |
@@ -5508,8 +5505,7 @@ void memmove_extent_buffer(struct extent_buffer *dst, unsigned long dst_offset, | |||
5508 | 5505 | ||
5509 | cur = min_t(unsigned long, len, src_off_in_page + 1); | 5506 | cur = min_t(unsigned long, len, src_off_in_page + 1); |
5510 | cur = min(cur, dst_off_in_page + 1); | 5507 | cur = min(cur, dst_off_in_page + 1); |
5511 | copy_pages(extent_buffer_page(dst, dst_i), | 5508 | copy_pages(dst->pages[dst_i], dst->pages[src_i], |
5512 | extent_buffer_page(dst, src_i), | ||
5513 | dst_off_in_page - cur + 1, | 5509 | dst_off_in_page - cur + 1, |
5514 | src_off_in_page - cur + 1, cur); | 5510 | src_off_in_page - cur + 1, cur); |
5515 | 5511 | ||
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index 06f030c0084c..f40d67f5866b 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h | |||
@@ -11,8 +11,6 @@ | |||
11 | #define EXTENT_NEW (1 << 4) | 11 | #define EXTENT_NEW (1 << 4) |
12 | #define EXTENT_DELALLOC (1 << 5) | 12 | #define EXTENT_DELALLOC (1 << 5) |
13 | #define EXTENT_DEFRAG (1 << 6) | 13 | #define EXTENT_DEFRAG (1 << 6) |
14 | #define EXTENT_DEFRAG_DONE (1 << 7) | ||
15 | #define EXTENT_BUFFER_FILLED (1 << 8) | ||
16 | #define EXTENT_BOUNDARY (1 << 9) | 14 | #define EXTENT_BOUNDARY (1 << 9) |
17 | #define EXTENT_NODATASUM (1 << 10) | 15 | #define EXTENT_NODATASUM (1 << 10) |
18 | #define EXTENT_DO_ACCOUNTING (1 << 11) | 16 | #define EXTENT_DO_ACCOUNTING (1 << 11) |
@@ -34,7 +32,6 @@ | |||
34 | 32 | ||
35 | /* these are bit numbers for test/set bit */ | 33 | /* these are bit numbers for test/set bit */ |
36 | #define EXTENT_BUFFER_UPTODATE 0 | 34 | #define EXTENT_BUFFER_UPTODATE 0 |
37 | #define EXTENT_BUFFER_BLOCKING 1 | ||
38 | #define EXTENT_BUFFER_DIRTY 2 | 35 | #define EXTENT_BUFFER_DIRTY 2 |
39 | #define EXTENT_BUFFER_CORRUPT 3 | 36 | #define EXTENT_BUFFER_CORRUPT 3 |
40 | #define EXTENT_BUFFER_READAHEAD 4 /* this got triggered by readahead */ | 37 | #define EXTENT_BUFFER_READAHEAD 4 /* this got triggered by readahead */ |
@@ -58,7 +55,6 @@ | |||
58 | * map has page->private set to one. | 55 | * map has page->private set to one. |
59 | */ | 56 | */ |
60 | #define EXTENT_PAGE_PRIVATE 1 | 57 | #define EXTENT_PAGE_PRIVATE 1 |
61 | #define EXTENT_PAGE_PRIVATE_FIRST_PAGE 3 | ||
62 | 58 | ||
63 | struct extent_state; | 59 | struct extent_state; |
64 | struct btrfs_root; | 60 | struct btrfs_root; |
@@ -286,12 +282,6 @@ static inline unsigned long num_extent_pages(u64 start, u64 len) | |||
286 | (start >> PAGE_CACHE_SHIFT); | 282 | (start >> PAGE_CACHE_SHIFT); |
287 | } | 283 | } |
288 | 284 | ||
289 | static inline struct page *extent_buffer_page(struct extent_buffer *eb, | ||
290 | unsigned long i) | ||
291 | { | ||
292 | return eb->pages[i]; | ||
293 | } | ||
294 | |||
295 | static inline void extent_buffer_get(struct extent_buffer *eb) | 285 | static inline void extent_buffer_get(struct extent_buffer *eb) |
296 | { | 286 | { |
297 | atomic_inc(&eb->refs); | 287 | atomic_inc(&eb->refs); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index ef6fc587d964..6c4da8446397 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -7721,7 +7721,8 @@ static inline int __btrfs_submit_dio_bio(struct bio *bio, struct inode *inode, | |||
7721 | bio_get(bio); | 7721 | bio_get(bio); |
7722 | 7722 | ||
7723 | if (!write) { | 7723 | if (!write) { |
7724 | ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0); | 7724 | ret = btrfs_bio_wq_end_io(root->fs_info, bio, |
7725 | BTRFS_WQ_ENDIO_DATA); | ||
7725 | if (ret) | 7726 | if (ret) |
7726 | goto err; | 7727 | goto err; |
7727 | } | 7728 | } |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 0ff212757b95..87a7267a6bb2 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -885,7 +885,7 @@ out_unlock: | |||
885 | * file you want to defrag, we return 0 to let you know to skip this | 885 | * file you want to defrag, we return 0 to let you know to skip this |
886 | * part of the file | 886 | * part of the file |
887 | */ | 887 | */ |
888 | static int check_defrag_in_cache(struct inode *inode, u64 offset, int thresh) | 888 | static int check_defrag_in_cache(struct inode *inode, u64 offset, u32 thresh) |
889 | { | 889 | { |
890 | struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; | 890 | struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; |
891 | struct extent_map *em = NULL; | 891 | struct extent_map *em = NULL; |
@@ -920,7 +920,7 @@ static int check_defrag_in_cache(struct inode *inode, u64 offset, int thresh) | |||
920 | */ | 920 | */ |
921 | static int find_new_extents(struct btrfs_root *root, | 921 | static int find_new_extents(struct btrfs_root *root, |
922 | struct inode *inode, u64 newer_than, | 922 | struct inode *inode, u64 newer_than, |
923 | u64 *off, int thresh) | 923 | u64 *off, u32 thresh) |
924 | { | 924 | { |
925 | struct btrfs_path *path; | 925 | struct btrfs_path *path; |
926 | struct btrfs_key min_key; | 926 | struct btrfs_key min_key; |
@@ -1029,7 +1029,7 @@ static bool defrag_check_next_extent(struct inode *inode, struct extent_map *em) | |||
1029 | return ret; | 1029 | return ret; |
1030 | } | 1030 | } |
1031 | 1031 | ||
1032 | static int should_defrag_range(struct inode *inode, u64 start, int thresh, | 1032 | static int should_defrag_range(struct inode *inode, u64 start, u32 thresh, |
1033 | u64 *last_len, u64 *skip, u64 *defrag_end, | 1033 | u64 *last_len, u64 *skip, u64 *defrag_end, |
1034 | int compress) | 1034 | int compress) |
1035 | { | 1035 | { |
@@ -1259,7 +1259,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file, | |||
1259 | int ret; | 1259 | int ret; |
1260 | int defrag_count = 0; | 1260 | int defrag_count = 0; |
1261 | int compress_type = BTRFS_COMPRESS_ZLIB; | 1261 | int compress_type = BTRFS_COMPRESS_ZLIB; |
1262 | int extent_thresh = range->extent_thresh; | 1262 | u32 extent_thresh = range->extent_thresh; |
1263 | unsigned long max_cluster = (256 * 1024) >> PAGE_CACHE_SHIFT; | 1263 | unsigned long max_cluster = (256 * 1024) >> PAGE_CACHE_SHIFT; |
1264 | unsigned long cluster = max_cluster; | 1264 | unsigned long cluster = max_cluster; |
1265 | u64 new_align = ~((u64)128 * 1024 - 1); | 1265 | u64 new_align = ~((u64)128 * 1024 - 1); |
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index cd9717ea8c9d..48b60dbf807f 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -539,10 +539,9 @@ static int add_qgroup_item(struct btrfs_trans_handle *trans, | |||
539 | struct extent_buffer *leaf; | 539 | struct extent_buffer *leaf; |
540 | struct btrfs_key key; | 540 | struct btrfs_key key; |
541 | 541 | ||
542 | #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS | 542 | if (btrfs_test_is_dummy_root(quota_root)) |
543 | if (unlikely(test_bit(BTRFS_ROOT_DUMMY_ROOT, "a_root->state))) | ||
544 | return 0; | 543 | return 0; |
545 | #endif | 544 | |
546 | path = btrfs_alloc_path(); | 545 | path = btrfs_alloc_path(); |
547 | if (!path) | 546 | if (!path) |
548 | return -ENOMEM; | 547 | return -ENOMEM; |
@@ -698,10 +697,9 @@ static int update_qgroup_info_item(struct btrfs_trans_handle *trans, | |||
698 | int ret; | 697 | int ret; |
699 | int slot; | 698 | int slot; |
700 | 699 | ||
701 | #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS | 700 | if (btrfs_test_is_dummy_root(root)) |
702 | if (unlikely(test_bit(BTRFS_ROOT_DUMMY_ROOT, &root->state))) | ||
703 | return 0; | 701 | return 0; |
704 | #endif | 702 | |
705 | key.objectid = 0; | 703 | key.objectid = 0; |
706 | key.type = BTRFS_QGROUP_INFO_KEY; | 704 | key.type = BTRFS_QGROUP_INFO_KEY; |
707 | key.offset = qgroup->qgroupid; | 705 | key.offset = qgroup->qgroupid; |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index b55ea3735a5f..8f9967f03b64 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -2349,7 +2349,7 @@ void free_reloc_roots(struct list_head *list) | |||
2349 | } | 2349 | } |
2350 | 2350 | ||
2351 | static noinline_for_stack | 2351 | static noinline_for_stack |
2352 | int merge_reloc_roots(struct reloc_control *rc) | 2352 | void merge_reloc_roots(struct reloc_control *rc) |
2353 | { | 2353 | { |
2354 | struct btrfs_root *root; | 2354 | struct btrfs_root *root; |
2355 | struct btrfs_root *reloc_root; | 2355 | struct btrfs_root *reloc_root; |
@@ -2430,7 +2430,6 @@ out: | |||
2430 | } | 2430 | } |
2431 | 2431 | ||
2432 | BUG_ON(!RB_EMPTY_ROOT(&rc->reloc_root_tree.rb_root)); | 2432 | BUG_ON(!RB_EMPTY_ROOT(&rc->reloc_root_tree.rb_root)); |
2433 | return ret; | ||
2434 | } | 2433 | } |
2435 | 2434 | ||
2436 | static void free_block_list(struct rb_root *blocks) | 2435 | static void free_block_list(struct rb_root *blocks) |
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index b9c37ac9ed1b..efa083113827 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
@@ -177,17 +177,12 @@ struct scrub_copy_nocow_ctx { | |||
177 | struct scrub_warning { | 177 | struct scrub_warning { |
178 | struct btrfs_path *path; | 178 | struct btrfs_path *path; |
179 | u64 extent_item_size; | 179 | u64 extent_item_size; |
180 | char *scratch_buf; | ||
181 | char *msg_buf; | ||
182 | const char *errstr; | 180 | const char *errstr; |
183 | sector_t sector; | 181 | sector_t sector; |
184 | u64 logical; | 182 | u64 logical; |
185 | struct btrfs_device *dev; | 183 | struct btrfs_device *dev; |
186 | int msg_bufsize; | ||
187 | int scratch_bufsize; | ||
188 | }; | 184 | }; |
189 | 185 | ||
190 | |||
191 | static void scrub_pending_bio_inc(struct scrub_ctx *sctx); | 186 | static void scrub_pending_bio_inc(struct scrub_ctx *sctx); |
192 | static void scrub_pending_bio_dec(struct scrub_ctx *sctx); | 187 | static void scrub_pending_bio_dec(struct scrub_ctx *sctx); |
193 | static void scrub_pending_trans_workers_inc(struct scrub_ctx *sctx); | 188 | static void scrub_pending_trans_workers_inc(struct scrub_ctx *sctx); |
@@ -551,7 +546,6 @@ static void scrub_print_warning(const char *errstr, struct scrub_block *sblock) | |||
551 | u64 ref_root; | 546 | u64 ref_root; |
552 | u32 item_size; | 547 | u32 item_size; |
553 | u8 ref_level; | 548 | u8 ref_level; |
554 | const int bufsize = 4096; | ||
555 | int ret; | 549 | int ret; |
556 | 550 | ||
557 | WARN_ON(sblock->page_count < 1); | 551 | WARN_ON(sblock->page_count < 1); |
@@ -559,18 +553,13 @@ static void scrub_print_warning(const char *errstr, struct scrub_block *sblock) | |||
559 | fs_info = sblock->sctx->dev_root->fs_info; | 553 | fs_info = sblock->sctx->dev_root->fs_info; |
560 | 554 | ||
561 | path = btrfs_alloc_path(); | 555 | path = btrfs_alloc_path(); |
556 | if (!path) | ||
557 | return; | ||
562 | 558 | ||
563 | swarn.scratch_buf = kmalloc(bufsize, GFP_NOFS); | ||
564 | swarn.msg_buf = kmalloc(bufsize, GFP_NOFS); | ||
565 | swarn.sector = (sblock->pagev[0]->physical) >> 9; | 559 | swarn.sector = (sblock->pagev[0]->physical) >> 9; |
566 | swarn.logical = sblock->pagev[0]->logical; | 560 | swarn.logical = sblock->pagev[0]->logical; |
567 | swarn.errstr = errstr; | 561 | swarn.errstr = errstr; |
568 | swarn.dev = NULL; | 562 | swarn.dev = NULL; |
569 | swarn.msg_bufsize = bufsize; | ||
570 | swarn.scratch_bufsize = bufsize; | ||
571 | |||
572 | if (!path || !swarn.scratch_buf || !swarn.msg_buf) | ||
573 | goto out; | ||
574 | 563 | ||
575 | ret = extent_from_logical(fs_info, swarn.logical, path, &found_key, | 564 | ret = extent_from_logical(fs_info, swarn.logical, path, &found_key, |
576 | &flags); | 565 | &flags); |
@@ -611,8 +600,6 @@ static void scrub_print_warning(const char *errstr, struct scrub_block *sblock) | |||
611 | 600 | ||
612 | out: | 601 | out: |
613 | btrfs_free_path(path); | 602 | btrfs_free_path(path); |
614 | kfree(swarn.scratch_buf); | ||
615 | kfree(swarn.msg_buf); | ||
616 | } | 603 | } |
617 | 604 | ||
618 | static int scrub_fixup_readpage(u64 inum, u64 offset, u64 root, void *fixup_ctx) | 605 | static int scrub_fixup_readpage(u64 inum, u64 offset, u64 root, void *fixup_ctx) |
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index b9c27aa38d76..874828dd0a86 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c | |||
@@ -5728,7 +5728,7 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_) | |||
5728 | NULL); | 5728 | NULL); |
5729 | sort_clone_roots = 1; | 5729 | sort_clone_roots = 1; |
5730 | 5730 | ||
5731 | current->journal_info = (void *)BTRFS_SEND_TRANS_STUB; | 5731 | current->journal_info = BTRFS_SEND_TRANS_STUB; |
5732 | ret = send_subvol(sctx); | 5732 | ret = send_subvol(sctx); |
5733 | current->journal_info = NULL; | 5733 | current->journal_info = NULL; |
5734 | if (ret < 0) | 5734 | if (ret < 0) |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 2375f94fb780..4685b9704f15 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -395,7 +395,6 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
395 | int ret = 0; | 395 | int ret = 0; |
396 | char *compress_type; | 396 | char *compress_type; |
397 | bool compress_force = false; | 397 | bool compress_force = false; |
398 | bool compress = false; | ||
399 | 398 | ||
400 | cache_gen = btrfs_super_cache_generation(root->fs_info->super_copy); | 399 | cache_gen = btrfs_super_cache_generation(root->fs_info->super_copy); |
401 | if (cache_gen) | 400 | if (cache_gen) |
@@ -473,7 +472,6 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
473 | /* Fallthrough */ | 472 | /* Fallthrough */ |
474 | case Opt_compress: | 473 | case Opt_compress: |
475 | case Opt_compress_type: | 474 | case Opt_compress_type: |
476 | compress = true; | ||
477 | if (token == Opt_compress || | 475 | if (token == Opt_compress || |
478 | token == Opt_compress_force || | 476 | token == Opt_compress_force || |
479 | strcmp(args[0].from, "zlib") == 0) { | 477 | strcmp(args[0].from, "zlib") == 0) { |
@@ -503,7 +501,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
503 | btrfs_set_and_info(root, FORCE_COMPRESS, | 501 | btrfs_set_and_info(root, FORCE_COMPRESS, |
504 | "force %s compression", | 502 | "force %s compression", |
505 | compress_type); | 503 | compress_type); |
506 | } else if (compress) { | 504 | } else { |
507 | if (!btrfs_test_opt(root, COMPRESS)) | 505 | if (!btrfs_test_opt(root, COMPRESS)) |
508 | btrfs_info(root->fs_info, | 506 | btrfs_info(root->fs_info, |
509 | "btrfs: use %s compression", | 507 | "btrfs: use %s compression", |
@@ -1016,7 +1014,7 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry) | |||
1016 | seq_puts(seq, ",nodatacow"); | 1014 | seq_puts(seq, ",nodatacow"); |
1017 | if (btrfs_test_opt(root, NOBARRIER)) | 1015 | if (btrfs_test_opt(root, NOBARRIER)) |
1018 | seq_puts(seq, ",nobarrier"); | 1016 | seq_puts(seq, ",nobarrier"); |
1019 | if (info->max_inline != 8192 * 1024) | 1017 | if (info->max_inline != BTRFS_DEFAULT_MAX_INLINE) |
1020 | seq_printf(seq, ",max_inline=%llu", info->max_inline); | 1018 | seq_printf(seq, ",max_inline=%llu", info->max_inline); |
1021 | if (info->alloc_start != 0) | 1019 | if (info->alloc_start != 0) |
1022 | seq_printf(seq, ",alloc_start=%llu", info->alloc_start); | 1020 | seq_printf(seq, ",alloc_start=%llu", info->alloc_start); |
@@ -2001,11 +1999,15 @@ static int __init init_btrfs_fs(void) | |||
2001 | 1999 | ||
2002 | err = btrfs_prelim_ref_init(); | 2000 | err = btrfs_prelim_ref_init(); |
2003 | if (err) | 2001 | if (err) |
2002 | goto free_delayed_ref; | ||
2003 | |||
2004 | err = btrfs_end_io_wq_init(); | ||
2005 | if (err) | ||
2004 | goto free_prelim_ref; | 2006 | goto free_prelim_ref; |
2005 | 2007 | ||
2006 | err = btrfs_interface_init(); | 2008 | err = btrfs_interface_init(); |
2007 | if (err) | 2009 | if (err) |
2008 | goto free_delayed_ref; | 2010 | goto free_end_io_wq; |
2009 | 2011 | ||
2010 | btrfs_init_lockdep(); | 2012 | btrfs_init_lockdep(); |
2011 | 2013 | ||
@@ -2023,6 +2025,8 @@ static int __init init_btrfs_fs(void) | |||
2023 | 2025 | ||
2024 | unregister_ioctl: | 2026 | unregister_ioctl: |
2025 | btrfs_interface_exit(); | 2027 | btrfs_interface_exit(); |
2028 | free_end_io_wq: | ||
2029 | btrfs_end_io_wq_exit(); | ||
2026 | free_prelim_ref: | 2030 | free_prelim_ref: |
2027 | btrfs_prelim_ref_exit(); | 2031 | btrfs_prelim_ref_exit(); |
2028 | free_delayed_ref: | 2032 | free_delayed_ref: |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 86ef8d79c19f..0bcdcc65627f 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -386,7 +386,7 @@ start_transaction(struct btrfs_root *root, u64 num_items, unsigned int type, | |||
386 | int ret; | 386 | int ret; |
387 | 387 | ||
388 | /* Send isn't supposed to start transactions. */ | 388 | /* Send isn't supposed to start transactions. */ |
389 | ASSERT(current->journal_info != (void *)BTRFS_SEND_TRANS_STUB); | 389 | ASSERT(current->journal_info != BTRFS_SEND_TRANS_STUB); |
390 | 390 | ||
391 | if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state)) | 391 | if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state)) |
392 | return ERR_PTR(-EROFS); | 392 | return ERR_PTR(-EROFS); |
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h index 579be51b27e5..d8f40e1a5d2d 100644 --- a/fs/btrfs/transaction.h +++ b/fs/btrfs/transaction.h | |||
@@ -79,7 +79,7 @@ struct btrfs_transaction { | |||
79 | #define TRANS_EXTWRITERS (__TRANS_USERSPACE | __TRANS_START | \ | 79 | #define TRANS_EXTWRITERS (__TRANS_USERSPACE | __TRANS_START | \ |
80 | __TRANS_ATTACH) | 80 | __TRANS_ATTACH) |
81 | 81 | ||
82 | #define BTRFS_SEND_TRANS_STUB 1 | 82 | #define BTRFS_SEND_TRANS_STUB ((void *)1) |
83 | 83 | ||
84 | struct btrfs_trans_handle { | 84 | struct btrfs_trans_handle { |
85 | u64 transid; | 85 | u64 transid; |