aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2009-10-08 11:27:10 -0400
committerChris Mason <chris.mason@oracle.com>2009-10-08 15:11:49 -0400
commita791e35e12ff672e8a0e140abeeaf900c3b2ea77 (patch)
treef03b99451619c0425f3c93fbef3940c2b08c1bd3 /fs/btrfs/inode.c
parent1cdda9b81ac0e6ee986f034fa02f221679e1c11a (diff)
Btrfs: cleanup extent_clear_unlock_delalloc flags
extent_clear_unlock_delalloc has a growing set of ugly parameters that is very difficult to read and maintain. This switches to a flag field and well named flag defines. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c45
1 files changed, 30 insertions, 15 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 3a6f953337b5..a7058fca3aab 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -424,9 +424,10 @@ again:
424 * and free up our temp pages. 424 * and free up our temp pages.
425 */ 425 */
426 extent_clear_unlock_delalloc(inode, 426 extent_clear_unlock_delalloc(inode,
427 &BTRFS_I(inode)->io_tree, 427 &BTRFS_I(inode)->io_tree,
428 start, end, NULL, 1, 0, 428 start, end, NULL,
429 0, 1, 1, 1, 0); 429 EXTENT_CLEAR_UNLOCK_PAGE | EXTENT_CLEAR_DIRTY |
430 EXTENT_SET_WRITEBACK | EXTENT_END_WRITEBACK);
430 ret = 0; 431 ret = 0;
431 goto free_pages_out; 432 goto free_pages_out;
432 } 433 }
@@ -637,11 +638,13 @@ static noinline int submit_compressed_extents(struct inode *inode,
637 * clear dirty, set writeback and unlock the pages. 638 * clear dirty, set writeback and unlock the pages.
638 */ 639 */
639 extent_clear_unlock_delalloc(inode, 640 extent_clear_unlock_delalloc(inode,
640 &BTRFS_I(inode)->io_tree, 641 &BTRFS_I(inode)->io_tree,
641 async_extent->start, 642 async_extent->start,
642 async_extent->start + 643 async_extent->start +
643 async_extent->ram_size - 1, 644 async_extent->ram_size - 1,
644 NULL, 1, 1, 0, 1, 1, 0, 0); 645 NULL, EXTENT_CLEAR_UNLOCK_PAGE |
646 EXTENT_CLEAR_UNLOCK |
647 EXTENT_CLEAR_DIRTY | EXTENT_SET_WRITEBACK);
645 648
646 ret = btrfs_submit_compressed_write(inode, 649 ret = btrfs_submit_compressed_write(inode,
647 async_extent->start, 650 async_extent->start,
@@ -712,9 +715,14 @@ static noinline int cow_file_range(struct inode *inode,
712 start, end, 0, NULL); 715 start, end, 0, NULL);
713 if (ret == 0) { 716 if (ret == 0) {
714 extent_clear_unlock_delalloc(inode, 717 extent_clear_unlock_delalloc(inode,
715 &BTRFS_I(inode)->io_tree, 718 &BTRFS_I(inode)->io_tree,
716 start, end, NULL, 1, 1, 719 start, end, NULL,
717 1, 1, 1, 1, 0); 720 EXTENT_CLEAR_UNLOCK_PAGE |
721 EXTENT_CLEAR_UNLOCK |
722 EXTENT_CLEAR_DELALLOC |
723 EXTENT_CLEAR_DIRTY |
724 EXTENT_SET_WRITEBACK |
725 EXTENT_END_WRITEBACK);
718 *nr_written = *nr_written + 726 *nr_written = *nr_written +
719 (end - start + PAGE_CACHE_SIZE) / PAGE_CACHE_SIZE; 727 (end - start + PAGE_CACHE_SIZE) / PAGE_CACHE_SIZE;
720 *page_started = 1; 728 *page_started = 1;
@@ -738,6 +746,8 @@ static noinline int cow_file_range(struct inode *inode,
738 btrfs_drop_extent_cache(inode, start, start + num_bytes - 1, 0); 746 btrfs_drop_extent_cache(inode, start, start + num_bytes - 1, 0);
739 747
740 while (disk_num_bytes > 0) { 748 while (disk_num_bytes > 0) {
749 unsigned long op;
750
741 cur_alloc_size = min(disk_num_bytes, root->fs_info->max_extent); 751 cur_alloc_size = min(disk_num_bytes, root->fs_info->max_extent);
742 ret = btrfs_reserve_extent(trans, root, cur_alloc_size, 752 ret = btrfs_reserve_extent(trans, root, cur_alloc_size,
743 root->sectorsize, 0, alloc_hint, 753 root->sectorsize, 0, alloc_hint,
@@ -789,10 +799,13 @@ static noinline int cow_file_range(struct inode *inode,
789 * Do set the Private2 bit so we know this page was properly 799 * Do set the Private2 bit so we know this page was properly
790 * setup for writepage 800 * setup for writepage
791 */ 801 */
802 op = unlock ? EXTENT_CLEAR_UNLOCK_PAGE : 0;
803 op |= EXTENT_CLEAR_UNLOCK | EXTENT_CLEAR_DELALLOC |
804 EXTENT_SET_PRIVATE2;
805
792 extent_clear_unlock_delalloc(inode, &BTRFS_I(inode)->io_tree, 806 extent_clear_unlock_delalloc(inode, &BTRFS_I(inode)->io_tree,
793 start, start + ram_size - 1, 807 start, start + ram_size - 1,
794 locked_page, unlock, 1, 808 locked_page, op);
795 1, 0, 0, 0, 1);
796 disk_num_bytes -= cur_alloc_size; 809 disk_num_bytes -= cur_alloc_size;
797 num_bytes -= cur_alloc_size; 810 num_bytes -= cur_alloc_size;
798 alloc_hint = ins.objectid + ins.offset; 811 alloc_hint = ins.objectid + ins.offset;
@@ -1112,8 +1125,10 @@ out_check:
1112 BUG_ON(ret); 1125 BUG_ON(ret);
1113 1126
1114 extent_clear_unlock_delalloc(inode, &BTRFS_I(inode)->io_tree, 1127 extent_clear_unlock_delalloc(inode, &BTRFS_I(inode)->io_tree,
1115 cur_offset, cur_offset + num_bytes - 1, 1128 cur_offset, cur_offset + num_bytes - 1,
1116 locked_page, 1, 1, 1, 0, 0, 0, 1); 1129 locked_page, EXTENT_CLEAR_UNLOCK_PAGE |
1130 EXTENT_CLEAR_UNLOCK | EXTENT_CLEAR_DELALLOC |
1131 EXTENT_SET_PRIVATE2);
1117 cur_offset = extent_end; 1132 cur_offset = extent_end;
1118 if (cur_offset > end) 1133 if (cur_offset > end)
1119 break; 1134 break;