diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-07-26 18:03:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-07-26 18:03:07 -0400 |
commit | d05d7f40791ccbb6e543cc5dd6a6aa08fc71d635 (patch) | |
tree | dc0039fe490a41a70de10d58fe8e6136db46463a /fs/btrfs/check-integrity.c | |
parent | 75a442efb1ca613f8d1cc71a32c2c9b0aefae4a5 (diff) | |
parent | 17007f3994cdb4643355c73f54f0adad006cf59e (diff) |
Merge branch 'for-4.8/core' of git://git.kernel.dk/linux-block
Pull core block updates from Jens Axboe:
- the big change is the cleanup from Mike Christie, cleaning up our
uses of command types and modified flags. This is what will throw
some merge conflicts
- regression fix for the above for btrfs, from Vincent
- following up to the above, better packing of struct request from
Christoph
- a 2038 fix for blktrace from Arnd
- a few trivial/spelling fixes from Bart Van Assche
- a front merge check fix from Damien, which could cause issues on
SMR drives
- Atari partition fix from Gabriel
- convert cfq to highres timers, since jiffies isn't granular enough
for some devices these days. From Jan and Jeff
- CFQ priority boost fix idle classes, from me
- cleanup series from Ming, improving our bio/bvec iteration
- a direct issue fix for blk-mq from Omar
- fix for plug merging not involving the IO scheduler, like we do for
other types of merges. From Tahsin
- expose DAX type internally and through sysfs. From Toshi and Yigal
* 'for-4.8/core' of git://git.kernel.dk/linux-block: (76 commits)
block: Fix front merge check
block: do not merge requests without consulting with io scheduler
block: Fix spelling in a source code comment
block: expose QUEUE_FLAG_DAX in sysfs
block: add QUEUE_FLAG_DAX for devices to advertise their DAX support
Btrfs: fix comparison in __btrfs_map_block()
block: atari: Return early for unsupported sector size
Doc: block: Fix a typo in queue-sysfs.txt
cfq-iosched: Charge at least 1 jiffie instead of 1 ns
cfq-iosched: Fix regression in bonnie++ rewrite performance
cfq-iosched: Convert slice_resid from u64 to s64
block: Convert fifo_time from ulong to u64
blktrace: avoid using timespec
block/blk-cgroup.c: Declare local symbols static
block/bio-integrity.c: Add #include "blk.h"
block/partition-generic.c: Remove a set-but-not-used variable
block: bio: kill BIO_MAX_SIZE
cfq-iosched: temporarily boost queue priority for idle classes
block: drbd: avoid to use BIO_MAX_SIZE
block: bio: remove BIO_MAX_SECTORS
...
Diffstat (limited to 'fs/btrfs/check-integrity.c')
-rw-r--r-- | fs/btrfs/check-integrity.c | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c index 7706c8dc5fa6..5d5cae05818d 100644 --- a/fs/btrfs/check-integrity.c +++ b/fs/btrfs/check-integrity.c | |||
@@ -1673,6 +1673,7 @@ static int btrfsic_read_block(struct btrfsic_state *state, | |||
1673 | } | 1673 | } |
1674 | bio->bi_bdev = block_ctx->dev->bdev; | 1674 | bio->bi_bdev = block_ctx->dev->bdev; |
1675 | bio->bi_iter.bi_sector = dev_bytenr >> 9; | 1675 | bio->bi_iter.bi_sector = dev_bytenr >> 9; |
1676 | bio_set_op_attrs(bio, REQ_OP_READ, 0); | ||
1676 | 1677 | ||
1677 | for (j = i; j < num_pages; j++) { | 1678 | for (j = i; j < num_pages; j++) { |
1678 | ret = bio_add_page(bio, block_ctx->pagev[j], | 1679 | ret = bio_add_page(bio, block_ctx->pagev[j], |
@@ -1685,7 +1686,7 @@ static int btrfsic_read_block(struct btrfsic_state *state, | |||
1685 | "btrfsic: error, failed to add a single page!\n"); | 1686 | "btrfsic: error, failed to add a single page!\n"); |
1686 | return -1; | 1687 | return -1; |
1687 | } | 1688 | } |
1688 | if (submit_bio_wait(READ, bio)) { | 1689 | if (submit_bio_wait(bio)) { |
1689 | printk(KERN_INFO | 1690 | printk(KERN_INFO |
1690 | "btrfsic: read error at logical %llu dev %s!\n", | 1691 | "btrfsic: read error at logical %llu dev %s!\n", |
1691 | block_ctx->start, block_ctx->dev->name); | 1692 | block_ctx->start, block_ctx->dev->name); |
@@ -2206,7 +2207,7 @@ static void btrfsic_bio_end_io(struct bio *bp) | |||
2206 | block->dev_bytenr, block->mirror_num); | 2207 | block->dev_bytenr, block->mirror_num); |
2207 | next_block = block->next_in_same_bio; | 2208 | next_block = block->next_in_same_bio; |
2208 | block->iodone_w_error = iodone_w_error; | 2209 | block->iodone_w_error = iodone_w_error; |
2209 | if (block->submit_bio_bh_rw & REQ_FLUSH) { | 2210 | if (block->submit_bio_bh_rw & REQ_PREFLUSH) { |
2210 | dev_state->last_flush_gen++; | 2211 | dev_state->last_flush_gen++; |
2211 | if ((dev_state->state->print_mask & | 2212 | if ((dev_state->state->print_mask & |
2212 | BTRFSIC_PRINT_MASK_END_IO_BIO_BH)) | 2213 | BTRFSIC_PRINT_MASK_END_IO_BIO_BH)) |
@@ -2242,7 +2243,7 @@ static void btrfsic_bh_end_io(struct buffer_head *bh, int uptodate) | |||
2242 | block->dev_bytenr, block->mirror_num); | 2243 | block->dev_bytenr, block->mirror_num); |
2243 | 2244 | ||
2244 | block->iodone_w_error = iodone_w_error; | 2245 | block->iodone_w_error = iodone_w_error; |
2245 | if (block->submit_bio_bh_rw & REQ_FLUSH) { | 2246 | if (block->submit_bio_bh_rw & REQ_PREFLUSH) { |
2246 | dev_state->last_flush_gen++; | 2247 | dev_state->last_flush_gen++; |
2247 | if ((dev_state->state->print_mask & | 2248 | if ((dev_state->state->print_mask & |
2248 | BTRFSIC_PRINT_MASK_END_IO_BIO_BH)) | 2249 | BTRFSIC_PRINT_MASK_END_IO_BIO_BH)) |
@@ -2855,12 +2856,12 @@ static struct btrfsic_dev_state *btrfsic_dev_state_lookup( | |||
2855 | return ds; | 2856 | return ds; |
2856 | } | 2857 | } |
2857 | 2858 | ||
2858 | int btrfsic_submit_bh(int rw, struct buffer_head *bh) | 2859 | int btrfsic_submit_bh(int op, int op_flags, struct buffer_head *bh) |
2859 | { | 2860 | { |
2860 | struct btrfsic_dev_state *dev_state; | 2861 | struct btrfsic_dev_state *dev_state; |
2861 | 2862 | ||
2862 | if (!btrfsic_is_initialized) | 2863 | if (!btrfsic_is_initialized) |
2863 | return submit_bh(rw, bh); | 2864 | return submit_bh(op, op_flags, bh); |
2864 | 2865 | ||
2865 | mutex_lock(&btrfsic_mutex); | 2866 | mutex_lock(&btrfsic_mutex); |
2866 | /* since btrfsic_submit_bh() might also be called before | 2867 | /* since btrfsic_submit_bh() might also be called before |
@@ -2869,26 +2870,26 @@ int btrfsic_submit_bh(int rw, struct buffer_head *bh) | |||
2869 | 2870 | ||
2870 | /* Only called to write the superblock (incl. FLUSH/FUA) */ | 2871 | /* Only called to write the superblock (incl. FLUSH/FUA) */ |
2871 | if (NULL != dev_state && | 2872 | if (NULL != dev_state && |
2872 | (rw & WRITE) && bh->b_size > 0) { | 2873 | (op == REQ_OP_WRITE) && bh->b_size > 0) { |
2873 | u64 dev_bytenr; | 2874 | u64 dev_bytenr; |
2874 | 2875 | ||
2875 | dev_bytenr = 4096 * bh->b_blocknr; | 2876 | dev_bytenr = 4096 * bh->b_blocknr; |
2876 | if (dev_state->state->print_mask & | 2877 | if (dev_state->state->print_mask & |
2877 | BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH) | 2878 | BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH) |
2878 | printk(KERN_INFO | 2879 | printk(KERN_INFO |
2879 | "submit_bh(rw=0x%x, blocknr=%llu (bytenr %llu)," | 2880 | "submit_bh(op=0x%x,0x%x, blocknr=%llu " |
2880 | " size=%zu, data=%p, bdev=%p)\n", | 2881 | "(bytenr %llu), size=%zu, data=%p, bdev=%p)\n", |
2881 | rw, (unsigned long long)bh->b_blocknr, | 2882 | op, op_flags, (unsigned long long)bh->b_blocknr, |
2882 | dev_bytenr, bh->b_size, bh->b_data, bh->b_bdev); | 2883 | dev_bytenr, bh->b_size, bh->b_data, bh->b_bdev); |
2883 | btrfsic_process_written_block(dev_state, dev_bytenr, | 2884 | btrfsic_process_written_block(dev_state, dev_bytenr, |
2884 | &bh->b_data, 1, NULL, | 2885 | &bh->b_data, 1, NULL, |
2885 | NULL, bh, rw); | 2886 | NULL, bh, op_flags); |
2886 | } else if (NULL != dev_state && (rw & REQ_FLUSH)) { | 2887 | } else if (NULL != dev_state && (op_flags & REQ_PREFLUSH)) { |
2887 | if (dev_state->state->print_mask & | 2888 | if (dev_state->state->print_mask & |
2888 | BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH) | 2889 | BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH) |
2889 | printk(KERN_INFO | 2890 | printk(KERN_INFO |
2890 | "submit_bh(rw=0x%x FLUSH, bdev=%p)\n", | 2891 | "submit_bh(op=0x%x,0x%x FLUSH, bdev=%p)\n", |
2891 | rw, bh->b_bdev); | 2892 | op, op_flags, bh->b_bdev); |
2892 | if (!dev_state->dummy_block_for_bio_bh_flush.is_iodone) { | 2893 | if (!dev_state->dummy_block_for_bio_bh_flush.is_iodone) { |
2893 | if ((dev_state->state->print_mask & | 2894 | if ((dev_state->state->print_mask & |
2894 | (BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH | | 2895 | (BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH | |
@@ -2906,7 +2907,7 @@ int btrfsic_submit_bh(int rw, struct buffer_head *bh) | |||
2906 | block->never_written = 0; | 2907 | block->never_written = 0; |
2907 | block->iodone_w_error = 0; | 2908 | block->iodone_w_error = 0; |
2908 | block->flush_gen = dev_state->last_flush_gen + 1; | 2909 | block->flush_gen = dev_state->last_flush_gen + 1; |
2909 | block->submit_bio_bh_rw = rw; | 2910 | block->submit_bio_bh_rw = op_flags; |
2910 | block->orig_bio_bh_private = bh->b_private; | 2911 | block->orig_bio_bh_private = bh->b_private; |
2911 | block->orig_bio_bh_end_io.bh = bh->b_end_io; | 2912 | block->orig_bio_bh_end_io.bh = bh->b_end_io; |
2912 | block->next_in_same_bio = NULL; | 2913 | block->next_in_same_bio = NULL; |
@@ -2915,10 +2916,10 @@ int btrfsic_submit_bh(int rw, struct buffer_head *bh) | |||
2915 | } | 2916 | } |
2916 | } | 2917 | } |
2917 | mutex_unlock(&btrfsic_mutex); | 2918 | mutex_unlock(&btrfsic_mutex); |
2918 | return submit_bh(rw, bh); | 2919 | return submit_bh(op, op_flags, bh); |
2919 | } | 2920 | } |
2920 | 2921 | ||
2921 | static void __btrfsic_submit_bio(int rw, struct bio *bio) | 2922 | static void __btrfsic_submit_bio(struct bio *bio) |
2922 | { | 2923 | { |
2923 | struct btrfsic_dev_state *dev_state; | 2924 | struct btrfsic_dev_state *dev_state; |
2924 | 2925 | ||
@@ -2930,7 +2931,7 @@ static void __btrfsic_submit_bio(int rw, struct bio *bio) | |||
2930 | * btrfsic_mount(), this might return NULL */ | 2931 | * btrfsic_mount(), this might return NULL */ |
2931 | dev_state = btrfsic_dev_state_lookup(bio->bi_bdev); | 2932 | dev_state = btrfsic_dev_state_lookup(bio->bi_bdev); |
2932 | if (NULL != dev_state && | 2933 | if (NULL != dev_state && |
2933 | (rw & WRITE) && NULL != bio->bi_io_vec) { | 2934 | (bio_op(bio) == REQ_OP_WRITE) && NULL != bio->bi_io_vec) { |
2934 | unsigned int i; | 2935 | unsigned int i; |
2935 | u64 dev_bytenr; | 2936 | u64 dev_bytenr; |
2936 | u64 cur_bytenr; | 2937 | u64 cur_bytenr; |
@@ -2942,9 +2943,9 @@ static void __btrfsic_submit_bio(int rw, struct bio *bio) | |||
2942 | if (dev_state->state->print_mask & | 2943 | if (dev_state->state->print_mask & |
2943 | BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH) | 2944 | BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH) |
2944 | printk(KERN_INFO | 2945 | printk(KERN_INFO |
2945 | "submit_bio(rw=0x%x, bi_vcnt=%u," | 2946 | "submit_bio(rw=%d,0x%x, bi_vcnt=%u," |
2946 | " bi_sector=%llu (bytenr %llu), bi_bdev=%p)\n", | 2947 | " bi_sector=%llu (bytenr %llu), bi_bdev=%p)\n", |
2947 | rw, bio->bi_vcnt, | 2948 | bio_op(bio), bio->bi_rw, bio->bi_vcnt, |
2948 | (unsigned long long)bio->bi_iter.bi_sector, | 2949 | (unsigned long long)bio->bi_iter.bi_sector, |
2949 | dev_bytenr, bio->bi_bdev); | 2950 | dev_bytenr, bio->bi_bdev); |
2950 | 2951 | ||
@@ -2975,18 +2976,18 @@ static void __btrfsic_submit_bio(int rw, struct bio *bio) | |||
2975 | btrfsic_process_written_block(dev_state, dev_bytenr, | 2976 | btrfsic_process_written_block(dev_state, dev_bytenr, |
2976 | mapped_datav, bio->bi_vcnt, | 2977 | mapped_datav, bio->bi_vcnt, |
2977 | bio, &bio_is_patched, | 2978 | bio, &bio_is_patched, |
2978 | NULL, rw); | 2979 | NULL, bio->bi_rw); |
2979 | while (i > 0) { | 2980 | while (i > 0) { |
2980 | i--; | 2981 | i--; |
2981 | kunmap(bio->bi_io_vec[i].bv_page); | 2982 | kunmap(bio->bi_io_vec[i].bv_page); |
2982 | } | 2983 | } |
2983 | kfree(mapped_datav); | 2984 | kfree(mapped_datav); |
2984 | } else if (NULL != dev_state && (rw & REQ_FLUSH)) { | 2985 | } else if (NULL != dev_state && (bio->bi_rw & REQ_PREFLUSH)) { |
2985 | if (dev_state->state->print_mask & | 2986 | if (dev_state->state->print_mask & |
2986 | BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH) | 2987 | BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH) |
2987 | printk(KERN_INFO | 2988 | printk(KERN_INFO |
2988 | "submit_bio(rw=0x%x FLUSH, bdev=%p)\n", | 2989 | "submit_bio(rw=%d,0x%x FLUSH, bdev=%p)\n", |
2989 | rw, bio->bi_bdev); | 2990 | bio_op(bio), bio->bi_rw, bio->bi_bdev); |
2990 | if (!dev_state->dummy_block_for_bio_bh_flush.is_iodone) { | 2991 | if (!dev_state->dummy_block_for_bio_bh_flush.is_iodone) { |
2991 | if ((dev_state->state->print_mask & | 2992 | if ((dev_state->state->print_mask & |
2992 | (BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH | | 2993 | (BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH | |
@@ -3004,7 +3005,7 @@ static void __btrfsic_submit_bio(int rw, struct bio *bio) | |||
3004 | block->never_written = 0; | 3005 | block->never_written = 0; |
3005 | block->iodone_w_error = 0; | 3006 | block->iodone_w_error = 0; |
3006 | block->flush_gen = dev_state->last_flush_gen + 1; | 3007 | block->flush_gen = dev_state->last_flush_gen + 1; |
3007 | block->submit_bio_bh_rw = rw; | 3008 | block->submit_bio_bh_rw = bio->bi_rw; |
3008 | block->orig_bio_bh_private = bio->bi_private; | 3009 | block->orig_bio_bh_private = bio->bi_private; |
3009 | block->orig_bio_bh_end_io.bio = bio->bi_end_io; | 3010 | block->orig_bio_bh_end_io.bio = bio->bi_end_io; |
3010 | block->next_in_same_bio = NULL; | 3011 | block->next_in_same_bio = NULL; |
@@ -3016,16 +3017,16 @@ leave: | |||
3016 | mutex_unlock(&btrfsic_mutex); | 3017 | mutex_unlock(&btrfsic_mutex); |
3017 | } | 3018 | } |
3018 | 3019 | ||
3019 | void btrfsic_submit_bio(int rw, struct bio *bio) | 3020 | void btrfsic_submit_bio(struct bio *bio) |
3020 | { | 3021 | { |
3021 | __btrfsic_submit_bio(rw, bio); | 3022 | __btrfsic_submit_bio(bio); |
3022 | submit_bio(rw, bio); | 3023 | submit_bio(bio); |
3023 | } | 3024 | } |
3024 | 3025 | ||
3025 | int btrfsic_submit_bio_wait(int rw, struct bio *bio) | 3026 | int btrfsic_submit_bio_wait(struct bio *bio) |
3026 | { | 3027 | { |
3027 | __btrfsic_submit_bio(rw, bio); | 3028 | __btrfsic_submit_bio(bio); |
3028 | return submit_bio_wait(rw, bio); | 3029 | return submit_bio_wait(bio); |
3029 | } | 3030 | } |
3030 | 3031 | ||
3031 | int btrfsic_mount(struct btrfs_root *root, | 3032 | int btrfsic_mount(struct btrfs_root *root, |