diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-18 19:50:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-18 19:50:55 -0400 |
commit | 441f4058a04b2943685ff94e0f5f1992b0b3649e (patch) | |
tree | 80a61f6dddcf7d5831a8bd3771ffa2b430af3935 /fs/btrfs/file.c | |
parent | 7c34691abe23741bfc7d2514efd5a39f0e0ecb06 (diff) | |
parent | 8ad6fcab564c5bc956bdc3dfa440ab152b6e780f (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
* git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable: (30 commits)
Btrfs: fix the inode ref searches done by btrfs_search_path_in_tree
Btrfs: allow treeid==0 in the inode lookup ioctl
Btrfs: return keys for large items to the search ioctl
Btrfs: fix key checks and advance in the search ioctl
Btrfs: buffer results in the space_info ioctl
Btrfs: use __u64 types in ioctl.h
Btrfs: fix search_ioctl key advance
Btrfs: fix gfp flags masking in the compression code
Btrfs: don't look at bio flags after submit_bio
btrfs: using btrfs_stack_device_id() get devid
btrfs: use memparse
Btrfs: add a "df" ioctl for btrfs
Btrfs: cache the extent state everywhere we possibly can V2
Btrfs: cache ordered extent when completing io
Btrfs: cache extent state in find_delalloc_range
Btrfs: change the ordered tree to use a spinlock instead of a mutex
Btrfs: finish read pages in the order they are submitted
btrfs: fix btrfs_mkdir goto for no free objectids
Btrfs: flush data on snapshot creation
Btrfs: make df be a little bit more understandable
...
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r-- | fs/btrfs/file.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 6ed434ac037f..ee3323c7fc1c 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -123,7 +123,8 @@ static noinline int dirty_and_release_pages(struct btrfs_trans_handle *trans, | |||
123 | root->sectorsize - 1) & ~((u64)root->sectorsize - 1); | 123 | root->sectorsize - 1) & ~((u64)root->sectorsize - 1); |
124 | 124 | ||
125 | end_of_last_block = start_pos + num_bytes - 1; | 125 | end_of_last_block = start_pos + num_bytes - 1; |
126 | err = btrfs_set_extent_delalloc(inode, start_pos, end_of_last_block); | 126 | err = btrfs_set_extent_delalloc(inode, start_pos, end_of_last_block, |
127 | NULL); | ||
127 | if (err) | 128 | if (err) |
128 | return err; | 129 | return err; |
129 | 130 | ||
@@ -753,6 +754,7 @@ static noinline int prepare_pages(struct btrfs_root *root, struct file *file, | |||
753 | loff_t pos, unsigned long first_index, | 754 | loff_t pos, unsigned long first_index, |
754 | unsigned long last_index, size_t write_bytes) | 755 | unsigned long last_index, size_t write_bytes) |
755 | { | 756 | { |
757 | struct extent_state *cached_state = NULL; | ||
756 | int i; | 758 | int i; |
757 | unsigned long index = pos >> PAGE_CACHE_SHIFT; | 759 | unsigned long index = pos >> PAGE_CACHE_SHIFT; |
758 | struct inode *inode = fdentry(file)->d_inode; | 760 | struct inode *inode = fdentry(file)->d_inode; |
@@ -781,16 +783,18 @@ again: | |||
781 | } | 783 | } |
782 | if (start_pos < inode->i_size) { | 784 | if (start_pos < inode->i_size) { |
783 | struct btrfs_ordered_extent *ordered; | 785 | struct btrfs_ordered_extent *ordered; |
784 | lock_extent(&BTRFS_I(inode)->io_tree, | 786 | lock_extent_bits(&BTRFS_I(inode)->io_tree, |
785 | start_pos, last_pos - 1, GFP_NOFS); | 787 | start_pos, last_pos - 1, 0, &cached_state, |
788 | GFP_NOFS); | ||
786 | ordered = btrfs_lookup_first_ordered_extent(inode, | 789 | ordered = btrfs_lookup_first_ordered_extent(inode, |
787 | last_pos - 1); | 790 | last_pos - 1); |
788 | if (ordered && | 791 | if (ordered && |
789 | ordered->file_offset + ordered->len > start_pos && | 792 | ordered->file_offset + ordered->len > start_pos && |
790 | ordered->file_offset < last_pos) { | 793 | ordered->file_offset < last_pos) { |
791 | btrfs_put_ordered_extent(ordered); | 794 | btrfs_put_ordered_extent(ordered); |
792 | unlock_extent(&BTRFS_I(inode)->io_tree, | 795 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, |
793 | start_pos, last_pos - 1, GFP_NOFS); | 796 | start_pos, last_pos - 1, |
797 | &cached_state, GFP_NOFS); | ||
794 | for (i = 0; i < num_pages; i++) { | 798 | for (i = 0; i < num_pages; i++) { |
795 | unlock_page(pages[i]); | 799 | unlock_page(pages[i]); |
796 | page_cache_release(pages[i]); | 800 | page_cache_release(pages[i]); |
@@ -802,12 +806,13 @@ again: | |||
802 | if (ordered) | 806 | if (ordered) |
803 | btrfs_put_ordered_extent(ordered); | 807 | btrfs_put_ordered_extent(ordered); |
804 | 808 | ||
805 | clear_extent_bits(&BTRFS_I(inode)->io_tree, start_pos, | 809 | clear_extent_bit(&BTRFS_I(inode)->io_tree, start_pos, |
806 | last_pos - 1, EXTENT_DIRTY | EXTENT_DELALLOC | | 810 | last_pos - 1, EXTENT_DIRTY | EXTENT_DELALLOC | |
807 | EXTENT_DO_ACCOUNTING, | 811 | EXTENT_DO_ACCOUNTING, 0, 0, &cached_state, |
808 | GFP_NOFS); | 812 | GFP_NOFS); |
809 | unlock_extent(&BTRFS_I(inode)->io_tree, | 813 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, |
810 | start_pos, last_pos - 1, GFP_NOFS); | 814 | start_pos, last_pos - 1, &cached_state, |
815 | GFP_NOFS); | ||
811 | } | 816 | } |
812 | for (i = 0; i < num_pages; i++) { | 817 | for (i = 0; i < num_pages; i++) { |
813 | clear_page_dirty_for_io(pages[i]); | 818 | clear_page_dirty_for_io(pages[i]); |