diff options
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 8835ce332123..ec61db64c4c9 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1823,7 +1823,7 @@ static void btrfs_clear_bit_hook(struct inode *inode, | |||
1823 | * extent_io.c merge_bio_hook, this must check the chunk tree to make sure | 1823 | * extent_io.c merge_bio_hook, this must check the chunk tree to make sure |
1824 | * we don't create bios that span stripes or chunks | 1824 | * we don't create bios that span stripes or chunks |
1825 | */ | 1825 | */ |
1826 | int btrfs_merge_bio_hook(int rw, struct page *page, unsigned long offset, | 1826 | int btrfs_merge_bio_hook(struct page *page, unsigned long offset, |
1827 | size_t size, struct bio *bio, | 1827 | size_t size, struct bio *bio, |
1828 | unsigned long bio_flags) | 1828 | unsigned long bio_flags) |
1829 | { | 1829 | { |
@@ -1855,9 +1855,8 @@ int btrfs_merge_bio_hook(int rw, struct page *page, unsigned long offset, | |||
1855 | * At IO completion time the cums attached on the ordered extent record | 1855 | * At IO completion time the cums attached on the ordered extent record |
1856 | * are inserted into the btree | 1856 | * are inserted into the btree |
1857 | */ | 1857 | */ |
1858 | static int __btrfs_submit_bio_start(struct inode *inode, int rw, | 1858 | static int __btrfs_submit_bio_start(struct inode *inode, struct bio *bio, |
1859 | struct bio *bio, int mirror_num, | 1859 | int mirror_num, unsigned long bio_flags, |
1860 | unsigned long bio_flags, | ||
1861 | u64 bio_offset) | 1860 | u64 bio_offset) |
1862 | { | 1861 | { |
1863 | struct btrfs_root *root = BTRFS_I(inode)->root; | 1862 | struct btrfs_root *root = BTRFS_I(inode)->root; |
@@ -1876,14 +1875,14 @@ static int __btrfs_submit_bio_start(struct inode *inode, int rw, | |||
1876 | * At IO completion time the cums attached on the ordered extent record | 1875 | * At IO completion time the cums attached on the ordered extent record |
1877 | * are inserted into the btree | 1876 | * are inserted into the btree |
1878 | */ | 1877 | */ |
1879 | static int __btrfs_submit_bio_done(struct inode *inode, int rw, struct bio *bio, | 1878 | static int __btrfs_submit_bio_done(struct inode *inode, struct bio *bio, |
1880 | int mirror_num, unsigned long bio_flags, | 1879 | int mirror_num, unsigned long bio_flags, |
1881 | u64 bio_offset) | 1880 | u64 bio_offset) |
1882 | { | 1881 | { |
1883 | struct btrfs_root *root = BTRFS_I(inode)->root; | 1882 | struct btrfs_root *root = BTRFS_I(inode)->root; |
1884 | int ret; | 1883 | int ret; |
1885 | 1884 | ||
1886 | ret = btrfs_map_bio(root, rw, bio, mirror_num, 1); | 1885 | ret = btrfs_map_bio(root, bio, mirror_num, 1); |
1887 | if (ret) { | 1886 | if (ret) { |
1888 | bio->bi_error = ret; | 1887 | bio->bi_error = ret; |
1889 | bio_endio(bio); | 1888 | bio_endio(bio); |
@@ -1895,7 +1894,7 @@ static int __btrfs_submit_bio_done(struct inode *inode, int rw, struct bio *bio, | |||
1895 | * extent_io.c submission hook. This does the right thing for csum calculation | 1894 | * extent_io.c submission hook. This does the right thing for csum calculation |
1896 | * on write, or reading the csums from the tree before a read | 1895 | * on write, or reading the csums from the tree before a read |
1897 | */ | 1896 | */ |
1898 | static int btrfs_submit_bio_hook(struct inode *inode, int rw, struct bio *bio, | 1897 | static int btrfs_submit_bio_hook(struct inode *inode, struct bio *bio, |
1899 | int mirror_num, unsigned long bio_flags, | 1898 | int mirror_num, unsigned long bio_flags, |
1900 | u64 bio_offset) | 1899 | u64 bio_offset) |
1901 | { | 1900 | { |
@@ -1932,7 +1931,7 @@ static int btrfs_submit_bio_hook(struct inode *inode, int rw, struct bio *bio, | |||
1932 | goto mapit; | 1931 | goto mapit; |
1933 | /* we're doing a write, do the async checksumming */ | 1932 | /* we're doing a write, do the async checksumming */ |
1934 | ret = btrfs_wq_submit_bio(BTRFS_I(inode)->root->fs_info, | 1933 | ret = btrfs_wq_submit_bio(BTRFS_I(inode)->root->fs_info, |
1935 | inode, rw, bio, mirror_num, | 1934 | inode, bio, mirror_num, |
1936 | bio_flags, bio_offset, | 1935 | bio_flags, bio_offset, |
1937 | __btrfs_submit_bio_start, | 1936 | __btrfs_submit_bio_start, |
1938 | __btrfs_submit_bio_done); | 1937 | __btrfs_submit_bio_done); |
@@ -1944,7 +1943,7 @@ static int btrfs_submit_bio_hook(struct inode *inode, int rw, struct bio *bio, | |||
1944 | } | 1943 | } |
1945 | 1944 | ||
1946 | mapit: | 1945 | mapit: |
1947 | ret = btrfs_map_bio(root, rw, bio, mirror_num, 0); | 1946 | ret = btrfs_map_bio(root, bio, mirror_num, 0); |
1948 | 1947 | ||
1949 | out: | 1948 | out: |
1950 | if (ret < 0) { | 1949 | if (ret < 0) { |
@@ -7778,7 +7777,7 @@ err: | |||
7778 | } | 7777 | } |
7779 | 7778 | ||
7780 | static inline int submit_dio_repair_bio(struct inode *inode, struct bio *bio, | 7779 | static inline int submit_dio_repair_bio(struct inode *inode, struct bio *bio, |
7781 | int rw, int mirror_num) | 7780 | int mirror_num) |
7782 | { | 7781 | { |
7783 | struct btrfs_root *root = BTRFS_I(inode)->root; | 7782 | struct btrfs_root *root = BTRFS_I(inode)->root; |
7784 | int ret; | 7783 | int ret; |
@@ -7792,7 +7791,7 @@ static inline int submit_dio_repair_bio(struct inode *inode, struct bio *bio, | |||
7792 | if (ret) | 7791 | if (ret) |
7793 | goto err; | 7792 | goto err; |
7794 | 7793 | ||
7795 | ret = btrfs_map_bio(root, rw, bio, mirror_num, 0); | 7794 | ret = btrfs_map_bio(root, bio, mirror_num, 0); |
7796 | err: | 7795 | err: |
7797 | bio_put(bio); | 7796 | bio_put(bio); |
7798 | return ret; | 7797 | return ret; |
@@ -7877,8 +7876,7 @@ static int dio_read_error(struct inode *inode, struct bio *failed_bio, | |||
7877 | "Repair DIO Read Error: submitting new dio read[%#x] to this_mirror=%d, in_validation=%d\n", | 7876 | "Repair DIO Read Error: submitting new dio read[%#x] to this_mirror=%d, in_validation=%d\n", |
7878 | read_mode, failrec->this_mirror, failrec->in_validation); | 7877 | read_mode, failrec->this_mirror, failrec->in_validation); |
7879 | 7878 | ||
7880 | ret = submit_dio_repair_bio(inode, bio, read_mode, | 7879 | ret = submit_dio_repair_bio(inode, bio, failrec->this_mirror); |
7881 | failrec->this_mirror); | ||
7882 | if (ret) { | 7880 | if (ret) { |
7883 | free_io_failure(inode, failrec); | 7881 | free_io_failure(inode, failrec); |
7884 | bio_put(bio); | 7882 | bio_put(bio); |
@@ -8168,7 +8166,7 @@ static void btrfs_endio_direct_write(struct bio *bio) | |||
8168 | bio_put(bio); | 8166 | bio_put(bio); |
8169 | } | 8167 | } |
8170 | 8168 | ||
8171 | static int __btrfs_submit_bio_start_direct_io(struct inode *inode, int rw, | 8169 | static int __btrfs_submit_bio_start_direct_io(struct inode *inode, |
8172 | struct bio *bio, int mirror_num, | 8170 | struct bio *bio, int mirror_num, |
8173 | unsigned long bio_flags, u64 offset) | 8171 | unsigned long bio_flags, u64 offset) |
8174 | { | 8172 | { |
@@ -8261,7 +8259,7 @@ static inline int btrfs_lookup_and_bind_dio_csum(struct btrfs_root *root, | |||
8261 | } | 8259 | } |
8262 | 8260 | ||
8263 | static inline int __btrfs_submit_dio_bio(struct bio *bio, struct inode *inode, | 8261 | static inline int __btrfs_submit_dio_bio(struct bio *bio, struct inode *inode, |
8264 | int rw, u64 file_offset, int skip_sum, | 8262 | u64 file_offset, int skip_sum, |
8265 | int async_submit) | 8263 | int async_submit) |
8266 | { | 8264 | { |
8267 | struct btrfs_dio_private *dip = bio->bi_private; | 8265 | struct btrfs_dio_private *dip = bio->bi_private; |
@@ -8286,8 +8284,7 @@ static inline int __btrfs_submit_dio_bio(struct bio *bio, struct inode *inode, | |||
8286 | 8284 | ||
8287 | if (write && async_submit) { | 8285 | if (write && async_submit) { |
8288 | ret = btrfs_wq_submit_bio(root->fs_info, | 8286 | ret = btrfs_wq_submit_bio(root->fs_info, |
8289 | inode, rw, bio, 0, 0, | 8287 | inode, bio, 0, 0, file_offset, |
8290 | file_offset, | ||
8291 | __btrfs_submit_bio_start_direct_io, | 8288 | __btrfs_submit_bio_start_direct_io, |
8292 | __btrfs_submit_bio_done); | 8289 | __btrfs_submit_bio_done); |
8293 | goto err; | 8290 | goto err; |
@@ -8306,13 +8303,13 @@ static inline int __btrfs_submit_dio_bio(struct bio *bio, struct inode *inode, | |||
8306 | goto err; | 8303 | goto err; |
8307 | } | 8304 | } |
8308 | map: | 8305 | map: |
8309 | ret = btrfs_map_bio(root, rw, bio, 0, async_submit); | 8306 | ret = btrfs_map_bio(root, bio, 0, async_submit); |
8310 | err: | 8307 | err: |
8311 | bio_put(bio); | 8308 | bio_put(bio); |
8312 | return ret; | 8309 | return ret; |
8313 | } | 8310 | } |
8314 | 8311 | ||
8315 | static int btrfs_submit_direct_hook(int rw, struct btrfs_dio_private *dip, | 8312 | static int btrfs_submit_direct_hook(struct btrfs_dio_private *dip, |
8316 | int skip_sum) | 8313 | int skip_sum) |
8317 | { | 8314 | { |
8318 | struct inode *inode = dip->inode; | 8315 | struct inode *inode = dip->inode; |
@@ -8372,7 +8369,7 @@ next_block: | |||
8372 | * before we're done setting it up | 8369 | * before we're done setting it up |
8373 | */ | 8370 | */ |
8374 | atomic_inc(&dip->pending_bios); | 8371 | atomic_inc(&dip->pending_bios); |
8375 | ret = __btrfs_submit_dio_bio(bio, inode, rw, | 8372 | ret = __btrfs_submit_dio_bio(bio, inode, |
8376 | file_offset, skip_sum, | 8373 | file_offset, skip_sum, |
8377 | async_submit); | 8374 | async_submit); |
8378 | if (ret) { | 8375 | if (ret) { |
@@ -8416,7 +8413,7 @@ next_block: | |||
8416 | } | 8413 | } |
8417 | 8414 | ||
8418 | submit: | 8415 | submit: |
8419 | ret = __btrfs_submit_dio_bio(bio, inode, rw, file_offset, skip_sum, | 8416 | ret = __btrfs_submit_dio_bio(bio, inode, file_offset, skip_sum, |
8420 | async_submit); | 8417 | async_submit); |
8421 | if (!ret) | 8418 | if (!ret) |
8422 | return 0; | 8419 | return 0; |
@@ -8494,7 +8491,7 @@ static void btrfs_submit_direct(struct bio *dio_bio, struct inode *inode, | |||
8494 | dio_data->unsubmitted_oe_range_end; | 8491 | dio_data->unsubmitted_oe_range_end; |
8495 | } | 8492 | } |
8496 | 8493 | ||
8497 | ret = btrfs_submit_direct_hook(dio_bio->bi_rw, dip, skip_sum); | 8494 | ret = btrfs_submit_direct_hook(dip, skip_sum); |
8498 | if (!ret) | 8495 | if (!ret) |
8499 | return; | 8496 | return; |
8500 | 8497 | ||