diff options
author | David Sterba <dsterba@suse.cz> | 2011-05-05 06:44:41 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2011-05-06 06:34:03 -0400 |
commit | f2a97a9dbd86eb1ef956bdf20e05c507b32beb96 (patch) | |
tree | 756c2db8fee9c02df0e3217ea208a82b5f1d5e78 /fs/btrfs/extent_io.c | |
parent | 621496f4fd56195b7b273521f467c2945165481f (diff) |
btrfs: remove all unused functions
Remove static and global declarations and/or definitions. Reduces size
of btrfs.ko by ~3.4kB.
text data bss dec hex filename
402081 7464 200 409745 64091 btrfs.ko.base
398620 7144 200 405964 631cc btrfs.ko.remove-all
Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r-- | fs/btrfs/extent_io.c | 227 |
1 files changed, 0 insertions, 227 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 9369289ce771..91208296ff2b 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -941,13 +941,6 @@ int set_extent_new(struct extent_io_tree *tree, u64 start, u64 end, | |||
941 | NULL, mask); | 941 | NULL, mask); |
942 | } | 942 | } |
943 | 943 | ||
944 | static int clear_extent_new(struct extent_io_tree *tree, u64 start, u64 end, | ||
945 | gfp_t mask) | ||
946 | { | ||
947 | return clear_extent_bit(tree, start, end, EXTENT_NEW, 0, 0, | ||
948 | NULL, mask); | ||
949 | } | ||
950 | |||
951 | int set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end, | 944 | int set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end, |
952 | struct extent_state **cached_state, gfp_t mask) | 945 | struct extent_state **cached_state, gfp_t mask) |
953 | { | 946 | { |
@@ -963,11 +956,6 @@ static int clear_extent_uptodate(struct extent_io_tree *tree, u64 start, | |||
963 | cached_state, mask); | 956 | cached_state, mask); |
964 | } | 957 | } |
965 | 958 | ||
966 | int wait_on_extent_writeback(struct extent_io_tree *tree, u64 start, u64 end) | ||
967 | { | ||
968 | return wait_extent_bit(tree, start, end, EXTENT_WRITEBACK); | ||
969 | } | ||
970 | |||
971 | /* | 959 | /* |
972 | * either insert or lock state struct between start and end use mask to tell | 960 | * either insert or lock state struct between start and end use mask to tell |
973 | * us if waiting is desired. | 961 | * us if waiting is desired. |
@@ -1028,25 +1016,6 @@ int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end, gfp_t mask) | |||
1028 | } | 1016 | } |
1029 | 1017 | ||
1030 | /* | 1018 | /* |
1031 | * helper function to set pages and extents in the tree dirty | ||
1032 | */ | ||
1033 | int set_range_dirty(struct extent_io_tree *tree, u64 start, u64 end) | ||
1034 | { | ||
1035 | unsigned long index = start >> PAGE_CACHE_SHIFT; | ||
1036 | unsigned long end_index = end >> PAGE_CACHE_SHIFT; | ||
1037 | struct page *page; | ||
1038 | |||
1039 | while (index <= end_index) { | ||
1040 | page = find_get_page(tree->mapping, index); | ||
1041 | BUG_ON(!page); | ||
1042 | __set_page_dirty_nobuffers(page); | ||
1043 | page_cache_release(page); | ||
1044 | index++; | ||
1045 | } | ||
1046 | return 0; | ||
1047 | } | ||
1048 | |||
1049 | /* | ||
1050 | * helper function to set both pages and extents in the tree writeback | 1019 | * helper function to set both pages and extents in the tree writeback |
1051 | */ | 1020 | */ |
1052 | static int set_range_writeback(struct extent_io_tree *tree, u64 start, u64 end) | 1021 | static int set_range_writeback(struct extent_io_tree *tree, u64 start, u64 end) |
@@ -1819,46 +1788,6 @@ static void end_bio_extent_readpage(struct bio *bio, int err) | |||
1819 | bio_put(bio); | 1788 | bio_put(bio); |
1820 | } | 1789 | } |
1821 | 1790 | ||
1822 | /* | ||
1823 | * IO done from prepare_write is pretty simple, we just unlock | ||
1824 | * the structs in the extent tree when done, and set the uptodate bits | ||
1825 | * as appropriate. | ||
1826 | */ | ||
1827 | static void end_bio_extent_preparewrite(struct bio *bio, int err) | ||
1828 | { | ||
1829 | const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); | ||
1830 | struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; | ||
1831 | struct extent_io_tree *tree; | ||
1832 | u64 start; | ||
1833 | u64 end; | ||
1834 | |||
1835 | do { | ||
1836 | struct page *page = bvec->bv_page; | ||
1837 | struct extent_state *cached = NULL; | ||
1838 | tree = &BTRFS_I(page->mapping->host)->io_tree; | ||
1839 | |||
1840 | start = ((u64)page->index << PAGE_CACHE_SHIFT) + | ||
1841 | bvec->bv_offset; | ||
1842 | end = start + bvec->bv_len - 1; | ||
1843 | |||
1844 | if (--bvec >= bio->bi_io_vec) | ||
1845 | prefetchw(&bvec->bv_page->flags); | ||
1846 | |||
1847 | if (uptodate) { | ||
1848 | set_extent_uptodate(tree, start, end, &cached, | ||
1849 | GFP_ATOMIC); | ||
1850 | } else { | ||
1851 | ClearPageUptodate(page); | ||
1852 | SetPageError(page); | ||
1853 | } | ||
1854 | |||
1855 | unlock_extent_cached(tree, start, end, &cached, GFP_ATOMIC); | ||
1856 | |||
1857 | } while (bvec >= bio->bi_io_vec); | ||
1858 | |||
1859 | bio_put(bio); | ||
1860 | } | ||
1861 | |||
1862 | struct bio * | 1791 | struct bio * |
1863 | btrfs_bio_alloc(struct block_device *bdev, u64 first_sector, int nr_vecs, | 1792 | btrfs_bio_alloc(struct block_device *bdev, u64 first_sector, int nr_vecs, |
1864 | gfp_t gfp_flags) | 1793 | gfp_t gfp_flags) |
@@ -2720,128 +2649,6 @@ int extent_invalidatepage(struct extent_io_tree *tree, | |||
2720 | } | 2649 | } |
2721 | 2650 | ||
2722 | /* | 2651 | /* |
2723 | * simple commit_write call, set_range_dirty is used to mark both | ||
2724 | * the pages and the extent records as dirty | ||
2725 | */ | ||
2726 | int extent_commit_write(struct extent_io_tree *tree, | ||
2727 | struct inode *inode, struct page *page, | ||
2728 | unsigned from, unsigned to) | ||
2729 | { | ||
2730 | loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to; | ||
2731 | |||
2732 | set_page_extent_mapped(page); | ||
2733 | set_page_dirty(page); | ||
2734 | |||
2735 | if (pos > inode->i_size) { | ||
2736 | i_size_write(inode, pos); | ||
2737 | mark_inode_dirty(inode); | ||
2738 | } | ||
2739 | return 0; | ||
2740 | } | ||
2741 | |||
2742 | int extent_prepare_write(struct extent_io_tree *tree, | ||
2743 | struct inode *inode, struct page *page, | ||
2744 | unsigned from, unsigned to, get_extent_t *get_extent) | ||
2745 | { | ||
2746 | u64 page_start = (u64)page->index << PAGE_CACHE_SHIFT; | ||
2747 | u64 page_end = page_start + PAGE_CACHE_SIZE - 1; | ||
2748 | u64 block_start; | ||
2749 | u64 orig_block_start; | ||
2750 | u64 block_end; | ||
2751 | u64 cur_end; | ||
2752 | struct extent_map *em; | ||
2753 | unsigned blocksize = 1 << inode->i_blkbits; | ||
2754 | size_t pg_offset = 0; | ||
2755 | size_t block_off_start; | ||
2756 | size_t block_off_end; | ||
2757 | int err = 0; | ||
2758 | int iocount = 0; | ||
2759 | int ret = 0; | ||
2760 | int isnew; | ||
2761 | |||
2762 | set_page_extent_mapped(page); | ||
2763 | |||
2764 | block_start = (page_start + from) & ~((u64)blocksize - 1); | ||
2765 | block_end = (page_start + to - 1) | (blocksize - 1); | ||
2766 | orig_block_start = block_start; | ||
2767 | |||
2768 | lock_extent(tree, page_start, page_end, GFP_NOFS); | ||
2769 | while (block_start <= block_end) { | ||
2770 | em = get_extent(inode, page, pg_offset, block_start, | ||
2771 | block_end - block_start + 1, 1); | ||
2772 | if (IS_ERR_OR_NULL(em)) | ||
2773 | goto err; | ||
2774 | |||
2775 | cur_end = min(block_end, extent_map_end(em) - 1); | ||
2776 | block_off_start = block_start & (PAGE_CACHE_SIZE - 1); | ||
2777 | block_off_end = block_off_start + blocksize; | ||
2778 | isnew = clear_extent_new(tree, block_start, cur_end, GFP_NOFS); | ||
2779 | |||
2780 | if (!PageUptodate(page) && isnew && | ||
2781 | (block_off_end > to || block_off_start < from)) { | ||
2782 | void *kaddr; | ||
2783 | |||
2784 | kaddr = kmap_atomic(page, KM_USER0); | ||
2785 | if (block_off_end > to) | ||
2786 | memset(kaddr + to, 0, block_off_end - to); | ||
2787 | if (block_off_start < from) | ||
2788 | memset(kaddr + block_off_start, 0, | ||
2789 | from - block_off_start); | ||
2790 | flush_dcache_page(page); | ||
2791 | kunmap_atomic(kaddr, KM_USER0); | ||
2792 | } | ||
2793 | if ((em->block_start != EXTENT_MAP_HOLE && | ||
2794 | em->block_start != EXTENT_MAP_INLINE) && | ||
2795 | !isnew && !PageUptodate(page) && | ||
2796 | (block_off_end > to || block_off_start < from) && | ||
2797 | !test_range_bit(tree, block_start, cur_end, | ||
2798 | EXTENT_UPTODATE, 1, NULL)) { | ||
2799 | u64 sector; | ||
2800 | u64 extent_offset = block_start - em->start; | ||
2801 | size_t iosize; | ||
2802 | sector = (em->block_start + extent_offset) >> 9; | ||
2803 | iosize = (cur_end - block_start + blocksize) & | ||
2804 | ~((u64)blocksize - 1); | ||
2805 | /* | ||
2806 | * we've already got the extent locked, but we | ||
2807 | * need to split the state such that our end_bio | ||
2808 | * handler can clear the lock. | ||
2809 | */ | ||
2810 | set_extent_bit(tree, block_start, | ||
2811 | block_start + iosize - 1, | ||
2812 | EXTENT_LOCKED, 0, NULL, NULL, GFP_NOFS); | ||
2813 | ret = submit_extent_page(READ, tree, page, | ||
2814 | sector, iosize, pg_offset, em->bdev, | ||
2815 | NULL, 1, | ||
2816 | end_bio_extent_preparewrite, 0, | ||
2817 | 0, 0); | ||
2818 | if (ret && !err) | ||
2819 | err = ret; | ||
2820 | iocount++; | ||
2821 | block_start = block_start + iosize; | ||
2822 | } else { | ||
2823 | struct extent_state *cached = NULL; | ||
2824 | |||
2825 | set_extent_uptodate(tree, block_start, cur_end, &cached, | ||
2826 | GFP_NOFS); | ||
2827 | unlock_extent_cached(tree, block_start, cur_end, | ||
2828 | &cached, GFP_NOFS); | ||
2829 | block_start = cur_end + 1; | ||
2830 | } | ||
2831 | pg_offset = block_start & (PAGE_CACHE_SIZE - 1); | ||
2832 | free_extent_map(em); | ||
2833 | } | ||
2834 | if (iocount) { | ||
2835 | wait_extent_bit(tree, orig_block_start, | ||
2836 | block_end, EXTENT_LOCKED); | ||
2837 | } | ||
2838 | check_page_uptodate(tree, page); | ||
2839 | err: | ||
2840 | /* FIXME, zero out newly allocated blocks on error */ | ||
2841 | return err; | ||
2842 | } | ||
2843 | |||
2844 | /* | ||
2845 | * a helper for releasepage, this tests for areas of the page that | 2652 | * a helper for releasepage, this tests for areas of the page that |
2846 | * are locked or under IO and drops the related state bits if it is safe | 2653 | * are locked or under IO and drops the related state bits if it is safe |
2847 | * to drop the page. | 2654 | * to drop the page. |
@@ -2927,33 +2734,6 @@ int try_release_extent_mapping(struct extent_map_tree *map, | |||
2927 | return try_release_extent_state(map, tree, page, mask); | 2734 | return try_release_extent_state(map, tree, page, mask); |
2928 | } | 2735 | } |
2929 | 2736 | ||
2930 | sector_t extent_bmap(struct address_space *mapping, sector_t iblock, | ||
2931 | get_extent_t *get_extent) | ||
2932 | { | ||
2933 | struct inode *inode = mapping->host; | ||
2934 | struct extent_state *cached_state = NULL; | ||
2935 | u64 start = iblock << inode->i_blkbits; | ||
2936 | sector_t sector = 0; | ||
2937 | size_t blksize = (1 << inode->i_blkbits); | ||
2938 | struct extent_map *em; | ||
2939 | |||
2940 | lock_extent_bits(&BTRFS_I(inode)->io_tree, start, start + blksize - 1, | ||
2941 | 0, &cached_state, GFP_NOFS); | ||
2942 | em = get_extent(inode, NULL, 0, start, blksize, 0); | ||
2943 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, start, | ||
2944 | start + blksize - 1, &cached_state, GFP_NOFS); | ||
2945 | if (IS_ERR_OR_NULL(em)) | ||
2946 | return 0; | ||
2947 | |||
2948 | if (em->block_start > EXTENT_MAP_LAST_BYTE) | ||
2949 | goto out; | ||
2950 | |||
2951 | sector = (em->block_start + start - em->start) >> inode->i_blkbits; | ||
2952 | out: | ||
2953 | free_extent_map(em); | ||
2954 | return sector; | ||
2955 | } | ||
2956 | |||
2957 | /* | 2737 | /* |
2958 | * helper function for fiemap, which doesn't want to see any holes. | 2738 | * helper function for fiemap, which doesn't want to see any holes. |
2959 | * This maps until we find something past 'last' | 2739 | * This maps until we find something past 'last' |
@@ -3437,13 +3217,6 @@ int clear_extent_buffer_dirty(struct extent_io_tree *tree, | |||
3437 | return 0; | 3217 | return 0; |
3438 | } | 3218 | } |
3439 | 3219 | ||
3440 | int wait_on_extent_buffer_writeback(struct extent_io_tree *tree, | ||
3441 | struct extent_buffer *eb) | ||
3442 | { | ||
3443 | return wait_on_extent_writeback(tree, eb->start, | ||
3444 | eb->start + eb->len - 1); | ||
3445 | } | ||
3446 | |||
3447 | int set_extent_buffer_dirty(struct extent_io_tree *tree, | 3220 | int set_extent_buffer_dirty(struct extent_io_tree *tree, |
3448 | struct extent_buffer *eb) | 3221 | struct extent_buffer *eb) |
3449 | { | 3222 | { |