diff options
author | Jeff Mahoney <jeffm@suse.com> | 2012-03-01 08:57:19 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2012-03-21 20:45:35 -0400 |
commit | d0082371cf086e0ba2bbd0367b2c9920532df24f (patch) | |
tree | 4ae3fb6565f36fd606ab6e4b83d489e66b3b86d7 | |
parent | 143bede527b054a271053f41bfaca2b57baa9408 (diff) |
btrfs: drop gfp_t from lock_extent
lock_extent and unlock_extent are always called with GFP_NOFS, drop the
argument and use GFP_NOFS consistently.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
-rw-r--r-- | fs/btrfs/compression.c | 6 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 2 | ||||
-rw-r--r-- | fs/btrfs/extent_io.c | 41 | ||||
-rw-r--r-- | fs/btrfs/extent_io.h | 9 | ||||
-rw-r--r-- | fs/btrfs/file.c | 7 | ||||
-rw-r--r-- | fs/btrfs/free-space-cache.c | 2 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 33 | ||||
-rw-r--r-- | fs/btrfs/ioctl.c | 17 | ||||
-rw-r--r-- | fs/btrfs/relocation.c | 22 |
9 files changed, 63 insertions, 76 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 0ed1ed22775f..cfd158dccdec 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
@@ -496,7 +496,7 @@ static noinline int add_ra_bio_pages(struct inode *inode, | |||
496 | * sure they map to this compressed extent on disk. | 496 | * sure they map to this compressed extent on disk. |
497 | */ | 497 | */ |
498 | set_page_extent_mapped(page); | 498 | set_page_extent_mapped(page); |
499 | lock_extent(tree, last_offset, end, GFP_NOFS); | 499 | lock_extent(tree, last_offset, end); |
500 | read_lock(&em_tree->lock); | 500 | read_lock(&em_tree->lock); |
501 | em = lookup_extent_mapping(em_tree, last_offset, | 501 | em = lookup_extent_mapping(em_tree, last_offset, |
502 | PAGE_CACHE_SIZE); | 502 | PAGE_CACHE_SIZE); |
@@ -506,7 +506,7 @@ static noinline int add_ra_bio_pages(struct inode *inode, | |||
506 | (last_offset + PAGE_CACHE_SIZE > extent_map_end(em)) || | 506 | (last_offset + PAGE_CACHE_SIZE > extent_map_end(em)) || |
507 | (em->block_start >> 9) != cb->orig_bio->bi_sector) { | 507 | (em->block_start >> 9) != cb->orig_bio->bi_sector) { |
508 | free_extent_map(em); | 508 | free_extent_map(em); |
509 | unlock_extent(tree, last_offset, end, GFP_NOFS); | 509 | unlock_extent(tree, last_offset, end); |
510 | unlock_page(page); | 510 | unlock_page(page); |
511 | page_cache_release(page); | 511 | page_cache_release(page); |
512 | break; | 512 | break; |
@@ -534,7 +534,7 @@ static noinline int add_ra_bio_pages(struct inode *inode, | |||
534 | nr_pages++; | 534 | nr_pages++; |
535 | page_cache_release(page); | 535 | page_cache_release(page); |
536 | } else { | 536 | } else { |
537 | unlock_extent(tree, last_offset, end, GFP_NOFS); | 537 | unlock_extent(tree, last_offset, end); |
538 | unlock_page(page); | 538 | unlock_page(page); |
539 | page_cache_release(page); | 539 | page_cache_release(page); |
540 | break; | 540 | break; |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 73ccadce90bc..69ef456b32fa 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -332,7 +332,7 @@ static int verify_parent_transid(struct extent_io_tree *io_tree, | |||
332 | return 0; | 332 | return 0; |
333 | 333 | ||
334 | lock_extent_bits(io_tree, eb->start, eb->start + eb->len - 1, | 334 | lock_extent_bits(io_tree, eb->start, eb->start + eb->len - 1, |
335 | 0, &cached_state, GFP_NOFS); | 335 | 0, &cached_state); |
336 | if (extent_buffer_uptodate(io_tree, eb, cached_state) && | 336 | if (extent_buffer_uptodate(io_tree, eb, cached_state) && |
337 | btrfs_header_generation(eb) == parent_transid) { | 337 | btrfs_header_generation(eb) == parent_transid) { |
338 | ret = 0; | 338 | ret = 0; |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 65216fabacbb..0112c02742f4 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -1171,42 +1171,40 @@ static int clear_extent_uptodate(struct extent_io_tree *tree, u64 start, | |||
1171 | * us if waiting is desired. | 1171 | * us if waiting is desired. |
1172 | */ | 1172 | */ |
1173 | int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, | 1173 | int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, |
1174 | int bits, struct extent_state **cached_state, gfp_t mask) | 1174 | int bits, struct extent_state **cached_state) |
1175 | { | 1175 | { |
1176 | int err; | 1176 | int err; |
1177 | u64 failed_start; | 1177 | u64 failed_start; |
1178 | while (1) { | 1178 | while (1) { |
1179 | err = set_extent_bit(tree, start, end, EXTENT_LOCKED | bits, | 1179 | err = set_extent_bit(tree, start, end, EXTENT_LOCKED | bits, |
1180 | EXTENT_LOCKED, &failed_start, | 1180 | EXTENT_LOCKED, &failed_start, |
1181 | cached_state, mask); | 1181 | cached_state, GFP_NOFS); |
1182 | if (err == -EEXIST && (mask & __GFP_WAIT)) { | 1182 | if (err == -EEXIST) { |
1183 | wait_extent_bit(tree, failed_start, end, EXTENT_LOCKED); | 1183 | wait_extent_bit(tree, failed_start, end, EXTENT_LOCKED); |
1184 | start = failed_start; | 1184 | start = failed_start; |
1185 | } else { | 1185 | } else |
1186 | break; | 1186 | break; |
1187 | } | ||
1188 | WARN_ON(start > end); | 1187 | WARN_ON(start > end); |
1189 | } | 1188 | } |
1190 | return err; | 1189 | return err; |
1191 | } | 1190 | } |
1192 | 1191 | ||
1193 | int lock_extent(struct extent_io_tree *tree, u64 start, u64 end, gfp_t mask) | 1192 | int lock_extent(struct extent_io_tree *tree, u64 start, u64 end) |
1194 | { | 1193 | { |
1195 | return lock_extent_bits(tree, start, end, 0, NULL, mask); | 1194 | return lock_extent_bits(tree, start, end, 0, NULL); |
1196 | } | 1195 | } |
1197 | 1196 | ||
1198 | int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end, | 1197 | int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end) |
1199 | gfp_t mask) | ||
1200 | { | 1198 | { |
1201 | int err; | 1199 | int err; |
1202 | u64 failed_start; | 1200 | u64 failed_start; |
1203 | 1201 | ||
1204 | err = set_extent_bit(tree, start, end, EXTENT_LOCKED, EXTENT_LOCKED, | 1202 | err = set_extent_bit(tree, start, end, EXTENT_LOCKED, EXTENT_LOCKED, |
1205 | &failed_start, NULL, mask); | 1203 | &failed_start, NULL, GFP_NOFS); |
1206 | if (err == -EEXIST) { | 1204 | if (err == -EEXIST) { |
1207 | if (failed_start > start) | 1205 | if (failed_start > start) |
1208 | clear_extent_bit(tree, start, failed_start - 1, | 1206 | clear_extent_bit(tree, start, failed_start - 1, |
1209 | EXTENT_LOCKED, 1, 0, NULL, mask); | 1207 | EXTENT_LOCKED, 1, 0, NULL, GFP_NOFS); |
1210 | return 0; | 1208 | return 0; |
1211 | } | 1209 | } |
1212 | return 1; | 1210 | return 1; |
@@ -1219,10 +1217,10 @@ int unlock_extent_cached(struct extent_io_tree *tree, u64 start, u64 end, | |||
1219 | mask); | 1217 | mask); |
1220 | } | 1218 | } |
1221 | 1219 | ||
1222 | int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end, gfp_t mask) | 1220 | int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end) |
1223 | { | 1221 | { |
1224 | return clear_extent_bit(tree, start, end, EXTENT_LOCKED, 1, 0, NULL, | 1222 | return clear_extent_bit(tree, start, end, EXTENT_LOCKED, 1, 0, NULL, |
1225 | mask); | 1223 | GFP_NOFS); |
1226 | } | 1224 | } |
1227 | 1225 | ||
1228 | /* | 1226 | /* |
@@ -1518,8 +1516,7 @@ again: | |||
1518 | BUG_ON(ret); | 1516 | BUG_ON(ret); |
1519 | 1517 | ||
1520 | /* step three, lock the state bits for the whole range */ | 1518 | /* step three, lock the state bits for the whole range */ |
1521 | lock_extent_bits(tree, delalloc_start, delalloc_end, | 1519 | lock_extent_bits(tree, delalloc_start, delalloc_end, 0, &cached_state); |
1522 | 0, &cached_state, GFP_NOFS); | ||
1523 | 1520 | ||
1524 | /* then test to make sure it is all still delalloc */ | 1521 | /* then test to make sure it is all still delalloc */ |
1525 | ret = test_range_bit(tree, delalloc_start, delalloc_end, | 1522 | ret = test_range_bit(tree, delalloc_start, delalloc_end, |
@@ -2557,11 +2554,11 @@ static int __extent_read_full_page(struct extent_io_tree *tree, | |||
2557 | 2554 | ||
2558 | end = page_end; | 2555 | end = page_end; |
2559 | while (1) { | 2556 | while (1) { |
2560 | lock_extent(tree, start, end, GFP_NOFS); | 2557 | lock_extent(tree, start, end); |
2561 | ordered = btrfs_lookup_ordered_extent(inode, start); | 2558 | ordered = btrfs_lookup_ordered_extent(inode, start); |
2562 | if (!ordered) | 2559 | if (!ordered) |
2563 | break; | 2560 | break; |
2564 | unlock_extent(tree, start, end, GFP_NOFS); | 2561 | unlock_extent(tree, start, end); |
2565 | btrfs_start_ordered_extent(inode, ordered, 1); | 2562 | btrfs_start_ordered_extent(inode, ordered, 1); |
2566 | btrfs_put_ordered_extent(ordered); | 2563 | btrfs_put_ordered_extent(ordered); |
2567 | } | 2564 | } |
@@ -2598,7 +2595,7 @@ static int __extent_read_full_page(struct extent_io_tree *tree, | |||
2598 | end - cur + 1, 0); | 2595 | end - cur + 1, 0); |
2599 | if (IS_ERR_OR_NULL(em)) { | 2596 | if (IS_ERR_OR_NULL(em)) { |
2600 | SetPageError(page); | 2597 | SetPageError(page); |
2601 | unlock_extent(tree, cur, end, GFP_NOFS); | 2598 | unlock_extent(tree, cur, end); |
2602 | break; | 2599 | break; |
2603 | } | 2600 | } |
2604 | extent_offset = cur - em->start; | 2601 | extent_offset = cur - em->start; |
@@ -2650,7 +2647,7 @@ static int __extent_read_full_page(struct extent_io_tree *tree, | |||
2650 | if (test_range_bit(tree, cur, cur_end, | 2647 | if (test_range_bit(tree, cur, cur_end, |
2651 | EXTENT_UPTODATE, 1, NULL)) { | 2648 | EXTENT_UPTODATE, 1, NULL)) { |
2652 | check_page_uptodate(tree, page); | 2649 | check_page_uptodate(tree, page); |
2653 | unlock_extent(tree, cur, cur + iosize - 1, GFP_NOFS); | 2650 | unlock_extent(tree, cur, cur + iosize - 1); |
2654 | cur = cur + iosize; | 2651 | cur = cur + iosize; |
2655 | pg_offset += iosize; | 2652 | pg_offset += iosize; |
2656 | continue; | 2653 | continue; |
@@ -2660,7 +2657,7 @@ static int __extent_read_full_page(struct extent_io_tree *tree, | |||
2660 | */ | 2657 | */ |
2661 | if (block_start == EXTENT_MAP_INLINE) { | 2658 | if (block_start == EXTENT_MAP_INLINE) { |
2662 | SetPageError(page); | 2659 | SetPageError(page); |
2663 | unlock_extent(tree, cur, cur + iosize - 1, GFP_NOFS); | 2660 | unlock_extent(tree, cur, cur + iosize - 1); |
2664 | cur = cur + iosize; | 2661 | cur = cur + iosize; |
2665 | pg_offset += iosize; | 2662 | pg_offset += iosize; |
2666 | continue; | 2663 | continue; |
@@ -3274,7 +3271,7 @@ int extent_invalidatepage(struct extent_io_tree *tree, | |||
3274 | if (start > end) | 3271 | if (start > end) |
3275 | return 0; | 3272 | return 0; |
3276 | 3273 | ||
3277 | lock_extent_bits(tree, start, end, 0, &cached_state, GFP_NOFS); | 3274 | lock_extent_bits(tree, start, end, 0, &cached_state); |
3278 | wait_on_page_writeback(page); | 3275 | wait_on_page_writeback(page); |
3279 | clear_extent_bit(tree, start, end, | 3276 | clear_extent_bit(tree, start, end, |
3280 | EXTENT_LOCKED | EXTENT_DIRTY | EXTENT_DELALLOC | | 3277 | EXTENT_LOCKED | EXTENT_DIRTY | EXTENT_DELALLOC | |
@@ -3488,7 +3485,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
3488 | } | 3485 | } |
3489 | 3486 | ||
3490 | lock_extent_bits(&BTRFS_I(inode)->io_tree, start, start + len, 0, | 3487 | lock_extent_bits(&BTRFS_I(inode)->io_tree, start, start + len, 0, |
3491 | &cached_state, GFP_NOFS); | 3488 | &cached_state); |
3492 | 3489 | ||
3493 | em = get_extent_skip_holes(inode, start, last_for_get_extent, | 3490 | em = get_extent_skip_holes(inode, start, last_for_get_extent, |
3494 | get_extent); | 3491 | get_extent); |
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index f7f321ee4ba1..439e183d45bb 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h | |||
@@ -182,14 +182,13 @@ int try_release_extent_buffer(struct extent_io_tree *tree, struct page *page); | |||
182 | int try_release_extent_state(struct extent_map_tree *map, | 182 | int try_release_extent_state(struct extent_map_tree *map, |
183 | struct extent_io_tree *tree, struct page *page, | 183 | struct extent_io_tree *tree, struct page *page, |
184 | gfp_t mask); | 184 | gfp_t mask); |
185 | int lock_extent(struct extent_io_tree *tree, u64 start, u64 end, gfp_t mask); | 185 | int lock_extent(struct extent_io_tree *tree, u64 start, u64 end); |
186 | int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, | 186 | int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, |
187 | int bits, struct extent_state **cached, gfp_t mask); | 187 | int bits, struct extent_state **cached); |
188 | int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end, gfp_t mask); | 188 | int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end); |
189 | int unlock_extent_cached(struct extent_io_tree *tree, u64 start, u64 end, | 189 | int unlock_extent_cached(struct extent_io_tree *tree, u64 start, u64 end, |
190 | struct extent_state **cached, gfp_t mask); | 190 | struct extent_state **cached, gfp_t mask); |
191 | int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end, | 191 | int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end); |
192 | gfp_t mask); | ||
193 | int extent_read_full_page(struct extent_io_tree *tree, struct page *page, | 192 | int extent_read_full_page(struct extent_io_tree *tree, struct page *page, |
194 | get_extent_t *get_extent, int mirror_num); | 193 | get_extent_t *get_extent, int mirror_num); |
195 | int __init extent_io_init(void); | 194 | int __init extent_io_init(void); |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index e8d06b6b9194..0eb80cc4ec81 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -1105,8 +1105,7 @@ again: | |||
1105 | if (start_pos < inode->i_size) { | 1105 | if (start_pos < inode->i_size) { |
1106 | struct btrfs_ordered_extent *ordered; | 1106 | struct btrfs_ordered_extent *ordered; |
1107 | lock_extent_bits(&BTRFS_I(inode)->io_tree, | 1107 | lock_extent_bits(&BTRFS_I(inode)->io_tree, |
1108 | start_pos, last_pos - 1, 0, &cached_state, | 1108 | start_pos, last_pos - 1, 0, &cached_state); |
1109 | GFP_NOFS); | ||
1110 | ordered = btrfs_lookup_first_ordered_extent(inode, | 1109 | ordered = btrfs_lookup_first_ordered_extent(inode, |
1111 | last_pos - 1); | 1110 | last_pos - 1); |
1112 | if (ordered && | 1111 | if (ordered && |
@@ -1638,7 +1637,7 @@ static long btrfs_fallocate(struct file *file, int mode, | |||
1638 | * transaction | 1637 | * transaction |
1639 | */ | 1638 | */ |
1640 | lock_extent_bits(&BTRFS_I(inode)->io_tree, alloc_start, | 1639 | lock_extent_bits(&BTRFS_I(inode)->io_tree, alloc_start, |
1641 | locked_end, 0, &cached_state, GFP_NOFS); | 1640 | locked_end, 0, &cached_state); |
1642 | ordered = btrfs_lookup_first_ordered_extent(inode, | 1641 | ordered = btrfs_lookup_first_ordered_extent(inode, |
1643 | alloc_end - 1); | 1642 | alloc_end - 1); |
1644 | if (ordered && | 1643 | if (ordered && |
@@ -1737,7 +1736,7 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int origin) | |||
1737 | return -ENXIO; | 1736 | return -ENXIO; |
1738 | 1737 | ||
1739 | lock_extent_bits(&BTRFS_I(inode)->io_tree, lockstart, lockend, 0, | 1738 | lock_extent_bits(&BTRFS_I(inode)->io_tree, lockstart, lockend, 0, |
1740 | &cached_state, GFP_NOFS); | 1739 | &cached_state); |
1741 | 1740 | ||
1742 | /* | 1741 | /* |
1743 | * Delalloc is such a pain. If we have a hole and we have pending | 1742 | * Delalloc is such a pain. If we have a hole and we have pending |
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 710ea380c7ed..ecbcc8711a03 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -869,7 +869,7 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode, | |||
869 | io_ctl_prepare_pages(&io_ctl, inode, 0); | 869 | io_ctl_prepare_pages(&io_ctl, inode, 0); |
870 | 870 | ||
871 | lock_extent_bits(&BTRFS_I(inode)->io_tree, 0, i_size_read(inode) - 1, | 871 | lock_extent_bits(&BTRFS_I(inode)->io_tree, 0, i_size_read(inode) - 1, |
872 | 0, &cached_state, GFP_NOFS); | 872 | 0, &cached_state); |
873 | 873 | ||
874 | node = rb_first(&ctl->free_space_offset); | 874 | node = rb_first(&ctl->free_space_offset); |
875 | if (!node && cluster) { | 875 | if (!node && cluster) { |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index dc800eefdbc7..d16bf3f5da0e 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -597,7 +597,7 @@ retry: | |||
597 | 597 | ||
598 | lock_extent(io_tree, async_extent->start, | 598 | lock_extent(io_tree, async_extent->start, |
599 | async_extent->start + | 599 | async_extent->start + |
600 | async_extent->ram_size - 1, GFP_NOFS); | 600 | async_extent->ram_size - 1); |
601 | 601 | ||
602 | /* allocate blocks */ | 602 | /* allocate blocks */ |
603 | ret = cow_file_range(inode, async_cow->locked_page, | 603 | ret = cow_file_range(inode, async_cow->locked_page, |
@@ -625,8 +625,7 @@ retry: | |||
625 | } | 625 | } |
626 | 626 | ||
627 | lock_extent(io_tree, async_extent->start, | 627 | lock_extent(io_tree, async_extent->start, |
628 | async_extent->start + async_extent->ram_size - 1, | 628 | async_extent->start + async_extent->ram_size - 1); |
629 | GFP_NOFS); | ||
630 | 629 | ||
631 | trans = btrfs_join_transaction(root); | 630 | trans = btrfs_join_transaction(root); |
632 | BUG_ON(IS_ERR(trans)); | 631 | BUG_ON(IS_ERR(trans)); |
@@ -649,7 +648,7 @@ retry: | |||
649 | async_extent->pages = NULL; | 648 | async_extent->pages = NULL; |
650 | unlock_extent(io_tree, async_extent->start, | 649 | unlock_extent(io_tree, async_extent->start, |
651 | async_extent->start + | 650 | async_extent->start + |
652 | async_extent->ram_size - 1, GFP_NOFS); | 651 | async_extent->ram_size - 1); |
653 | goto retry; | 652 | goto retry; |
654 | } | 653 | } |
655 | 654 | ||
@@ -1574,7 +1573,7 @@ again: | |||
1574 | page_end = page_offset(page) + PAGE_CACHE_SIZE - 1; | 1573 | page_end = page_offset(page) + PAGE_CACHE_SIZE - 1; |
1575 | 1574 | ||
1576 | lock_extent_bits(&BTRFS_I(inode)->io_tree, page_start, page_end, 0, | 1575 | lock_extent_bits(&BTRFS_I(inode)->io_tree, page_start, page_end, 0, |
1577 | &cached_state, GFP_NOFS); | 1576 | &cached_state); |
1578 | 1577 | ||
1579 | /* already ordered? We're done */ | 1578 | /* already ordered? We're done */ |
1580 | if (PagePrivate2(page)) | 1579 | if (PagePrivate2(page)) |
@@ -1765,7 +1764,7 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end) | |||
1765 | 1764 | ||
1766 | lock_extent_bits(io_tree, ordered_extent->file_offset, | 1765 | lock_extent_bits(io_tree, ordered_extent->file_offset, |
1767 | ordered_extent->file_offset + ordered_extent->len - 1, | 1766 | ordered_extent->file_offset + ordered_extent->len - 1, |
1768 | 0, &cached_state, GFP_NOFS); | 1767 | 0, &cached_state); |
1769 | 1768 | ||
1770 | if (nolock) | 1769 | if (nolock) |
1771 | trans = btrfs_join_transaction_nolock(root); | 1770 | trans = btrfs_join_transaction_nolock(root); |
@@ -3285,8 +3284,7 @@ again: | |||
3285 | } | 3284 | } |
3286 | wait_on_page_writeback(page); | 3285 | wait_on_page_writeback(page); |
3287 | 3286 | ||
3288 | lock_extent_bits(io_tree, page_start, page_end, 0, &cached_state, | 3287 | lock_extent_bits(io_tree, page_start, page_end, 0, &cached_state); |
3289 | GFP_NOFS); | ||
3290 | set_page_extent_mapped(page); | 3288 | set_page_extent_mapped(page); |
3291 | 3289 | ||
3292 | ordered = btrfs_lookup_ordered_extent(inode, page_start); | 3290 | ordered = btrfs_lookup_ordered_extent(inode, page_start); |
@@ -3362,7 +3360,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size) | |||
3362 | btrfs_wait_ordered_range(inode, hole_start, | 3360 | btrfs_wait_ordered_range(inode, hole_start, |
3363 | block_end - hole_start); | 3361 | block_end - hole_start); |
3364 | lock_extent_bits(io_tree, hole_start, block_end - 1, 0, | 3362 | lock_extent_bits(io_tree, hole_start, block_end - 1, 0, |
3365 | &cached_state, GFP_NOFS); | 3363 | &cached_state); |
3366 | ordered = btrfs_lookup_ordered_extent(inode, hole_start); | 3364 | ordered = btrfs_lookup_ordered_extent(inode, hole_start); |
3367 | if (!ordered) | 3365 | if (!ordered) |
3368 | break; | 3366 | break; |
@@ -5604,7 +5602,7 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock, | |||
5604 | free_extent_map(em); | 5602 | free_extent_map(em); |
5605 | /* DIO will do one hole at a time, so just unlock a sector */ | 5603 | /* DIO will do one hole at a time, so just unlock a sector */ |
5606 | unlock_extent(&BTRFS_I(inode)->io_tree, start, | 5604 | unlock_extent(&BTRFS_I(inode)->io_tree, start, |
5607 | start + root->sectorsize - 1, GFP_NOFS); | 5605 | start + root->sectorsize - 1); |
5608 | return 0; | 5606 | return 0; |
5609 | } | 5607 | } |
5610 | 5608 | ||
@@ -5745,7 +5743,7 @@ static void btrfs_endio_direct_read(struct bio *bio, int err) | |||
5745 | } while (bvec <= bvec_end); | 5743 | } while (bvec <= bvec_end); |
5746 | 5744 | ||
5747 | unlock_extent(&BTRFS_I(inode)->io_tree, dip->logical_offset, | 5745 | unlock_extent(&BTRFS_I(inode)->io_tree, dip->logical_offset, |
5748 | dip->logical_offset + dip->bytes - 1, GFP_NOFS); | 5746 | dip->logical_offset + dip->bytes - 1); |
5749 | bio->bi_private = dip->private; | 5747 | bio->bi_private = dip->private; |
5750 | 5748 | ||
5751 | kfree(dip->csums); | 5749 | kfree(dip->csums); |
@@ -5796,7 +5794,7 @@ again: | |||
5796 | 5794 | ||
5797 | lock_extent_bits(&BTRFS_I(inode)->io_tree, ordered->file_offset, | 5795 | lock_extent_bits(&BTRFS_I(inode)->io_tree, ordered->file_offset, |
5798 | ordered->file_offset + ordered->len - 1, 0, | 5796 | ordered->file_offset + ordered->len - 1, 0, |
5799 | &cached_state, GFP_NOFS); | 5797 | &cached_state); |
5800 | 5798 | ||
5801 | if (test_bit(BTRFS_ORDERED_PREALLOC, &ordered->flags)) { | 5799 | if (test_bit(BTRFS_ORDERED_PREALLOC, &ordered->flags)) { |
5802 | ret = btrfs_mark_extent_written(trans, inode, | 5800 | ret = btrfs_mark_extent_written(trans, inode, |
@@ -6211,7 +6209,7 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb, | |||
6211 | 6209 | ||
6212 | while (1) { | 6210 | while (1) { |
6213 | lock_extent_bits(&BTRFS_I(inode)->io_tree, lockstart, lockend, | 6211 | lock_extent_bits(&BTRFS_I(inode)->io_tree, lockstart, lockend, |
6214 | 0, &cached_state, GFP_NOFS); | 6212 | 0, &cached_state); |
6215 | /* | 6213 | /* |
6216 | * We're concerned with the entire range that we're going to be | 6214 | * We're concerned with the entire range that we're going to be |
6217 | * doing DIO to, so we need to make sure theres no ordered | 6215 | * doing DIO to, so we need to make sure theres no ordered |
@@ -6365,8 +6363,7 @@ static void btrfs_invalidatepage(struct page *page, unsigned long offset) | |||
6365 | btrfs_releasepage(page, GFP_NOFS); | 6363 | btrfs_releasepage(page, GFP_NOFS); |
6366 | return; | 6364 | return; |
6367 | } | 6365 | } |
6368 | lock_extent_bits(tree, page_start, page_end, 0, &cached_state, | 6366 | lock_extent_bits(tree, page_start, page_end, 0, &cached_state); |
6369 | GFP_NOFS); | ||
6370 | ordered = btrfs_lookup_ordered_extent(page->mapping->host, | 6367 | ordered = btrfs_lookup_ordered_extent(page->mapping->host, |
6371 | page_offset(page)); | 6368 | page_offset(page)); |
6372 | if (ordered) { | 6369 | if (ordered) { |
@@ -6388,8 +6385,7 @@ static void btrfs_invalidatepage(struct page *page, unsigned long offset) | |||
6388 | } | 6385 | } |
6389 | btrfs_put_ordered_extent(ordered); | 6386 | btrfs_put_ordered_extent(ordered); |
6390 | cached_state = NULL; | 6387 | cached_state = NULL; |
6391 | lock_extent_bits(tree, page_start, page_end, 0, &cached_state, | 6388 | lock_extent_bits(tree, page_start, page_end, 0, &cached_state); |
6392 | GFP_NOFS); | ||
6393 | } | 6389 | } |
6394 | clear_extent_bit(tree, page_start, page_end, | 6390 | clear_extent_bit(tree, page_start, page_end, |
6395 | EXTENT_LOCKED | EXTENT_DIRTY | EXTENT_DELALLOC | | 6391 | EXTENT_LOCKED | EXTENT_DIRTY | EXTENT_DELALLOC | |
@@ -6464,8 +6460,7 @@ again: | |||
6464 | } | 6460 | } |
6465 | wait_on_page_writeback(page); | 6461 | wait_on_page_writeback(page); |
6466 | 6462 | ||
6467 | lock_extent_bits(io_tree, page_start, page_end, 0, &cached_state, | 6463 | lock_extent_bits(io_tree, page_start, page_end, 0, &cached_state); |
6468 | GFP_NOFS); | ||
6469 | set_page_extent_mapped(page); | 6464 | set_page_extent_mapped(page); |
6470 | 6465 | ||
6471 | /* | 6466 | /* |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index d8b54715c2de..4e5149461435 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -797,9 +797,9 @@ static int should_defrag_range(struct inode *inode, u64 start, u64 len, | |||
797 | 797 | ||
798 | if (!em) { | 798 | if (!em) { |
799 | /* get the big lock and read metadata off disk */ | 799 | /* get the big lock and read metadata off disk */ |
800 | lock_extent(io_tree, start, start + len - 1, GFP_NOFS); | 800 | lock_extent(io_tree, start, start + len - 1); |
801 | em = btrfs_get_extent(inode, NULL, 0, start, len, 0); | 801 | em = btrfs_get_extent(inode, NULL, 0, start, len, 0); |
802 | unlock_extent(io_tree, start, start + len - 1, GFP_NOFS); | 802 | unlock_extent(io_tree, start, start + len - 1); |
803 | 803 | ||
804 | if (IS_ERR(em)) | 804 | if (IS_ERR(em)) |
805 | return 0; | 805 | return 0; |
@@ -887,10 +887,10 @@ again: | |||
887 | page_start = page_offset(page); | 887 | page_start = page_offset(page); |
888 | page_end = page_start + PAGE_CACHE_SIZE - 1; | 888 | page_end = page_start + PAGE_CACHE_SIZE - 1; |
889 | while (1) { | 889 | while (1) { |
890 | lock_extent(tree, page_start, page_end, GFP_NOFS); | 890 | lock_extent(tree, page_start, page_end); |
891 | ordered = btrfs_lookup_ordered_extent(inode, | 891 | ordered = btrfs_lookup_ordered_extent(inode, |
892 | page_start); | 892 | page_start); |
893 | unlock_extent(tree, page_start, page_end, GFP_NOFS); | 893 | unlock_extent(tree, page_start, page_end); |
894 | if (!ordered) | 894 | if (!ordered) |
895 | break; | 895 | break; |
896 | 896 | ||
@@ -946,8 +946,7 @@ again: | |||
946 | page_end = page_offset(pages[i_done - 1]) + PAGE_CACHE_SIZE; | 946 | page_end = page_offset(pages[i_done - 1]) + PAGE_CACHE_SIZE; |
947 | 947 | ||
948 | lock_extent_bits(&BTRFS_I(inode)->io_tree, | 948 | lock_extent_bits(&BTRFS_I(inode)->io_tree, |
949 | page_start, page_end - 1, 0, &cached_state, | 949 | page_start, page_end - 1, 0, &cached_state); |
950 | GFP_NOFS); | ||
951 | clear_extent_bit(&BTRFS_I(inode)->io_tree, page_start, | 950 | clear_extent_bit(&BTRFS_I(inode)->io_tree, page_start, |
952 | page_end - 1, EXTENT_DIRTY | EXTENT_DELALLOC | | 951 | page_end - 1, EXTENT_DIRTY | EXTENT_DELALLOC | |
953 | EXTENT_DO_ACCOUNTING, 0, 0, &cached_state, | 952 | EXTENT_DO_ACCOUNTING, 0, 0, &cached_state, |
@@ -2326,13 +2325,13 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, | |||
2326 | another, and lock file content */ | 2325 | another, and lock file content */ |
2327 | while (1) { | 2326 | while (1) { |
2328 | struct btrfs_ordered_extent *ordered; | 2327 | struct btrfs_ordered_extent *ordered; |
2329 | lock_extent(&BTRFS_I(src)->io_tree, off, off+len, GFP_NOFS); | 2328 | lock_extent(&BTRFS_I(src)->io_tree, off, off+len); |
2330 | ordered = btrfs_lookup_first_ordered_extent(src, off+len); | 2329 | ordered = btrfs_lookup_first_ordered_extent(src, off+len); |
2331 | if (!ordered && | 2330 | if (!ordered && |
2332 | !test_range_bit(&BTRFS_I(src)->io_tree, off, off+len, | 2331 | !test_range_bit(&BTRFS_I(src)->io_tree, off, off+len, |
2333 | EXTENT_DELALLOC, 0, NULL)) | 2332 | EXTENT_DELALLOC, 0, NULL)) |
2334 | break; | 2333 | break; |
2335 | unlock_extent(&BTRFS_I(src)->io_tree, off, off+len, GFP_NOFS); | 2334 | unlock_extent(&BTRFS_I(src)->io_tree, off, off+len); |
2336 | if (ordered) | 2335 | if (ordered) |
2337 | btrfs_put_ordered_extent(ordered); | 2336 | btrfs_put_ordered_extent(ordered); |
2338 | btrfs_wait_ordered_range(src, off, len); | 2337 | btrfs_wait_ordered_range(src, off, len); |
@@ -2551,7 +2550,7 @@ next: | |||
2551 | ret = 0; | 2550 | ret = 0; |
2552 | out: | 2551 | out: |
2553 | btrfs_release_path(path); | 2552 | btrfs_release_path(path); |
2554 | unlock_extent(&BTRFS_I(src)->io_tree, off, off+len, GFP_NOFS); | 2553 | unlock_extent(&BTRFS_I(src)->io_tree, off, off+len); |
2555 | out_unlock: | 2554 | out_unlock: |
2556 | mutex_unlock(&src->i_mutex); | 2555 | mutex_unlock(&src->i_mutex); |
2557 | mutex_unlock(&inode->i_mutex); | 2556 | mutex_unlock(&inode->i_mutex); |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 974b0dfeffa3..5e89a5ea692f 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -1604,15 +1604,14 @@ int replace_file_extents(struct btrfs_trans_handle *trans, | |||
1604 | WARN_ON(!IS_ALIGNED(end, root->sectorsize)); | 1604 | WARN_ON(!IS_ALIGNED(end, root->sectorsize)); |
1605 | end--; | 1605 | end--; |
1606 | ret = try_lock_extent(&BTRFS_I(inode)->io_tree, | 1606 | ret = try_lock_extent(&BTRFS_I(inode)->io_tree, |
1607 | key.offset, end, | 1607 | key.offset, end); |
1608 | GFP_NOFS); | ||
1609 | if (!ret) | 1608 | if (!ret) |
1610 | continue; | 1609 | continue; |
1611 | 1610 | ||
1612 | btrfs_drop_extent_cache(inode, key.offset, end, | 1611 | btrfs_drop_extent_cache(inode, key.offset, end, |
1613 | 1); | 1612 | 1); |
1614 | unlock_extent(&BTRFS_I(inode)->io_tree, | 1613 | unlock_extent(&BTRFS_I(inode)->io_tree, |
1615 | key.offset, end, GFP_NOFS); | 1614 | key.offset, end); |
1616 | } | 1615 | } |
1617 | } | 1616 | } |
1618 | 1617 | ||
@@ -1983,9 +1982,9 @@ static int invalidate_extent_cache(struct btrfs_root *root, | |||
1983 | } | 1982 | } |
1984 | 1983 | ||
1985 | /* the lock_extent waits for readpage to complete */ | 1984 | /* the lock_extent waits for readpage to complete */ |
1986 | lock_extent(&BTRFS_I(inode)->io_tree, start, end, GFP_NOFS); | 1985 | lock_extent(&BTRFS_I(inode)->io_tree, start, end); |
1987 | btrfs_drop_extent_cache(inode, start, end, 1); | 1986 | btrfs_drop_extent_cache(inode, start, end, 1); |
1988 | unlock_extent(&BTRFS_I(inode)->io_tree, start, end, GFP_NOFS); | 1987 | unlock_extent(&BTRFS_I(inode)->io_tree, start, end); |
1989 | } | 1988 | } |
1990 | return 0; | 1989 | return 0; |
1991 | } | 1990 | } |
@@ -2889,12 +2888,12 @@ int prealloc_file_extent_cluster(struct inode *inode, | |||
2889 | else | 2888 | else |
2890 | end = cluster->end - offset; | 2889 | end = cluster->end - offset; |
2891 | 2890 | ||
2892 | lock_extent(&BTRFS_I(inode)->io_tree, start, end, GFP_NOFS); | 2891 | lock_extent(&BTRFS_I(inode)->io_tree, start, end); |
2893 | num_bytes = end + 1 - start; | 2892 | num_bytes = end + 1 - start; |
2894 | ret = btrfs_prealloc_file_range(inode, 0, start, | 2893 | ret = btrfs_prealloc_file_range(inode, 0, start, |
2895 | num_bytes, num_bytes, | 2894 | num_bytes, num_bytes, |
2896 | end + 1, &alloc_hint); | 2895 | end + 1, &alloc_hint); |
2897 | unlock_extent(&BTRFS_I(inode)->io_tree, start, end, GFP_NOFS); | 2896 | unlock_extent(&BTRFS_I(inode)->io_tree, start, end); |
2898 | if (ret) | 2897 | if (ret) |
2899 | break; | 2898 | break; |
2900 | nr++; | 2899 | nr++; |
@@ -2926,7 +2925,7 @@ int setup_extent_mapping(struct inode *inode, u64 start, u64 end, | |||
2926 | em->bdev = root->fs_info->fs_devices->latest_bdev; | 2925 | em->bdev = root->fs_info->fs_devices->latest_bdev; |
2927 | set_bit(EXTENT_FLAG_PINNED, &em->flags); | 2926 | set_bit(EXTENT_FLAG_PINNED, &em->flags); |
2928 | 2927 | ||
2929 | lock_extent(&BTRFS_I(inode)->io_tree, start, end, GFP_NOFS); | 2928 | lock_extent(&BTRFS_I(inode)->io_tree, start, end); |
2930 | while (1) { | 2929 | while (1) { |
2931 | write_lock(&em_tree->lock); | 2930 | write_lock(&em_tree->lock); |
2932 | ret = add_extent_mapping(em_tree, em); | 2931 | ret = add_extent_mapping(em_tree, em); |
@@ -2937,7 +2936,7 @@ int setup_extent_mapping(struct inode *inode, u64 start, u64 end, | |||
2937 | } | 2936 | } |
2938 | btrfs_drop_extent_cache(inode, start, end, 0); | 2937 | btrfs_drop_extent_cache(inode, start, end, 0); |
2939 | } | 2938 | } |
2940 | unlock_extent(&BTRFS_I(inode)->io_tree, start, end, GFP_NOFS); | 2939 | unlock_extent(&BTRFS_I(inode)->io_tree, start, end); |
2941 | return ret; | 2940 | return ret; |
2942 | } | 2941 | } |
2943 | 2942 | ||
@@ -3017,8 +3016,7 @@ static int relocate_file_extent_cluster(struct inode *inode, | |||
3017 | page_start = (u64)page->index << PAGE_CACHE_SHIFT; | 3016 | page_start = (u64)page->index << PAGE_CACHE_SHIFT; |
3018 | page_end = page_start + PAGE_CACHE_SIZE - 1; | 3017 | page_end = page_start + PAGE_CACHE_SIZE - 1; |
3019 | 3018 | ||
3020 | lock_extent(&BTRFS_I(inode)->io_tree, | 3019 | lock_extent(&BTRFS_I(inode)->io_tree, page_start, page_end); |
3021 | page_start, page_end, GFP_NOFS); | ||
3022 | 3020 | ||
3023 | set_page_extent_mapped(page); | 3021 | set_page_extent_mapped(page); |
3024 | 3022 | ||
@@ -3034,7 +3032,7 @@ static int relocate_file_extent_cluster(struct inode *inode, | |||
3034 | set_page_dirty(page); | 3032 | set_page_dirty(page); |
3035 | 3033 | ||
3036 | unlock_extent(&BTRFS_I(inode)->io_tree, | 3034 | unlock_extent(&BTRFS_I(inode)->io_tree, |
3037 | page_start, page_end, GFP_NOFS); | 3035 | page_start, page_end); |
3038 | unlock_page(page); | 3036 | unlock_page(page); |
3039 | page_cache_release(page); | 3037 | page_cache_release(page); |
3040 | 3038 | ||