diff options
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 0be044bb619..dc95f636a11 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -83,6 +83,7 @@ struct async_submit_bio { | |||
83 | extent_submit_bio_hook_t *submit_bio_hook; | 83 | extent_submit_bio_hook_t *submit_bio_hook; |
84 | int rw; | 84 | int rw; |
85 | int mirror_num; | 85 | int mirror_num; |
86 | unsigned long bio_flags; | ||
86 | struct btrfs_work work; | 87 | struct btrfs_work work; |
87 | }; | 88 | }; |
88 | 89 | ||
@@ -115,6 +116,7 @@ struct extent_map *btree_get_extent(struct inode *inode, struct page *page, | |||
115 | } | 116 | } |
116 | em->start = 0; | 117 | em->start = 0; |
117 | em->len = (u64)-1; | 118 | em->len = (u64)-1; |
119 | em->block_len = (u64)-1; | ||
118 | em->block_start = 0; | 120 | em->block_start = 0; |
119 | em->bdev = BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev; | 121 | em->bdev = BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev; |
120 | 122 | ||
@@ -469,12 +471,13 @@ static void run_one_async_submit(struct btrfs_work *work) | |||
469 | wake_up(&fs_info->async_submit_wait); | 471 | wake_up(&fs_info->async_submit_wait); |
470 | 472 | ||
471 | async->submit_bio_hook(async->inode, async->rw, async->bio, | 473 | async->submit_bio_hook(async->inode, async->rw, async->bio, |
472 | async->mirror_num); | 474 | async->mirror_num, async->bio_flags); |
473 | kfree(async); | 475 | kfree(async); |
474 | } | 476 | } |
475 | 477 | ||
476 | int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode, | 478 | int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode, |
477 | int rw, struct bio *bio, int mirror_num, | 479 | int rw, struct bio *bio, int mirror_num, |
480 | unsigned long bio_flags, | ||
478 | extent_submit_bio_hook_t *submit_bio_hook) | 481 | extent_submit_bio_hook_t *submit_bio_hook) |
479 | { | 482 | { |
480 | struct async_submit_bio *async; | 483 | struct async_submit_bio *async; |
@@ -491,6 +494,7 @@ int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode, | |||
491 | async->submit_bio_hook = submit_bio_hook; | 494 | async->submit_bio_hook = submit_bio_hook; |
492 | async->work.func = run_one_async_submit; | 495 | async->work.func = run_one_async_submit; |
493 | async->work.flags = 0; | 496 | async->work.flags = 0; |
497 | async->bio_flags = bio_flags; | ||
494 | 498 | ||
495 | while(atomic_read(&fs_info->async_submit_draining) && | 499 | while(atomic_read(&fs_info->async_submit_draining) && |
496 | atomic_read(&fs_info->nr_async_submits)) { | 500 | atomic_read(&fs_info->nr_async_submits)) { |
@@ -530,7 +534,7 @@ static int btree_csum_one_bio(struct bio *bio) | |||
530 | } | 534 | } |
531 | 535 | ||
532 | static int __btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio, | 536 | static int __btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio, |
533 | int mirror_num) | 537 | int mirror_num, unsigned long bio_flags) |
534 | { | 538 | { |
535 | struct btrfs_root *root = BTRFS_I(inode)->root; | 539 | struct btrfs_root *root = BTRFS_I(inode)->root; |
536 | int ret; | 540 | int ret; |
@@ -556,17 +560,17 @@ static int __btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio, | |||
556 | } | 560 | } |
557 | 561 | ||
558 | static int btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio, | 562 | static int btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio, |
559 | int mirror_num) | 563 | int mirror_num, unsigned long bio_flags) |
560 | { | 564 | { |
561 | /* | 565 | /* |
562 | * kthread helpers are used to submit writes so that checksumming | 566 | * kthread helpers are used to submit writes so that checksumming |
563 | * can happen in parallel across all CPUs | 567 | * can happen in parallel across all CPUs |
564 | */ | 568 | */ |
565 | if (!(rw & (1 << BIO_RW))) { | 569 | if (!(rw & (1 << BIO_RW))) { |
566 | return __btree_submit_bio_hook(inode, rw, bio, mirror_num); | 570 | return __btree_submit_bio_hook(inode, rw, bio, mirror_num, 0); |
567 | } | 571 | } |
568 | return btrfs_wq_submit_bio(BTRFS_I(inode)->root->fs_info, | 572 | return btrfs_wq_submit_bio(BTRFS_I(inode)->root->fs_info, |
569 | inode, rw, bio, mirror_num, | 573 | inode, rw, bio, mirror_num, 0, |
570 | __btree_submit_bio_hook); | 574 | __btree_submit_bio_hook); |
571 | } | 575 | } |
572 | 576 | ||
@@ -1407,6 +1411,7 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1407 | fs_info->btree_inode = new_inode(sb); | 1411 | fs_info->btree_inode = new_inode(sb); |
1408 | fs_info->btree_inode->i_ino = 1; | 1412 | fs_info->btree_inode->i_ino = 1; |
1409 | fs_info->btree_inode->i_nlink = 1; | 1413 | fs_info->btree_inode->i_nlink = 1; |
1414 | |||
1410 | fs_info->thread_pool_size = min(num_online_cpus() + 2, 8); | 1415 | fs_info->thread_pool_size = min(num_online_cpus() + 2, 8); |
1411 | 1416 | ||
1412 | INIT_LIST_HEAD(&fs_info->ordered_extents); | 1417 | INIT_LIST_HEAD(&fs_info->ordered_extents); |
@@ -1508,6 +1513,7 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1508 | */ | 1513 | */ |
1509 | btrfs_init_workers(&fs_info->workers, "worker", | 1514 | btrfs_init_workers(&fs_info->workers, "worker", |
1510 | fs_info->thread_pool_size); | 1515 | fs_info->thread_pool_size); |
1516 | |||
1511 | btrfs_init_workers(&fs_info->submit_workers, "submit", | 1517 | btrfs_init_workers(&fs_info->submit_workers, "submit", |
1512 | min_t(u64, fs_devices->num_devices, | 1518 | min_t(u64, fs_devices->num_devices, |
1513 | fs_info->thread_pool_size)); | 1519 | fs_info->thread_pool_size)); |
@@ -1559,6 +1565,8 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1559 | } | 1565 | } |
1560 | 1566 | ||
1561 | fs_info->bdi.ra_pages *= btrfs_super_num_devices(disk_super); | 1567 | fs_info->bdi.ra_pages *= btrfs_super_num_devices(disk_super); |
1568 | fs_info->bdi.ra_pages = max(fs_info->bdi.ra_pages, | ||
1569 | 4 * 1024 * 1024 / PAGE_CACHE_SIZE); | ||
1562 | 1570 | ||
1563 | nodesize = btrfs_super_nodesize(disk_super); | 1571 | nodesize = btrfs_super_nodesize(disk_super); |
1564 | leafsize = btrfs_super_leafsize(disk_super); | 1572 | leafsize = btrfs_super_leafsize(disk_super); |