aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-22 11:38:55 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-22 11:38:55 -0500
commitfb0d1eb8925daaabc45ef67be740a41f49303d07 (patch)
treecf2be2605d817ed8f91da2bed66653508c59d041 /fs/btrfs
parent6ea9786e76d74350aee6cd9339c6f7cb765ba291 (diff)
parentc75017961ba7df5da148b48a905c97181587d562 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Pull btrfs fixes from Chris Mason: "Almost all of these are bug fixes. Dave Sterba's documentation update is the big exception because he removed our promises to set any machine running Btrfs on fire" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: Documentation: filesystems: update btrfs tools section Documentation: filesystems: add new btrfs mount options btrfs: update kconfig help text btrfs: fix bio_size_ok() for max_sectors > 0xffff btrfs: Use trace condition for get_extent tracepoint btrfs: fix typo in the log message Btrfs: fix list delete warning when removing ordered root from the list Btrfs: print bytenr instead of page pointer in check-int Btrfs: remove dead codes from ctree.h Btrfs: don't wait for ordered data outside desired range Btrfs: fix lockdep error in async commit Btrfs: avoid heavy operations in btrfs_commit_super Btrfs: fix __btrfs_start_workers retval Btrfs: disable online raid-repair on ro mounts Btrfs: do not inc uncorrectable_errors counter on ro scrubs Btrfs: only drop modified extents if we logged the whole inode Btrfs: make sure to copy everything if we rename Btrfs: don't BUG_ON() if we get an error walking backrefs
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/Kconfig15
-rw-r--r--fs/btrfs/async-thread.c1
-rw-r--r--fs/btrfs/check-integrity.c25
-rw-r--r--fs/btrfs/ctree.h6
-rw-r--r--fs/btrfs/dev-replace.c2
-rw-r--r--fs/btrfs/disk-io.c21
-rw-r--r--fs/btrfs/extent_io.c11
-rw-r--r--fs/btrfs/inode.c6
-rw-r--r--fs/btrfs/ordered-data.c3
-rw-r--r--fs/btrfs/scrub.c6
-rw-r--r--fs/btrfs/transaction.c4
-rw-r--r--fs/btrfs/tree-log.c5
-rw-r--r--fs/btrfs/volumes.c2
13 files changed, 53 insertions, 54 deletions
diff --git a/fs/btrfs/Kconfig b/fs/btrfs/Kconfig
index f9d5094e1029..aa976eced2d2 100644
--- a/fs/btrfs/Kconfig
+++ b/fs/btrfs/Kconfig
@@ -9,12 +9,17 @@ config BTRFS_FS
9 select XOR_BLOCKS 9 select XOR_BLOCKS
10 10
11 help 11 help
12 Btrfs is a new filesystem with extents, writable snapshotting, 12 Btrfs is a general purpose copy-on-write filesystem with extents,
13 support for multiple devices and many more features. 13 writable snapshotting, support for multiple devices and many more
14 features focused on fault tolerance, repair and easy administration.
14 15
15 Btrfs is highly experimental, and THE DISK FORMAT IS NOT YET 16 The filesystem disk format is no longer unstable, and it's not
16 FINALIZED. You should say N here unless you are interested in 17 expected to change unless there are strong reasons to do so. If there
17 testing Btrfs with non-critical data. 18 is a format change, file systems with a unchanged format will
19 continue to be mountable and usable by newer kernels.
20
21 For more information, please see the web pages at
22 http://btrfs.wiki.kernel.org.
18 23
19 To compile this file system support as a module, choose M here. The 24 To compile this file system support as a module, choose M here. The
20 module will be called btrfs. 25 module will be called btrfs.
diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c
index 8aec751fa464..c1e0b0caf9cc 100644
--- a/fs/btrfs/async-thread.c
+++ b/fs/btrfs/async-thread.c
@@ -495,6 +495,7 @@ static int __btrfs_start_workers(struct btrfs_workers *workers)
495 spin_lock_irq(&workers->lock); 495 spin_lock_irq(&workers->lock);
496 if (workers->stopping) { 496 if (workers->stopping) {
497 spin_unlock_irq(&workers->lock); 497 spin_unlock_irq(&workers->lock);
498 ret = -EINVAL;
498 goto fail_kthread; 499 goto fail_kthread;
499 } 500 }
500 list_add_tail(&worker->worker_list, &workers->idle_list); 501 list_add_tail(&worker->worker_list, &workers->idle_list);
diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index e0aab4456974..b50764bef141 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -77,6 +77,15 @@
77 * the integrity of (super)-block write requests, do not 77 * the integrity of (super)-block write requests, do not
78 * enable the config option BTRFS_FS_CHECK_INTEGRITY to 78 * enable the config option BTRFS_FS_CHECK_INTEGRITY to
79 * include and compile the integrity check tool. 79 * include and compile the integrity check tool.
80 *
81 * Expect millions of lines of information in the kernel log with an
82 * enabled check_int_print_mask. Therefore set LOG_BUF_SHIFT in the
83 * kernel config to at least 26 (which is 64MB). Usually the value is
84 * limited to 21 (which is 2MB) in init/Kconfig. The file needs to be
85 * changed like this before LOG_BUF_SHIFT can be set to a high value:
86 * config LOG_BUF_SHIFT
87 * int "Kernel log buffer size (16 => 64KB, 17 => 128KB)"
88 * range 12 30
80 */ 89 */
81 90
82#include <linux/sched.h> 91#include <linux/sched.h>
@@ -124,6 +133,7 @@
124#define BTRFSIC_PRINT_MASK_INITIAL_DATABASE 0x00000400 133#define BTRFSIC_PRINT_MASK_INITIAL_DATABASE 0x00000400
125#define BTRFSIC_PRINT_MASK_NUM_COPIES 0x00000800 134#define BTRFSIC_PRINT_MASK_NUM_COPIES 0x00000800
126#define BTRFSIC_PRINT_MASK_TREE_WITH_ALL_MIRRORS 0x00001000 135#define BTRFSIC_PRINT_MASK_TREE_WITH_ALL_MIRRORS 0x00001000
136#define BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH_VERBOSE 0x00002000
127 137
128struct btrfsic_dev_state; 138struct btrfsic_dev_state;
129struct btrfsic_state; 139struct btrfsic_state;
@@ -3015,6 +3025,7 @@ void btrfsic_submit_bio(int rw, struct bio *bio)
3015 (rw & WRITE) && NULL != bio->bi_io_vec) { 3025 (rw & WRITE) && NULL != bio->bi_io_vec) {
3016 unsigned int i; 3026 unsigned int i;
3017 u64 dev_bytenr; 3027 u64 dev_bytenr;
3028 u64 cur_bytenr;
3018 int bio_is_patched; 3029 int bio_is_patched;
3019 char **mapped_datav; 3030 char **mapped_datav;
3020 3031
@@ -3033,6 +3044,7 @@ void btrfsic_submit_bio(int rw, struct bio *bio)
3033 GFP_NOFS); 3044 GFP_NOFS);
3034 if (!mapped_datav) 3045 if (!mapped_datav)
3035 goto leave; 3046 goto leave;
3047 cur_bytenr = dev_bytenr;
3036 for (i = 0; i < bio->bi_vcnt; i++) { 3048 for (i = 0; i < bio->bi_vcnt; i++) {
3037 BUG_ON(bio->bi_io_vec[i].bv_len != PAGE_CACHE_SIZE); 3049 BUG_ON(bio->bi_io_vec[i].bv_len != PAGE_CACHE_SIZE);
3038 mapped_datav[i] = kmap(bio->bi_io_vec[i].bv_page); 3050 mapped_datav[i] = kmap(bio->bi_io_vec[i].bv_page);
@@ -3044,16 +3056,13 @@ void btrfsic_submit_bio(int rw, struct bio *bio)
3044 kfree(mapped_datav); 3056 kfree(mapped_datav);
3045 goto leave; 3057 goto leave;
3046 } 3058 }
3047 if ((BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH | 3059 if (dev_state->state->print_mask &
3048 BTRFSIC_PRINT_MASK_VERBOSE) == 3060 BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH_VERBOSE)
3049 (dev_state->state->print_mask &
3050 (BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH |
3051 BTRFSIC_PRINT_MASK_VERBOSE)))
3052 printk(KERN_INFO 3061 printk(KERN_INFO
3053 "#%u: page=%p, len=%u, offset=%u\n", 3062 "#%u: bytenr=%llu, len=%u, offset=%u\n",
3054 i, bio->bi_io_vec[i].bv_page, 3063 i, cur_bytenr, bio->bi_io_vec[i].bv_len,
3055 bio->bi_io_vec[i].bv_len,
3056 bio->bi_io_vec[i].bv_offset); 3064 bio->bi_io_vec[i].bv_offset);
3065 cur_bytenr += bio->bi_io_vec[i].bv_len;
3057 } 3066 }
3058 btrfsic_process_written_block(dev_state, dev_bytenr, 3067 btrfsic_process_written_block(dev_state, dev_bytenr,
3059 mapped_datav, bio->bi_vcnt, 3068 mapped_datav, bio->bi_vcnt,
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index f9aeb2759a64..54ab86127f7a 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3613,9 +3613,6 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
3613 struct btrfs_ordered_sum *sums); 3613 struct btrfs_ordered_sum *sums);
3614int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode, 3614int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode,
3615 struct bio *bio, u64 file_start, int contig); 3615 struct bio *bio, u64 file_start, int contig);
3616int btrfs_csum_truncate(struct btrfs_trans_handle *trans,
3617 struct btrfs_root *root, struct btrfs_path *path,
3618 u64 isize);
3619int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end, 3616int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end,
3620 struct list_head *list, int search_commit); 3617 struct list_head *list, int search_commit);
3621/* inode.c */ 3618/* inode.c */
@@ -3744,9 +3741,6 @@ void btrfs_cleanup_defrag_inodes(struct btrfs_fs_info *fs_info);
3744int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync); 3741int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync);
3745void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, 3742void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
3746 int skip_pinned); 3743 int skip_pinned);
3747int btrfs_replace_extent_cache(struct inode *inode, struct extent_map *replace,
3748 u64 start, u64 end, int skip_pinned,
3749 int modified);
3750extern const struct file_operations btrfs_file_operations; 3744extern const struct file_operations btrfs_file_operations;
3751int __btrfs_drop_extents(struct btrfs_trans_handle *trans, 3745int __btrfs_drop_extents(struct btrfs_trans_handle *trans,
3752 struct btrfs_root *root, struct inode *inode, 3746 struct btrfs_root *root, struct inode *inode,
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 342f9fd411e3..2cfc3dfff64f 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -366,7 +366,7 @@ int btrfs_dev_replace_start(struct btrfs_root *root,
366 dev_replace->tgtdev = tgt_device; 366 dev_replace->tgtdev = tgt_device;
367 367
368 printk_in_rcu(KERN_INFO 368 printk_in_rcu(KERN_INFO
369 "btrfs: dev_replace from %s (devid %llu) to %s) started\n", 369 "btrfs: dev_replace from %s (devid %llu) to %s started\n",
370 src_device->missing ? "<missing disk>" : 370 src_device->missing ? "<missing disk>" :
371 rcu_str_deref(src_device->name), 371 rcu_str_deref(src_device->name),
372 src_device->devid, 372 src_device->devid,
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 4c4ed0bb3da1..8072cfa8a3b1 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3517,7 +3517,6 @@ int btrfs_cleanup_fs_roots(struct btrfs_fs_info *fs_info)
3517int btrfs_commit_super(struct btrfs_root *root) 3517int btrfs_commit_super(struct btrfs_root *root)
3518{ 3518{
3519 struct btrfs_trans_handle *trans; 3519 struct btrfs_trans_handle *trans;
3520 int ret;
3521 3520
3522 mutex_lock(&root->fs_info->cleaner_mutex); 3521 mutex_lock(&root->fs_info->cleaner_mutex);
3523 btrfs_run_delayed_iputs(root); 3522 btrfs_run_delayed_iputs(root);
@@ -3531,25 +3530,7 @@ int btrfs_commit_super(struct btrfs_root *root)
3531 trans = btrfs_join_transaction(root); 3530 trans = btrfs_join_transaction(root);
3532 if (IS_ERR(trans)) 3531 if (IS_ERR(trans))
3533 return PTR_ERR(trans); 3532 return PTR_ERR(trans);
3534 ret = btrfs_commit_transaction(trans, root); 3533 return btrfs_commit_transaction(trans, root);
3535 if (ret)
3536 return ret;
3537 /* run commit again to drop the original snapshot */
3538 trans = btrfs_join_transaction(root);
3539 if (IS_ERR(trans))
3540 return PTR_ERR(trans);
3541 ret = btrfs_commit_transaction(trans, root);
3542 if (ret)
3543 return ret;
3544 ret = btrfs_write_and_wait_transaction(NULL, root);
3545 if (ret) {
3546 btrfs_error(root->fs_info, ret,
3547 "Failed to sync btree inode to disk.");
3548 return ret;
3549 }
3550
3551 ret = write_ctree_super(NULL, root, 0);
3552 return ret;
3553} 3534}
3554 3535
3555int close_ctree(struct btrfs_root *root) 3536int close_ctree(struct btrfs_root *root)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 856bc2b2192c..8e457fca0a0b 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1980,6 +1980,7 @@ int repair_io_failure(struct btrfs_fs_info *fs_info, u64 start,
1980 struct btrfs_mapping_tree *map_tree = &fs_info->mapping_tree; 1980 struct btrfs_mapping_tree *map_tree = &fs_info->mapping_tree;
1981 int ret; 1981 int ret;
1982 1982
1983 ASSERT(!(fs_info->sb->s_flags & MS_RDONLY));
1983 BUG_ON(!mirror_num); 1984 BUG_ON(!mirror_num);
1984 1985
1985 /* we can't repair anything in raid56 yet */ 1986 /* we can't repair anything in raid56 yet */
@@ -2036,6 +2037,9 @@ int repair_eb_io_failure(struct btrfs_root *root, struct extent_buffer *eb,
2036 unsigned long i, num_pages = num_extent_pages(eb->start, eb->len); 2037 unsigned long i, num_pages = num_extent_pages(eb->start, eb->len);
2037 int ret = 0; 2038 int ret = 0;
2038 2039
2040 if (root->fs_info->sb->s_flags & MS_RDONLY)
2041 return -EROFS;
2042
2039 for (i = 0; i < num_pages; i++) { 2043 for (i = 0; i < num_pages; i++) {
2040 struct page *p = extent_buffer_page(eb, i); 2044 struct page *p = extent_buffer_page(eb, i);
2041 ret = repair_io_failure(root->fs_info, start, PAGE_CACHE_SIZE, 2045 ret = repair_io_failure(root->fs_info, start, PAGE_CACHE_SIZE,
@@ -2057,12 +2061,12 @@ static int clean_io_failure(u64 start, struct page *page)
2057 u64 private; 2061 u64 private;
2058 u64 private_failure; 2062 u64 private_failure;
2059 struct io_failure_record *failrec; 2063 struct io_failure_record *failrec;
2060 struct btrfs_fs_info *fs_info; 2064 struct inode *inode = page->mapping->host;
2065 struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info;
2061 struct extent_state *state; 2066 struct extent_state *state;
2062 int num_copies; 2067 int num_copies;
2063 int did_repair = 0; 2068 int did_repair = 0;
2064 int ret; 2069 int ret;
2065 struct inode *inode = page->mapping->host;
2066 2070
2067 private = 0; 2071 private = 0;
2068 ret = count_range_bits(&BTRFS_I(inode)->io_failure_tree, &private, 2072 ret = count_range_bits(&BTRFS_I(inode)->io_failure_tree, &private,
@@ -2085,6 +2089,8 @@ static int clean_io_failure(u64 start, struct page *page)
2085 did_repair = 1; 2089 did_repair = 1;
2086 goto out; 2090 goto out;
2087 } 2091 }
2092 if (fs_info->sb->s_flags & MS_RDONLY)
2093 goto out;
2088 2094
2089 spin_lock(&BTRFS_I(inode)->io_tree.lock); 2095 spin_lock(&BTRFS_I(inode)->io_tree.lock);
2090 state = find_first_extent_bit_state(&BTRFS_I(inode)->io_tree, 2096 state = find_first_extent_bit_state(&BTRFS_I(inode)->io_tree,
@@ -2094,7 +2100,6 @@ static int clean_io_failure(u64 start, struct page *page)
2094 2100
2095 if (state && state->start <= failrec->start && 2101 if (state && state->start <= failrec->start &&
2096 state->end >= failrec->start + failrec->len - 1) { 2102 state->end >= failrec->start + failrec->len - 1) {
2097 fs_info = BTRFS_I(inode)->root->fs_info;
2098 num_copies = btrfs_num_copies(fs_info, failrec->logical, 2103 num_copies = btrfs_num_copies(fs_info, failrec->logical,
2099 failrec->len); 2104 failrec->len);
2100 if (num_copies > 1) { 2105 if (num_copies > 1) {
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index da8d2f696ac5..f1a77449d032 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2129,7 +2129,8 @@ static noinline bool record_extent_backrefs(struct btrfs_path *path,
2129 old->extent_offset, fs_info, 2129 old->extent_offset, fs_info,
2130 path, record_one_backref, 2130 path, record_one_backref,
2131 old); 2131 old);
2132 BUG_ON(ret < 0 && ret != -ENOENT); 2132 if (ret < 0 && ret != -ENOENT)
2133 return false;
2133 2134
2134 /* no backref to be processed for this extent */ 2135 /* no backref to be processed for this extent */
2135 if (!old->count) { 2136 if (!old->count) {
@@ -6186,8 +6187,7 @@ insert:
6186 write_unlock(&em_tree->lock); 6187 write_unlock(&em_tree->lock);
6187out: 6188out:
6188 6189
6189 if (em) 6190 trace_btrfs_get_extent(root, em);
6190 trace_btrfs_get_extent(root, em);
6191 6191
6192 if (path) 6192 if (path)
6193 btrfs_free_path(path); 6193 btrfs_free_path(path);
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index 25a8f3812f14..69582d5b69d1 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -638,6 +638,7 @@ void btrfs_wait_ordered_roots(struct btrfs_fs_info *fs_info, int nr)
638 WARN_ON(nr < 0); 638 WARN_ON(nr < 0);
639 } 639 }
640 } 640 }
641 list_splice_tail(&splice, &fs_info->ordered_roots);
641 spin_unlock(&fs_info->ordered_root_lock); 642 spin_unlock(&fs_info->ordered_root_lock);
642} 643}
643 644
@@ -803,7 +804,7 @@ int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len)
803 btrfs_put_ordered_extent(ordered); 804 btrfs_put_ordered_extent(ordered);
804 break; 805 break;
805 } 806 }
806 if (ordered->file_offset + ordered->len < start) { 807 if (ordered->file_offset + ordered->len <= start) {
807 btrfs_put_ordered_extent(ordered); 808 btrfs_put_ordered_extent(ordered);
808 break; 809 break;
809 } 810 }
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 2544805544f0..561e2f16ba3e 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -938,8 +938,10 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check)
938 BTRFS_DEV_STAT_CORRUPTION_ERRS); 938 BTRFS_DEV_STAT_CORRUPTION_ERRS);
939 } 939 }
940 940
941 if (sctx->readonly && !sctx->is_dev_replace) 941 if (sctx->readonly) {
942 goto did_not_correct_error; 942 ASSERT(!sctx->is_dev_replace);
943 goto out;
944 }
943 945
944 if (!is_metadata && !have_csum) { 946 if (!is_metadata && !have_csum) {
945 struct scrub_fixup_nodatasum *fixup_nodatasum; 947 struct scrub_fixup_nodatasum *fixup_nodatasum;
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 57c16b46afbd..c6a872a8a468 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1480,7 +1480,7 @@ static void do_async_commit(struct work_struct *work)
1480 * We've got freeze protection passed with the transaction. 1480 * We've got freeze protection passed with the transaction.
1481 * Tell lockdep about it. 1481 * Tell lockdep about it.
1482 */ 1482 */
1483 if (ac->newtrans->type < TRANS_JOIN_NOLOCK) 1483 if (ac->newtrans->type & __TRANS_FREEZABLE)
1484 rwsem_acquire_read( 1484 rwsem_acquire_read(
1485 &ac->root->fs_info->sb->s_writers.lock_map[SB_FREEZE_FS-1], 1485 &ac->root->fs_info->sb->s_writers.lock_map[SB_FREEZE_FS-1],
1486 0, 1, _THIS_IP_); 1486 0, 1, _THIS_IP_);
@@ -1521,7 +1521,7 @@ int btrfs_commit_transaction_async(struct btrfs_trans_handle *trans,
1521 * Tell lockdep we've released the freeze rwsem, since the 1521 * Tell lockdep we've released the freeze rwsem, since the
1522 * async commit thread will be the one to unlock it. 1522 * async commit thread will be the one to unlock it.
1523 */ 1523 */
1524 if (trans->type < TRANS_JOIN_NOLOCK) 1524 if (ac->newtrans->type & __TRANS_FREEZABLE)
1525 rwsem_release( 1525 rwsem_release(
1526 &root->fs_info->sb->s_writers.lock_map[SB_FREEZE_FS-1], 1526 &root->fs_info->sb->s_writers.lock_map[SB_FREEZE_FS-1],
1527 1, _THIS_IP_); 1527 1, _THIS_IP_);
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 744553c83fe2..9f7fc51ca334 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3697,7 +3697,8 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
3697 ret = btrfs_truncate_inode_items(trans, log, 3697 ret = btrfs_truncate_inode_items(trans, log,
3698 inode, 0, 0); 3698 inode, 0, 0);
3699 } else if (test_and_clear_bit(BTRFS_INODE_COPY_EVERYTHING, 3699 } else if (test_and_clear_bit(BTRFS_INODE_COPY_EVERYTHING,
3700 &BTRFS_I(inode)->runtime_flags)) { 3700 &BTRFS_I(inode)->runtime_flags) ||
3701 inode_only == LOG_INODE_EXISTS) {
3701 if (inode_only == LOG_INODE_ALL) 3702 if (inode_only == LOG_INODE_ALL)
3702 fast_search = true; 3703 fast_search = true;
3703 max_key.type = BTRFS_XATTR_ITEM_KEY; 3704 max_key.type = BTRFS_XATTR_ITEM_KEY;
@@ -3801,7 +3802,7 @@ log_extents:
3801 err = ret; 3802 err = ret;
3802 goto out_unlock; 3803 goto out_unlock;
3803 } 3804 }
3804 } else { 3805 } else if (inode_only == LOG_INODE_ALL) {
3805 struct extent_map_tree *tree = &BTRFS_I(inode)->extent_tree; 3806 struct extent_map_tree *tree = &BTRFS_I(inode)->extent_tree;
3806 struct extent_map *em, *n; 3807 struct extent_map *em, *n;
3807 3808
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 0db637097862..92303f42baaa 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -5394,7 +5394,7 @@ static int bio_size_ok(struct block_device *bdev, struct bio *bio,
5394{ 5394{
5395 struct bio_vec *prev; 5395 struct bio_vec *prev;
5396 struct request_queue *q = bdev_get_queue(bdev); 5396 struct request_queue *q = bdev_get_queue(bdev);
5397 unsigned short max_sectors = queue_max_sectors(q); 5397 unsigned int max_sectors = queue_max_sectors(q);
5398 struct bvec_merge_data bvm = { 5398 struct bvec_merge_data bvm = {
5399 .bi_bdev = bdev, 5399 .bi_bdev = bdev,
5400 .bi_sector = sector, 5400 .bi_sector = sector,