aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2013-04-25 16:41:01 -0400
committerJosef Bacik <jbacik@fusionio.com>2013-05-06 15:55:23 -0400
commit48a3b6366f6913683563d934eb16fea67dead9c1 (patch)
treeeb26170d3a5ddb6f81ae612db21fb8fba14e655d /fs
parent634554dc0acfc8753c05e432b2fdb34b0be89c78 (diff)
btrfs: make static code static & remove dead code
Big patch, but all it does is add statics to functions which are in fact static, then remove the associated dead-code fallout. removed functions: btrfs_iref_to_path() __btrfs_lookup_delayed_deletion_item() __btrfs_search_delayed_insertion_item() __btrfs_search_delayed_deletion_item() find_eb_for_page() btrfs_find_block_group() range_straddles_pages() extent_range_uptodate() btrfs_file_extent_length() btrfs_scrub_cancel_devid() btrfs_start_transaction_lflush() btrfs_print_tree() is left because it is used for debugging. btrfs_start_transaction_lflush() and btrfs_reada_detach() are left for symmetry. ulist.c functions are left, another patch will take care of those. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/backref.c40
-rw-r--r--fs/btrfs/backref.h3
-rw-r--r--fs/btrfs/compression.c11
-rw-r--r--fs/btrfs/compression.h2
-rw-r--r--fs/btrfs/ctree.c9
-rw-r--r--fs/btrfs/ctree.h22
-rw-r--r--fs/btrfs/delayed-inode.c55
-rw-r--r--fs/btrfs/dir-item.c6
-rw-r--r--fs/btrfs/disk-io.c43
-rw-r--r--fs/btrfs/disk-io.h2
-rw-r--r--fs/btrfs/extent-tree.c64
-rw-r--r--fs/btrfs/extent_io.c61
-rw-r--r--fs/btrfs/extent_io.h8
-rw-r--r--fs/btrfs/extent_map.c5
-rw-r--r--fs/btrfs/file-item.c30
-rw-r--r--fs/btrfs/file.c12
-rw-r--r--fs/btrfs/free-space-cache.c26
-rw-r--r--fs/btrfs/inode-item.c9
-rw-r--r--fs/btrfs/inode.c11
-rw-r--r--fs/btrfs/ioctl.c2
-rw-r--r--fs/btrfs/locking.c4
-rw-r--r--fs/btrfs/print-tree.h2
-rw-r--r--fs/btrfs/raid56.c14
-rw-r--r--fs/btrfs/relocation.c3
-rw-r--r--fs/btrfs/scrub.c22
-rw-r--r--fs/btrfs/send.c2
-rw-r--r--fs/btrfs/send.h1
-rw-r--r--fs/btrfs/transaction.c2
-rw-r--r--fs/btrfs/transaction.h1
-rw-r--r--fs/btrfs/tree-log.c6
-rw-r--r--fs/btrfs/tree-log.h3
-rw-r--r--fs/btrfs/volumes.c29
-rw-r--r--fs/btrfs/volumes.h13
-rw-r--r--fs/btrfs/xattr.c4
34 files changed, 135 insertions, 392 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index 04b5b3093893..b4fb41558111 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -1189,6 +1189,20 @@ int btrfs_find_one_extref(struct btrfs_root *root, u64 inode_objectid,
1189 return ret; 1189 return ret;
1190} 1190}
1191 1191
1192/*
1193 * this iterates to turn a name (from iref/extref) into a full filesystem path.
1194 * Elements of the path are separated by '/' and the path is guaranteed to be
1195 * 0-terminated. the path is only given within the current file system.
1196 * Therefore, it never starts with a '/'. the caller is responsible to provide
1197 * "size" bytes in "dest". the dest buffer will be filled backwards. finally,
1198 * the start point of the resulting string is returned. this pointer is within
1199 * dest, normally.
1200 * in case the path buffer would overflow, the pointer is decremented further
1201 * as if output was written to the buffer, though no more output is actually
1202 * generated. that way, the caller can determine how much space would be
1203 * required for the path to fit into the buffer. in that case, the returned
1204 * value will be smaller than dest. callers must check this!
1205 */
1192char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path, 1206char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path,
1193 u32 name_len, unsigned long name_off, 1207 u32 name_len, unsigned long name_off,
1194 struct extent_buffer *eb_in, u64 parent, 1208 struct extent_buffer *eb_in, u64 parent,
@@ -1258,32 +1272,6 @@ char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path,
1258} 1272}
1259 1273
1260/* 1274/*
1261 * this iterates to turn a btrfs_inode_ref into a full filesystem path. elements
1262 * of the path are separated by '/' and the path is guaranteed to be
1263 * 0-terminated. the path is only given within the current file system.
1264 * Therefore, it never starts with a '/'. the caller is responsible to provide
1265 * "size" bytes in "dest". the dest buffer will be filled backwards. finally,
1266 * the start point of the resulting string is returned. this pointer is within
1267 * dest, normally.
1268 * in case the path buffer would overflow, the pointer is decremented further
1269 * as if output was written to the buffer, though no more output is actually
1270 * generated. that way, the caller can determine how much space would be
1271 * required for the path to fit into the buffer. in that case, the returned
1272 * value will be smaller than dest. callers must check this!
1273 */
1274char *btrfs_iref_to_path(struct btrfs_root *fs_root,
1275 struct btrfs_path *path,
1276 struct btrfs_inode_ref *iref,
1277 struct extent_buffer *eb_in, u64 parent,
1278 char *dest, u32 size)
1279{
1280 return btrfs_ref_to_path(fs_root, path,
1281 btrfs_inode_ref_name_len(eb_in, iref),
1282 (unsigned long)(iref + 1),
1283 eb_in, parent, dest, size);
1284}
1285
1286/*
1287 * this makes the path point to (logical EXTENT_ITEM *) 1275 * this makes the path point to (logical EXTENT_ITEM *)
1288 * returns BTRFS_EXTENT_FLAG_DATA for data, BTRFS_EXTENT_FLAG_TREE_BLOCK for 1276 * returns BTRFS_EXTENT_FLAG_DATA for data, BTRFS_EXTENT_FLAG_TREE_BLOCK for
1289 * tree blocks and <0 on error. 1277 * tree blocks and <0 on error.
diff --git a/fs/btrfs/backref.h b/fs/btrfs/backref.h
index 310a7f6d09b1..0f446d7ca2c0 100644
--- a/fs/btrfs/backref.h
+++ b/fs/btrfs/backref.h
@@ -59,9 +59,6 @@ int paths_from_inode(u64 inum, struct inode_fs_paths *ipath);
59int btrfs_find_all_roots(struct btrfs_trans_handle *trans, 59int btrfs_find_all_roots(struct btrfs_trans_handle *trans,
60 struct btrfs_fs_info *fs_info, u64 bytenr, 60 struct btrfs_fs_info *fs_info, u64 bytenr,
61 u64 time_seq, struct ulist **roots); 61 u64 time_seq, struct ulist **roots);
62char *btrfs_iref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path,
63 struct btrfs_inode_ref *iref, struct extent_buffer *eb,
64 u64 parent, char *dest, u32 size);
65char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path, 62char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path,
66 u32 name_len, unsigned long name_off, 63 u32 name_len, unsigned long name_off,
67 struct extent_buffer *eb_in, u64 parent, 64 struct extent_buffer *eb_in, u64 parent,
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index b9c565028605..b189bd1e7a3e 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -82,6 +82,10 @@ struct compressed_bio {
82 u32 sums; 82 u32 sums;
83}; 83};
84 84
85static int btrfs_decompress_biovec(int type, struct page **pages_in,
86 u64 disk_start, struct bio_vec *bvec,
87 int vcnt, size_t srclen);
88
85static inline int compressed_bio_size(struct btrfs_root *root, 89static inline int compressed_bio_size(struct btrfs_root *root,
86 unsigned long disk_size) 90 unsigned long disk_size)
87{ 91{
@@ -738,7 +742,7 @@ static int comp_num_workspace[BTRFS_COMPRESS_TYPES];
738static atomic_t comp_alloc_workspace[BTRFS_COMPRESS_TYPES]; 742static atomic_t comp_alloc_workspace[BTRFS_COMPRESS_TYPES];
739static wait_queue_head_t comp_workspace_wait[BTRFS_COMPRESS_TYPES]; 743static wait_queue_head_t comp_workspace_wait[BTRFS_COMPRESS_TYPES];
740 744
741struct btrfs_compress_op *btrfs_compress_op[] = { 745static struct btrfs_compress_op *btrfs_compress_op[] = {
742 &btrfs_zlib_compress, 746 &btrfs_zlib_compress,
743 &btrfs_lzo_compress, 747 &btrfs_lzo_compress,
744}; 748};
@@ -909,8 +913,9 @@ int btrfs_compress_pages(int type, struct address_space *mapping,
909 * be contiguous. They all correspond to the range of bytes covered by 913 * be contiguous. They all correspond to the range of bytes covered by
910 * the compressed extent. 914 * the compressed extent.
911 */ 915 */
912int btrfs_decompress_biovec(int type, struct page **pages_in, u64 disk_start, 916static int btrfs_decompress_biovec(int type, struct page **pages_in,
913 struct bio_vec *bvec, int vcnt, size_t srclen) 917 u64 disk_start, struct bio_vec *bvec,
918 int vcnt, size_t srclen)
914{ 919{
915 struct list_head *workspace; 920 struct list_head *workspace;
916 int ret; 921 int ret;
diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h
index 9afb0a62ae82..0c803b4fbf93 100644
--- a/fs/btrfs/compression.h
+++ b/fs/btrfs/compression.h
@@ -30,8 +30,6 @@ int btrfs_compress_pages(int type, struct address_space *mapping,
30 unsigned long *total_in, 30 unsigned long *total_in,
31 unsigned long *total_out, 31 unsigned long *total_out,
32 unsigned long max_out); 32 unsigned long max_out);
33int btrfs_decompress_biovec(int type, struct page **pages_in, u64 disk_start,
34 struct bio_vec *bvec, int vcnt, size_t srclen);
35int btrfs_decompress(int type, unsigned char *data_in, struct page *dest_page, 33int btrfs_decompress(int type, unsigned char *data_in, struct page *dest_page,
36 unsigned long start_byte, size_t srclen, size_t destlen); 34 unsigned long start_byte, size_t srclen, size_t destlen);
37int btrfs_decompress_buf2page(char *buf, unsigned long buf_start, 35int btrfs_decompress_buf2page(char *buf, unsigned long buf_start,
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index a17d9991c333..de6de8e60b46 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -41,12 +41,7 @@ static void del_ptr(struct btrfs_root *root, struct btrfs_path *path,
41 int level, int slot); 41 int level, int slot);
42static void tree_mod_log_free_eb(struct btrfs_fs_info *fs_info, 42static void tree_mod_log_free_eb(struct btrfs_fs_info *fs_info,
43 struct extent_buffer *eb); 43 struct extent_buffer *eb);
44struct extent_buffer *read_old_tree_block(struct btrfs_root *root, u64 bytenr, 44static int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path);
45 u32 blocksize, u64 parent_transid,
46 u64 time_seq);
47struct extent_buffer *btrfs_find_old_tree_block(struct btrfs_root *root,
48 u64 bytenr, u32 blocksize,
49 u64 time_seq);
50 45
51struct btrfs_path *btrfs_alloc_path(void) 46struct btrfs_path *btrfs_alloc_path(void)
52{ 47{
@@ -208,7 +203,7 @@ struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root)
208 * tree until you end up with a lock on the root. A locked buffer 203 * tree until you end up with a lock on the root. A locked buffer
209 * is returned, with a reference held. 204 * is returned, with a reference held.
210 */ 205 */
211struct extent_buffer *btrfs_read_lock_root_node(struct btrfs_root *root) 206static struct extent_buffer *btrfs_read_lock_root_node(struct btrfs_root *root)
212{ 207{
213 struct extent_buffer *eb; 208 struct extent_buffer *eb;
214 209
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index d9bed5fd3347..4272fbb08732 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3044,8 +3044,6 @@ struct btrfs_block_group_cache *btrfs_lookup_block_group(
3044 struct btrfs_fs_info *info, 3044 struct btrfs_fs_info *info,
3045 u64 bytenr); 3045 u64 bytenr);
3046void btrfs_put_block_group(struct btrfs_block_group_cache *cache); 3046void btrfs_put_block_group(struct btrfs_block_group_cache *cache);
3047u64 btrfs_find_block_group(struct btrfs_root *root,
3048 u64 search_start, u64 search_hint, int owner);
3049struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, 3047struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
3050 struct btrfs_root *root, u32 blocksize, 3048 struct btrfs_root *root, u32 blocksize,
3051 u64 parent, u64 root_objectid, 3049 u64 parent, u64 root_objectid,
@@ -3055,10 +3053,6 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans,
3055 struct btrfs_root *root, 3053 struct btrfs_root *root,
3056 struct extent_buffer *buf, 3054 struct extent_buffer *buf,
3057 u64 parent, int last_ref); 3055 u64 parent, int last_ref);
3058struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans,
3059 struct btrfs_root *root,
3060 u64 bytenr, u32 blocksize,
3061 int level);
3062int btrfs_alloc_reserved_file_extent(struct btrfs_trans_handle *trans, 3056int btrfs_alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
3063 struct btrfs_root *root, 3057 struct btrfs_root *root,
3064 u64 root_objectid, u64 owner, 3058 u64 root_objectid, u64 owner,
@@ -3111,7 +3105,6 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
3111 struct btrfs_root *root, u64 group_start); 3105 struct btrfs_root *root, u64 group_start);
3112void btrfs_create_pending_block_groups(struct btrfs_trans_handle *trans, 3106void btrfs_create_pending_block_groups(struct btrfs_trans_handle *trans,
3113 struct btrfs_root *root); 3107 struct btrfs_root *root);
3114u64 btrfs_reduce_alloc_profile(struct btrfs_root *root, u64 flags);
3115u64 btrfs_get_alloc_profile(struct btrfs_root *root, int data); 3108u64 btrfs_get_alloc_profile(struct btrfs_root *root, int data);
3116void btrfs_clear_space_info_full(struct btrfs_fs_info *info); 3109void btrfs_clear_space_info_full(struct btrfs_fs_info *info);
3117 3110
@@ -3300,7 +3293,6 @@ static inline int btrfs_next_item(struct btrfs_root *root, struct btrfs_path *p)
3300{ 3293{
3301 return btrfs_next_old_item(root, p, 0); 3294 return btrfs_next_old_item(root, p, 0);
3302} 3295}
3303int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path);
3304int btrfs_leaf_free_space(struct btrfs_root *root, struct extent_buffer *leaf); 3296int btrfs_leaf_free_space(struct btrfs_root *root, struct extent_buffer *leaf);
3305int __must_check btrfs_drop_snapshot(struct btrfs_root *root, 3297int __must_check btrfs_drop_snapshot(struct btrfs_root *root,
3306 struct btrfs_block_rsv *block_rsv, 3298 struct btrfs_block_rsv *block_rsv,
@@ -3395,9 +3387,6 @@ struct btrfs_dir_item *
3395btrfs_search_dir_index_item(struct btrfs_root *root, 3387btrfs_search_dir_index_item(struct btrfs_root *root,
3396 struct btrfs_path *path, u64 dirid, 3388 struct btrfs_path *path, u64 dirid,
3397 const char *name, int name_len); 3389 const char *name, int name_len);
3398struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root,
3399 struct btrfs_path *path,
3400 const char *name, int name_len);
3401int btrfs_delete_one_dir_name(struct btrfs_trans_handle *trans, 3390int btrfs_delete_one_dir_name(struct btrfs_trans_handle *trans,
3402 struct btrfs_root *root, 3391 struct btrfs_root *root,
3403 struct btrfs_path *path, 3392 struct btrfs_path *path,
@@ -3475,16 +3464,11 @@ int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans,
3475 struct btrfs_root *root, 3464 struct btrfs_root *root,
3476 struct btrfs_path *path, u64 objectid, 3465 struct btrfs_path *path, u64 objectid,
3477 u64 bytenr, int mod); 3466 u64 bytenr, int mod);
3478u64 btrfs_file_extent_length(struct btrfs_path *path);
3479int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans, 3467int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
3480 struct btrfs_root *root, 3468 struct btrfs_root *root,
3481 struct btrfs_ordered_sum *sums); 3469 struct btrfs_ordered_sum *sums);
3482int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode, 3470int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode,
3483 struct bio *bio, u64 file_start, int contig); 3471 struct bio *bio, u64 file_start, int contig);
3484struct btrfs_csum_item *btrfs_lookup_csum(struct btrfs_trans_handle *trans,
3485 struct btrfs_root *root,
3486 struct btrfs_path *path,
3487 u64 bytenr, int cow);
3488int btrfs_csum_truncate(struct btrfs_trans_handle *trans, 3472int btrfs_csum_truncate(struct btrfs_trans_handle *trans,
3489 struct btrfs_root *root, struct btrfs_path *path, 3473 struct btrfs_root *root, struct btrfs_path *path,
3490 u64 isize); 3474 u64 isize);
@@ -3546,8 +3530,6 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
3546int btrfs_start_delalloc_inodes(struct btrfs_root *root, int delay_iput); 3530int btrfs_start_delalloc_inodes(struct btrfs_root *root, int delay_iput);
3547int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end, 3531int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end,
3548 struct extent_state **cached_state); 3532 struct extent_state **cached_state);
3549int btrfs_writepages(struct address_space *mapping,
3550 struct writeback_control *wbc);
3551int btrfs_create_subvol_root(struct btrfs_trans_handle *trans, 3533int btrfs_create_subvol_root(struct btrfs_trans_handle *trans,
3552 struct btrfs_root *new_root, u64 new_dirid); 3534 struct btrfs_root *new_root, u64 new_dirid);
3553int btrfs_merge_bio_hook(int rw, struct page *page, unsigned long offset, 3535int btrfs_merge_bio_hook(int rw, struct page *page, unsigned long offset,
@@ -3557,7 +3539,6 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
3557int btrfs_readpage(struct file *file, struct page *page); 3539int btrfs_readpage(struct file *file, struct page *page);
3558void btrfs_evict_inode(struct inode *inode); 3540void btrfs_evict_inode(struct inode *inode);
3559int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc); 3541int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc);
3560int btrfs_dirty_inode(struct inode *inode);
3561struct inode *btrfs_alloc_inode(struct super_block *sb); 3542struct inode *btrfs_alloc_inode(struct super_block *sb);
3562void btrfs_destroy_inode(struct inode *inode); 3543void btrfs_destroy_inode(struct inode *inode);
3563int btrfs_drop_inode(struct inode *inode); 3544int btrfs_drop_inode(struct inode *inode);
@@ -3575,7 +3556,6 @@ int btrfs_update_inode(struct btrfs_trans_handle *trans,
3575int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans, 3556int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans,
3576 struct btrfs_root *root, struct inode *inode); 3557 struct btrfs_root *root, struct inode *inode);
3577int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode); 3558int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode);
3578int btrfs_orphan_del(struct btrfs_trans_handle *trans, struct inode *inode);
3579int btrfs_orphan_cleanup(struct btrfs_root *root); 3559int btrfs_orphan_cleanup(struct btrfs_root *root);
3580void btrfs_orphan_commit_root(struct btrfs_trans_handle *trans, 3560void btrfs_orphan_commit_root(struct btrfs_trans_handle *trans,
3581 struct btrfs_root *root); 3561 struct btrfs_root *root);
@@ -3626,7 +3606,6 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans,
3626int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, 3606int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
3627 struct inode *inode, u64 start, u64 end); 3607 struct inode *inode, u64 start, u64 end);
3628int btrfs_release_file(struct inode *inode, struct file *file); 3608int btrfs_release_file(struct inode *inode, struct file *file);
3629void btrfs_drop_pages(struct page **pages, size_t num_pages);
3630int btrfs_dirty_pages(struct btrfs_root *root, struct inode *inode, 3609int btrfs_dirty_pages(struct btrfs_root *root, struct inode *inode,
3631 struct page **pages, size_t num_pages, 3610 struct page **pages, size_t num_pages,
3632 loff_t pos, size_t write_bytes, 3611 loff_t pos, size_t write_bytes,
@@ -3802,7 +3781,6 @@ void btrfs_scrub_continue_super(struct btrfs_root *root);
3802int btrfs_scrub_cancel(struct btrfs_fs_info *info); 3781int btrfs_scrub_cancel(struct btrfs_fs_info *info);
3803int btrfs_scrub_cancel_dev(struct btrfs_fs_info *info, 3782int btrfs_scrub_cancel_dev(struct btrfs_fs_info *info,
3804 struct btrfs_device *dev); 3783 struct btrfs_device *dev);
3805int btrfs_scrub_cancel_devid(struct btrfs_root *root, u64 devid);
3806int btrfs_scrub_progress(struct btrfs_root *root, u64 devid, 3784int btrfs_scrub_progress(struct btrfs_root *root, u64 devid,
3807 struct btrfs_scrub_progress *progress); 3785 struct btrfs_scrub_progress *progress);
3808 3786
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 71b78c27496d..f26f38ccd194 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -202,7 +202,7 @@ static void btrfs_dequeue_delayed_node(struct btrfs_delayed_root *root,
202 spin_unlock(&root->lock); 202 spin_unlock(&root->lock);
203} 203}
204 204
205struct btrfs_delayed_node *btrfs_first_delayed_node( 205static struct btrfs_delayed_node *btrfs_first_delayed_node(
206 struct btrfs_delayed_root *delayed_root) 206 struct btrfs_delayed_root *delayed_root)
207{ 207{
208 struct list_head *p; 208 struct list_head *p;
@@ -221,7 +221,7 @@ out:
221 return node; 221 return node;
222} 222}
223 223
224struct btrfs_delayed_node *btrfs_next_delayed_node( 224static struct btrfs_delayed_node *btrfs_next_delayed_node(
225 struct btrfs_delayed_node *node) 225 struct btrfs_delayed_node *node)
226{ 226{
227 struct btrfs_delayed_root *delayed_root; 227 struct btrfs_delayed_root *delayed_root;
@@ -282,7 +282,7 @@ static inline void btrfs_release_delayed_node(struct btrfs_delayed_node *node)
282 __btrfs_release_delayed_node(node, 0); 282 __btrfs_release_delayed_node(node, 0);
283} 283}
284 284
285struct btrfs_delayed_node *btrfs_first_prepared_delayed_node( 285static struct btrfs_delayed_node *btrfs_first_prepared_delayed_node(
286 struct btrfs_delayed_root *delayed_root) 286 struct btrfs_delayed_root *delayed_root)
287{ 287{
288 struct list_head *p; 288 struct list_head *p;
@@ -308,7 +308,7 @@ static inline void btrfs_release_prepared_delayed_node(
308 __btrfs_release_delayed_node(node, 1); 308 __btrfs_release_delayed_node(node, 1);
309} 309}
310 310
311struct btrfs_delayed_item *btrfs_alloc_delayed_item(u32 data_len) 311static struct btrfs_delayed_item *btrfs_alloc_delayed_item(u32 data_len)
312{ 312{
313 struct btrfs_delayed_item *item; 313 struct btrfs_delayed_item *item;
314 item = kmalloc(sizeof(*item) + data_len, GFP_NOFS); 314 item = kmalloc(sizeof(*item) + data_len, GFP_NOFS);
@@ -383,7 +383,7 @@ static struct btrfs_delayed_item *__btrfs_lookup_delayed_item(
383 return NULL; 383 return NULL;
384} 384}
385 385
386struct btrfs_delayed_item *__btrfs_lookup_delayed_insertion_item( 386static struct btrfs_delayed_item *__btrfs_lookup_delayed_insertion_item(
387 struct btrfs_delayed_node *delayed_node, 387 struct btrfs_delayed_node *delayed_node,
388 struct btrfs_key *key) 388 struct btrfs_key *key)
389{ 389{
@@ -394,45 +394,6 @@ struct btrfs_delayed_item *__btrfs_lookup_delayed_insertion_item(
394 return item; 394 return item;
395} 395}
396 396
397struct btrfs_delayed_item *__btrfs_lookup_delayed_deletion_item(
398 struct btrfs_delayed_node *delayed_node,
399 struct btrfs_key *key)
400{
401 struct btrfs_delayed_item *item;
402
403 item = __btrfs_lookup_delayed_item(&delayed_node->del_root, key,
404 NULL, NULL);
405 return item;
406}
407
408struct btrfs_delayed_item *__btrfs_search_delayed_insertion_item(
409 struct btrfs_delayed_node *delayed_node,
410 struct btrfs_key *key)
411{
412 struct btrfs_delayed_item *item, *next;
413
414 item = __btrfs_lookup_delayed_item(&delayed_node->ins_root, key,
415 NULL, &next);
416 if (!item)
417 item = next;
418
419 return item;
420}
421
422struct btrfs_delayed_item *__btrfs_search_delayed_deletion_item(
423 struct btrfs_delayed_node *delayed_node,
424 struct btrfs_key *key)
425{
426 struct btrfs_delayed_item *item, *next;
427
428 item = __btrfs_lookup_delayed_item(&delayed_node->del_root, key,
429 NULL, &next);
430 if (!item)
431 item = next;
432
433 return item;
434}
435
436static int __btrfs_add_delayed_item(struct btrfs_delayed_node *delayed_node, 397static int __btrfs_add_delayed_item(struct btrfs_delayed_node *delayed_node,
437 struct btrfs_delayed_item *ins, 398 struct btrfs_delayed_item *ins,
438 int action) 399 int action)
@@ -535,7 +496,7 @@ static void btrfs_release_delayed_item(struct btrfs_delayed_item *item)
535 } 496 }
536} 497}
537 498
538struct btrfs_delayed_item *__btrfs_first_delayed_insertion_item( 499static struct btrfs_delayed_item *__btrfs_first_delayed_insertion_item(
539 struct btrfs_delayed_node *delayed_node) 500 struct btrfs_delayed_node *delayed_node)
540{ 501{
541 struct rb_node *p; 502 struct rb_node *p;
@@ -548,7 +509,7 @@ struct btrfs_delayed_item *__btrfs_first_delayed_insertion_item(
548 return item; 509 return item;
549} 510}
550 511
551struct btrfs_delayed_item *__btrfs_first_delayed_deletion_item( 512static struct btrfs_delayed_item *__btrfs_first_delayed_deletion_item(
552 struct btrfs_delayed_node *delayed_node) 513 struct btrfs_delayed_node *delayed_node)
553{ 514{
554 struct rb_node *p; 515 struct rb_node *p;
@@ -561,7 +522,7 @@ struct btrfs_delayed_item *__btrfs_first_delayed_deletion_item(
561 return item; 522 return item;
562} 523}
563 524
564struct btrfs_delayed_item *__btrfs_next_delayed_item( 525static struct btrfs_delayed_item *__btrfs_next_delayed_item(
565 struct btrfs_delayed_item *item) 526 struct btrfs_delayed_item *item)
566{ 527{
567 struct rb_node *p; 528 struct rb_node *p;
diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c
index 71fa113fe41f..79e594e341c7 100644
--- a/fs/btrfs/dir-item.c
+++ b/fs/btrfs/dir-item.c
@@ -21,6 +21,10 @@
21#include "hash.h" 21#include "hash.h"
22#include "transaction.h" 22#include "transaction.h"
23 23
24static struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root,
25 struct btrfs_path *path,
26 const char *name, int name_len);
27
24/* 28/*
25 * insert a name into a directory, doing overflow properly if there is a hash 29 * insert a name into a directory, doing overflow properly if there is a hash
26 * collision. data_size indicates how big the item inserted should be. On 30 * collision. data_size indicates how big the item inserted should be. On
@@ -379,7 +383,7 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans,
379 * this walks through all the entries in a dir item and finds one 383 * this walks through all the entries in a dir item and finds one
380 * for a specific name. 384 * for a specific name.
381 */ 385 */
382struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root, 386static struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root,
383 struct btrfs_path *path, 387 struct btrfs_path *path,
384 const char *name, int name_len) 388 const char *name, int name_len)
385{ 389{
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index f651a37c7e0a..ac132d9637bb 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -70,6 +70,8 @@ static int btrfs_destroy_marked_extents(struct btrfs_root *root,
70 int mark); 70 int mark);
71static int btrfs_destroy_pinned_extent(struct btrfs_root *root, 71static int btrfs_destroy_pinned_extent(struct btrfs_root *root,
72 struct extent_io_tree *pinned_extents); 72 struct extent_io_tree *pinned_extents);
73static int btrfs_cleanup_transaction(struct btrfs_root *root);
74static void btrfs_error_commit_super(struct btrfs_root *root);
73 75
74/* 76/*
75 * end_io_wq structs are used to do processing in task context when an IO is 77 * end_io_wq structs are used to do processing in task context when an IO is
@@ -531,41 +533,6 @@ static noinline int check_leaf(struct btrfs_root *root,
531 return 0; 533 return 0;
532} 534}
533 535
534struct extent_buffer *find_eb_for_page(struct extent_io_tree *tree,
535 struct page *page, int max_walk)
536{
537 struct extent_buffer *eb;
538 u64 start = page_offset(page);
539 u64 target = start;
540 u64 min_start;
541
542 if (start < max_walk)
543 min_start = 0;
544 else
545 min_start = start - max_walk;
546
547 while (start >= min_start) {
548 eb = find_extent_buffer(tree, start, 0);
549 if (eb) {
550 /*
551 * we found an extent buffer and it contains our page
552 * horray!
553 */
554 if (eb->start <= target &&
555 eb->start + eb->len > target)
556 return eb;
557
558 /* we found an extent buffer that wasn't for us */
559 free_extent_buffer(eb);
560 return NULL;
561 }
562 if (start == 0)
563 break;
564 start -= PAGE_CACHE_SIZE;
565 }
566 return NULL;
567}
568
569static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end, 536static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end,
570 struct extent_state *state, int mirror) 537 struct extent_state *state, int mirror)
571{ 538{
@@ -3245,7 +3212,7 @@ int btrfs_calc_num_tolerated_disk_barrier_failures(
3245 return num_tolerated_disk_barrier_failures; 3212 return num_tolerated_disk_barrier_failures;
3246} 3213}
3247 3214
3248int write_all_supers(struct btrfs_root *root, int max_mirrors) 3215static int write_all_supers(struct btrfs_root *root, int max_mirrors)
3249{ 3216{
3250 struct list_head *head; 3217 struct list_head *head;
3251 struct btrfs_device *dev; 3218 struct btrfs_device *dev;
@@ -3611,7 +3578,7 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
3611 return 0; 3578 return 0;
3612} 3579}
3613 3580
3614void btrfs_error_commit_super(struct btrfs_root *root) 3581static void btrfs_error_commit_super(struct btrfs_root *root)
3615{ 3582{
3616 mutex_lock(&root->fs_info->cleaner_mutex); 3583 mutex_lock(&root->fs_info->cleaner_mutex);
3617 btrfs_run_delayed_iputs(root); 3584 btrfs_run_delayed_iputs(root);
@@ -3879,7 +3846,7 @@ void btrfs_cleanup_one_transaction(struct btrfs_transaction *cur_trans,
3879 */ 3846 */
3880} 3847}
3881 3848
3882int btrfs_cleanup_transaction(struct btrfs_root *root) 3849static int btrfs_cleanup_transaction(struct btrfs_root *root)
3883{ 3850{
3884 struct btrfs_transaction *t; 3851 struct btrfs_transaction *t;
3885 LIST_HEAD(list); 3852 LIST_HEAD(list);
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h
index 85c23e6c8fec..be69ce1b07a2 100644
--- a/fs/btrfs/disk-io.h
+++ b/fs/btrfs/disk-io.h
@@ -61,7 +61,6 @@ int write_ctree_super(struct btrfs_trans_handle *trans,
61 struct btrfs_root *root, int max_mirrors); 61 struct btrfs_root *root, int max_mirrors);
62struct buffer_head *btrfs_read_dev_super(struct block_device *bdev); 62struct buffer_head *btrfs_read_dev_super(struct block_device *bdev);
63int btrfs_commit_super(struct btrfs_root *root); 63int btrfs_commit_super(struct btrfs_root *root);
64void btrfs_error_commit_super(struct btrfs_root *root);
65struct extent_buffer *btrfs_find_tree_block(struct btrfs_root *root, 64struct extent_buffer *btrfs_find_tree_block(struct btrfs_root *root,
66 u64 bytenr, u32 blocksize); 65 u64 bytenr, u32 blocksize);
67struct btrfs_root *btrfs_read_fs_root_no_radix(struct btrfs_root *tree_root, 66struct btrfs_root *btrfs_read_fs_root_no_radix(struct btrfs_root *tree_root,
@@ -93,7 +92,6 @@ int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans,
93 struct btrfs_fs_info *fs_info); 92 struct btrfs_fs_info *fs_info);
94int btrfs_add_log_tree(struct btrfs_trans_handle *trans, 93int btrfs_add_log_tree(struct btrfs_trans_handle *trans,
95 struct btrfs_root *root); 94 struct btrfs_root *root);
96int btrfs_cleanup_transaction(struct btrfs_root *root);
97void btrfs_cleanup_one_transaction(struct btrfs_transaction *trans, 95void btrfs_cleanup_one_transaction(struct btrfs_transaction *trans,
98 struct btrfs_root *root); 96 struct btrfs_root *root);
99struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans, 97struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index b0a3fab98713..039a77162817 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -105,6 +105,8 @@ static int btrfs_update_reserved_bytes(struct btrfs_block_group_cache *cache,
105 u64 num_bytes, int reserve); 105 u64 num_bytes, int reserve);
106static int block_rsv_use_bytes(struct btrfs_block_rsv *block_rsv, 106static int block_rsv_use_bytes(struct btrfs_block_rsv *block_rsv,
107 u64 num_bytes); 107 u64 num_bytes);
108int btrfs_pin_extent(struct btrfs_root *root,
109 u64 bytenr, u64 num_bytes, int reserved);
108 110
109static noinline int 111static noinline int
110block_group_cache_done(struct btrfs_block_group_cache *cache) 112block_group_cache_done(struct btrfs_block_group_cache *cache)
@@ -684,55 +686,6 @@ void btrfs_clear_space_info_full(struct btrfs_fs_info *info)
684 rcu_read_unlock(); 686 rcu_read_unlock();
685} 687}
686 688
687u64 btrfs_find_block_group(struct btrfs_root *root,
688 u64 search_start, u64 search_hint, int owner)
689{
690 struct btrfs_block_group_cache *cache;
691 u64 used;
692 u64 last = max(search_hint, search_start);
693 u64 group_start = 0;
694 int full_search = 0;
695 int factor = 9;
696 int wrapped = 0;
697again:
698 while (1) {
699 cache = btrfs_lookup_first_block_group(root->fs_info, last);
700 if (!cache)
701 break;
702
703 spin_lock(&cache->lock);
704 last = cache->key.objectid + cache->key.offset;
705 used = btrfs_block_group_used(&cache->item);
706
707 if ((full_search || !cache->ro) &&
708 block_group_bits(cache, BTRFS_BLOCK_GROUP_METADATA)) {
709 if (used + cache->pinned + cache->reserved <
710 div_factor(cache->key.offset, factor)) {
711 group_start = cache->key.objectid;
712 spin_unlock(&cache->lock);
713 btrfs_put_block_group(cache);
714 goto found;
715 }
716 }
717 spin_unlock(&cache->lock);
718 btrfs_put_block_group(cache);
719 cond_resched();
720 }
721 if (!wrapped) {
722 last = search_start;
723 wrapped = 1;
724 goto again;
725 }
726 if (!full_search && factor < 10) {
727 last = search_start;
728 full_search = 1;
729 factor = 10;
730 goto again;
731 }
732found:
733 return group_start;
734}
735
736/* simple helper to search for an existing extent at a given offset */ 689/* simple helper to search for an existing extent at a given offset */
737int btrfs_lookup_extent(struct btrfs_root *root, u64 start, u64 len) 690int btrfs_lookup_extent(struct btrfs_root *root, u64 start, u64 len)
738{ 691{
@@ -3453,7 +3406,7 @@ static u64 get_restripe_target(struct btrfs_fs_info *fs_info, u64 flags)
3453 * progress (either running or paused) picks the target profile (if it's 3406 * progress (either running or paused) picks the target profile (if it's
3454 * already available), otherwise falls back to plain reducing. 3407 * already available), otherwise falls back to plain reducing.
3455 */ 3408 */
3456u64 btrfs_reduce_alloc_profile(struct btrfs_root *root, u64 flags) 3409static u64 btrfs_reduce_alloc_profile(struct btrfs_root *root, u64 flags)
3457{ 3410{
3458 /* 3411 /*
3459 * we add in the count of missing devices because we want 3412 * we add in the count of missing devices because we want
@@ -3927,8 +3880,8 @@ static int can_overcommit(struct btrfs_root *root,
3927 return 0; 3880 return 0;
3928} 3881}
3929 3882
3930void btrfs_writeback_inodes_sb_nr(struct btrfs_root *root, 3883static void btrfs_writeback_inodes_sb_nr(struct btrfs_root *root,
3931 unsigned long nr_pages) 3884 unsigned long nr_pages)
3932{ 3885{
3933 struct super_block *sb = root->fs_info->sb; 3886 struct super_block *sb = root->fs_info->sb;
3934 int started; 3887 int started;
@@ -6652,10 +6605,9 @@ out:
6652 return ret; 6605 return ret;
6653} 6606}
6654 6607
6655struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, 6608static struct extent_buffer *
6656 struct btrfs_root *root, 6609btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root,
6657 u64 bytenr, u32 blocksize, 6610 u64 bytenr, u32 blocksize, int level)
6658 int level)
6659{ 6611{
6660 struct extent_buffer *buf; 6612 struct extent_buffer *buf;
6661 6613
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index f110d12de2d5..77c5914f6090 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -477,7 +477,7 @@ alloc_extent_state_atomic(struct extent_state *prealloc)
477 return prealloc; 477 return prealloc;
478} 478}
479 479
480void extent_io_tree_panic(struct extent_io_tree *tree, int err) 480static void extent_io_tree_panic(struct extent_io_tree *tree, int err)
481{ 481{
482 btrfs_panic(tree_fs_info(tree), err, "Locking error: " 482 btrfs_panic(tree_fs_info(tree), err, "Locking error: "
483 "Extent tree was modified by another " 483 "Extent tree was modified by another "
@@ -658,7 +658,8 @@ static void wait_on_state(struct extent_io_tree *tree,
658 * The range [start, end] is inclusive. 658 * The range [start, end] is inclusive.
659 * The tree lock is taken by this function 659 * The tree lock is taken by this function
660 */ 660 */
661void wait_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int bits) 661static void wait_extent_bit(struct extent_io_tree *tree, u64 start,
662 u64 end, int bits)
662{ 663{
663 struct extent_state *state; 664 struct extent_state *state;
664 struct rb_node *node; 665 struct rb_node *node;
@@ -1327,8 +1328,9 @@ static int set_range_writeback(struct extent_io_tree *tree, u64 start, u64 end)
1327 * return it. tree->lock must be held. NULL will returned if 1328 * return it. tree->lock must be held. NULL will returned if
1328 * nothing was found after 'start' 1329 * nothing was found after 'start'
1329 */ 1330 */
1330struct extent_state *find_first_extent_bit_state(struct extent_io_tree *tree, 1331static struct extent_state *
1331 u64 start, int bits) 1332find_first_extent_bit_state(struct extent_io_tree *tree,
1333 u64 start, int bits)
1332{ 1334{
1333 struct rb_node *node; 1335 struct rb_node *node;
1334 struct extent_state *state; 1336 struct extent_state *state;
@@ -2668,7 +2670,8 @@ static int submit_extent_page(int rw, struct extent_io_tree *tree,
2668 return ret; 2670 return ret;
2669} 2671}
2670 2672
2671void attach_extent_buffer_page(struct extent_buffer *eb, struct page *page) 2673static void attach_extent_buffer_page(struct extent_buffer *eb,
2674 struct page *page)
2672{ 2675{
2673 if (!PagePrivate(page)) { 2676 if (!PagePrivate(page)) {
2674 SetPagePrivate(page); 2677 SetPagePrivate(page);
@@ -3786,9 +3789,9 @@ int extent_invalidatepage(struct extent_io_tree *tree,
3786 * are locked or under IO and drops the related state bits if it is safe 3789 * are locked or under IO and drops the related state bits if it is safe
3787 * to drop the page. 3790 * to drop the page.
3788 */ 3791 */
3789int try_release_extent_state(struct extent_map_tree *map, 3792static int try_release_extent_state(struct extent_map_tree *map,
3790 struct extent_io_tree *tree, struct page *page, 3793 struct extent_io_tree *tree,
3791 gfp_t mask) 3794 struct page *page, gfp_t mask)
3792{ 3795{
3793 u64 start = page_offset(page); 3796 u64 start = page_offset(page);
3794 u64 end = start + PAGE_CACHE_SIZE - 1; 3797 u64 end = start + PAGE_CACHE_SIZE - 1;
@@ -4571,17 +4574,6 @@ int set_extent_buffer_dirty(struct extent_buffer *eb)
4571 return was_dirty; 4574 return was_dirty;
4572} 4575}
4573 4576
4574static int range_straddles_pages(u64 start, u64 len)
4575{
4576 if (len < PAGE_CACHE_SIZE)
4577 return 1;
4578 if (start & (PAGE_CACHE_SIZE - 1))
4579 return 1;
4580 if ((start + len) & (PAGE_CACHE_SIZE - 1))
4581 return 1;
4582 return 0;
4583}
4584
4585int clear_extent_buffer_uptodate(struct extent_buffer *eb) 4577int clear_extent_buffer_uptodate(struct extent_buffer *eb)
4586{ 4578{
4587 unsigned long i; 4579 unsigned long i;
@@ -4613,37 +4605,6 @@ int set_extent_buffer_uptodate(struct extent_buffer *eb)
4613 return 0; 4605 return 0;
4614} 4606}
4615 4607
4616int extent_range_uptodate(struct extent_io_tree *tree,
4617 u64 start, u64 end)
4618{
4619 struct page *page;
4620 int ret;
4621 int pg_uptodate = 1;
4622 int uptodate;
4623 unsigned long index;
4624
4625 if (range_straddles_pages(start, end - start + 1)) {
4626 ret = test_range_bit(tree, start, end,
4627 EXTENT_UPTODATE, 1, NULL);
4628 if (ret)
4629 return 1;
4630 }
4631 while (start <= end) {
4632 index = start >> PAGE_CACHE_SHIFT;
4633 page = find_get_page(tree->mapping, index);
4634 if (!page)
4635 return 1;
4636 uptodate = PageUptodate(page);
4637 page_cache_release(page);
4638 if (!uptodate) {
4639 pg_uptodate = 0;
4640 break;
4641 }
4642 start += PAGE_CACHE_SIZE;
4643 }
4644 return pg_uptodate;
4645}
4646
4647int extent_buffer_uptodate(struct extent_buffer *eb) 4608int extent_buffer_uptodate(struct extent_buffer *eb)
4648{ 4609{
4649 return test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags); 4610 return test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index 59d883bc3ed3..9ebb4c7b86d1 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -190,9 +190,6 @@ int try_release_extent_mapping(struct extent_map_tree *map,
190 struct extent_io_tree *tree, struct page *page, 190 struct extent_io_tree *tree, struct page *page,
191 gfp_t mask); 191 gfp_t mask);
192int try_release_extent_buffer(struct page *page, gfp_t mask); 192int try_release_extent_buffer(struct page *page, gfp_t mask);
193int try_release_extent_state(struct extent_map_tree *map,
194 struct extent_io_tree *tree, struct page *page,
195 gfp_t mask);
196int lock_extent(struct extent_io_tree *tree, u64 start, u64 end); 193int lock_extent(struct extent_io_tree *tree, u64 start, u64 end);
197int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, 194int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
198 int bits, struct extent_state **cached); 195 int bits, struct extent_state **cached);
@@ -242,8 +239,6 @@ int set_extent_defrag(struct extent_io_tree *tree, u64 start, u64 end,
242int find_first_extent_bit(struct extent_io_tree *tree, u64 start, 239int find_first_extent_bit(struct extent_io_tree *tree, u64 start,
243 u64 *start_ret, u64 *end_ret, int bits, 240 u64 *start_ret, u64 *end_ret, int bits,
244 struct extent_state **cached_state); 241 struct extent_state **cached_state);
245struct extent_state *find_first_extent_bit_state(struct extent_io_tree *tree,
246 u64 start, int bits);
247int extent_invalidatepage(struct extent_io_tree *tree, 242int extent_invalidatepage(struct extent_io_tree *tree,
248 struct page *page, unsigned long offset); 243 struct page *page, unsigned long offset);
249int extent_write_full_page(struct extent_io_tree *tree, struct page *page, 244int extent_write_full_page(struct extent_io_tree *tree, struct page *page,
@@ -322,7 +317,6 @@ void memmove_extent_buffer(struct extent_buffer *dst, unsigned long dst_offset,
322 unsigned long src_offset, unsigned long len); 317 unsigned long src_offset, unsigned long len);
323void memset_extent_buffer(struct extent_buffer *eb, char c, 318void memset_extent_buffer(struct extent_buffer *eb, char c,
324 unsigned long start, unsigned long len); 319 unsigned long start, unsigned long len);
325void wait_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int bits);
326void clear_extent_buffer_dirty(struct extent_buffer *eb); 320void clear_extent_buffer_dirty(struct extent_buffer *eb);
327int set_extent_buffer_dirty(struct extent_buffer *eb); 321int set_extent_buffer_dirty(struct extent_buffer *eb);
328int set_extent_buffer_uptodate(struct extent_buffer *eb); 322int set_extent_buffer_uptodate(struct extent_buffer *eb);
@@ -332,8 +326,6 @@ int map_private_extent_buffer(struct extent_buffer *eb, unsigned long offset,
332 unsigned long min_len, char **map, 326 unsigned long min_len, char **map,
333 unsigned long *map_start, 327 unsigned long *map_start,
334 unsigned long *map_len); 328 unsigned long *map_len);
335int extent_range_uptodate(struct extent_io_tree *tree,
336 u64 start, u64 end);
337int extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end); 329int extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end);
338int extent_range_redirty_for_io(struct inode *inode, u64 start, u64 end); 330int extent_range_redirty_for_io(struct inode *inode, u64 start, u64 end);
339int extent_clear_unlock_delalloc(struct inode *inode, 331int extent_clear_unlock_delalloc(struct inode *inode,
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index ca968742c3db..a4a7a1a8da95 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -345,8 +345,9 @@ static u64 range_end(u64 start, u64 len)
345 return start + len; 345 return start + len;
346} 346}
347 347
348struct extent_map *__lookup_extent_mapping(struct extent_map_tree *tree, 348static struct extent_map *
349 u64 start, u64 len, int strict) 349__lookup_extent_mapping(struct extent_map_tree *tree,
350 u64 start, u64 len, int strict)
350{ 351{
351 struct extent_map *em; 352 struct extent_map *em;
352 struct rb_node *rb_node; 353 struct rb_node *rb_node;
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index 769eb86f890c..b193bf324a41 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -83,10 +83,11 @@ out:
83 return ret; 83 return ret;
84} 84}
85 85
86struct btrfs_csum_item *btrfs_lookup_csum(struct btrfs_trans_handle *trans, 86static struct btrfs_csum_item *
87 struct btrfs_root *root, 87btrfs_lookup_csum(struct btrfs_trans_handle *trans,
88 struct btrfs_path *path, 88 struct btrfs_root *root,
89 u64 bytenr, int cow) 89 struct btrfs_path *path,
90 u64 bytenr, int cow)
90{ 91{
91 int ret; 92 int ret;
92 struct btrfs_key file_key; 93 struct btrfs_key file_key;
@@ -152,27 +153,6 @@ int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans,
152 return ret; 153 return ret;
153} 154}
154 155
155u64 btrfs_file_extent_length(struct btrfs_path *path)
156{
157 int extent_type;
158 struct btrfs_file_extent_item *fi;
159 u64 len;
160
161 fi = btrfs_item_ptr(path->nodes[0], path->slots[0],
162 struct btrfs_file_extent_item);
163 extent_type = btrfs_file_extent_type(path->nodes[0], fi);
164
165 if (extent_type == BTRFS_FILE_EXTENT_REG ||
166 extent_type == BTRFS_FILE_EXTENT_PREALLOC)
167 len = btrfs_file_extent_num_bytes(path->nodes[0], fi);
168 else if (extent_type == BTRFS_FILE_EXTENT_INLINE)
169 len = btrfs_file_extent_inline_len(path->nodes[0], fi);
170 else
171 BUG();
172
173 return len;
174}
175
176static int __btrfs_lookup_bio_sums(struct btrfs_root *root, 156static int __btrfs_lookup_bio_sums(struct btrfs_root *root,
177 struct inode *inode, struct bio *bio, 157 struct inode *inode, struct bio *bio,
178 u64 logical_offset, u32 *dst, int dio) 158 u64 logical_offset, u32 *dst, int dio)
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index bef15c3ef41d..b3e359bc8e68 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -192,8 +192,8 @@ int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans,
192 * the same inode in the tree, we will merge them together (by 192 * the same inode in the tree, we will merge them together (by
193 * __btrfs_add_inode_defrag()) and free the one that we want to requeue. 193 * __btrfs_add_inode_defrag()) and free the one that we want to requeue.
194 */ 194 */
195void btrfs_requeue_inode_defrag(struct inode *inode, 195static void btrfs_requeue_inode_defrag(struct inode *inode,
196 struct inode_defrag *defrag) 196 struct inode_defrag *defrag)
197{ 197{
198 struct btrfs_root *root = BTRFS_I(inode)->root; 198 struct btrfs_root *root = BTRFS_I(inode)->root;
199 int ret; 199 int ret;
@@ -473,7 +473,7 @@ static noinline int btrfs_copy_from_user(loff_t pos, int num_pages,
473/* 473/*
474 * unlocks pages after btrfs_file_write is done with them 474 * unlocks pages after btrfs_file_write is done with them
475 */ 475 */
476void btrfs_drop_pages(struct page **pages, size_t num_pages) 476static void btrfs_drop_pages(struct page **pages, size_t num_pages)
477{ 477{
478 size_t i; 478 size_t i;
479 for (i = 0; i < num_pages; i++) { 479 for (i = 0; i < num_pages; i++) {
@@ -497,9 +497,9 @@ void btrfs_drop_pages(struct page **pages, size_t num_pages)
497 * doing real data extents, marking pages dirty and delalloc as required. 497 * doing real data extents, marking pages dirty and delalloc as required.
498 */ 498 */
499int btrfs_dirty_pages(struct btrfs_root *root, struct inode *inode, 499int btrfs_dirty_pages(struct btrfs_root *root, struct inode *inode,
500 struct page **pages, size_t num_pages, 500 struct page **pages, size_t num_pages,
501 loff_t pos, size_t write_bytes, 501 loff_t pos, size_t write_bytes,
502 struct extent_state **cached) 502 struct extent_state **cached)
503{ 503{
504 int err = 0; 504 int err = 0;
505 int i; 505 int i;
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 37b2b89a28f6..ecca6c7375a6 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -120,9 +120,10 @@ struct inode *lookup_free_space_inode(struct btrfs_root *root,
120 return inode; 120 return inode;
121} 121}
122 122
123int __create_free_space_inode(struct btrfs_root *root, 123static int __create_free_space_inode(struct btrfs_root *root,
124 struct btrfs_trans_handle *trans, 124 struct btrfs_trans_handle *trans,
125 struct btrfs_path *path, u64 ino, u64 offset) 125 struct btrfs_path *path,
126 u64 ino, u64 offset)
126{ 127{
127 struct btrfs_key key; 128 struct btrfs_key key;
128 struct btrfs_disk_key disk_key; 129 struct btrfs_disk_key disk_key;
@@ -625,9 +626,9 @@ next:
625 spin_unlock(&ctl->tree_lock); 626 spin_unlock(&ctl->tree_lock);
626} 627}
627 628
628int __load_free_space_cache(struct btrfs_root *root, struct inode *inode, 629static int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
629 struct btrfs_free_space_ctl *ctl, 630 struct btrfs_free_space_ctl *ctl,
630 struct btrfs_path *path, u64 offset) 631 struct btrfs_path *path, u64 offset)
631{ 632{
632 struct btrfs_free_space_header *header; 633 struct btrfs_free_space_header *header;
633 struct extent_buffer *leaf; 634 struct extent_buffer *leaf;
@@ -868,11 +869,11 @@ out:
868 * on mount. This will return 0 if it was successfull in writing the cache out, 869 * on mount. This will return 0 if it was successfull in writing the cache out,
869 * and -1 if it was not. 870 * and -1 if it was not.
870 */ 871 */
871int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode, 872static int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
872 struct btrfs_free_space_ctl *ctl, 873 struct btrfs_free_space_ctl *ctl,
873 struct btrfs_block_group_cache *block_group, 874 struct btrfs_block_group_cache *block_group,
874 struct btrfs_trans_handle *trans, 875 struct btrfs_trans_handle *trans,
875 struct btrfs_path *path, u64 offset) 876 struct btrfs_path *path, u64 offset)
876{ 877{
877 struct btrfs_free_space_header *header; 878 struct btrfs_free_space_header *header;
878 struct extent_buffer *leaf; 879 struct extent_buffer *leaf;
@@ -2067,7 +2068,8 @@ out:
2067 return 0; 2068 return 0;
2068} 2069}
2069 2070
2070void __btrfs_remove_free_space_cache_locked(struct btrfs_free_space_ctl *ctl) 2071static void __btrfs_remove_free_space_cache_locked(
2072 struct btrfs_free_space_ctl *ctl)
2071{ 2073{
2072 struct btrfs_free_space *info; 2074 struct btrfs_free_space *info;
2073 struct rb_node *node; 2075 struct rb_node *node;
diff --git a/fs/btrfs/inode-item.c b/fs/btrfs/inode-item.c
index 1640e0344a40..e0b7034d6343 100644
--- a/fs/btrfs/inode-item.c
+++ b/fs/btrfs/inode-item.c
@@ -183,10 +183,11 @@ int btrfs_get_inode_ref_index(struct btrfs_trans_handle *trans,
183 return -ENOENT; 183 return -ENOENT;
184} 184}
185 185
186int btrfs_del_inode_extref(struct btrfs_trans_handle *trans, 186static int btrfs_del_inode_extref(struct btrfs_trans_handle *trans,
187 struct btrfs_root *root, 187 struct btrfs_root *root,
188 const char *name, int name_len, 188 const char *name, int name_len,
189 u64 inode_objectid, u64 ref_objectid, u64 *index) 189 u64 inode_objectid, u64 ref_objectid,
190 u64 *index)
190{ 191{
191 struct btrfs_path *path; 192 struct btrfs_path *path;
192 struct btrfs_key key; 193 struct btrfs_key key;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 0eab7b67e109..ec63d7af3460 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -103,6 +103,8 @@ static struct extent_map *create_pinned_em(struct inode *inode, u64 start,
103 u64 orig_block_len, u64 ram_bytes, 103 u64 orig_block_len, u64 ram_bytes,
104 int type); 104 int type);
105 105
106static int btrfs_dirty_inode(struct inode *inode);
107
106static int btrfs_init_inode_security(struct btrfs_trans_handle *trans, 108static int btrfs_init_inode_security(struct btrfs_trans_handle *trans,
107 struct inode *inode, struct inode *dir, 109 struct inode *inode, struct inode *dir,
108 const struct qstr *qstr) 110 const struct qstr *qstr)
@@ -3024,7 +3026,8 @@ int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode)
3024 * We have done the truncate/delete so we can go ahead and remove the orphan 3026 * We have done the truncate/delete so we can go ahead and remove the orphan
3025 * item for this particular inode. 3027 * item for this particular inode.
3026 */ 3028 */
3027int btrfs_orphan_del(struct btrfs_trans_handle *trans, struct inode *inode) 3029static int btrfs_orphan_del(struct btrfs_trans_handle *trans,
3030 struct inode *inode)
3028{ 3031{
3029 struct btrfs_root *root = BTRFS_I(inode)->root; 3032 struct btrfs_root *root = BTRFS_I(inode)->root;
3030 int delete_item = 0; 3033 int delete_item = 0;
@@ -5342,7 +5345,7 @@ int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc)
5342 * FIXME, needs more benchmarking...there are no reasons other than performance 5345 * FIXME, needs more benchmarking...there are no reasons other than performance
5343 * to keep or drop this code. 5346 * to keep or drop this code.
5344 */ 5347 */
5345int btrfs_dirty_inode(struct inode *inode) 5348static int btrfs_dirty_inode(struct inode *inode)
5346{ 5349{
5347 struct btrfs_root *root = BTRFS_I(inode)->root; 5350 struct btrfs_root *root = BTRFS_I(inode)->root;
5348 struct btrfs_trans_handle *trans; 5351 struct btrfs_trans_handle *trans;
@@ -7437,8 +7440,8 @@ static int btrfs_writepage(struct page *page, struct writeback_control *wbc)
7437 return extent_write_full_page(tree, page, btrfs_get_extent, wbc); 7440 return extent_write_full_page(tree, page, btrfs_get_extent, wbc);
7438} 7441}
7439 7442
7440int btrfs_writepages(struct address_space *mapping, 7443static int btrfs_writepages(struct address_space *mapping,
7441 struct writeback_control *wbc) 7444 struct writeback_control *wbc)
7442{ 7445{
7443 struct extent_io_tree *tree; 7446 struct extent_io_tree *tree;
7444 7447
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index f5f6af338b53..3aa37508bf23 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -3010,7 +3010,7 @@ void btrfs_get_block_group_info(struct list_head *groups_list,
3010 } 3010 }
3011} 3011}
3012 3012
3013long btrfs_ioctl_space_info(struct btrfs_root *root, void __user *arg) 3013static long btrfs_ioctl_space_info(struct btrfs_root *root, void __user *arg)
3014{ 3014{
3015 struct btrfs_ioctl_space_args space_args; 3015 struct btrfs_ioctl_space_args space_args;
3016 struct btrfs_ioctl_space_info space; 3016 struct btrfs_ioctl_space_info space;
diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c
index e95df435d897..01277b8f2373 100644
--- a/fs/btrfs/locking.c
+++ b/fs/btrfs/locking.c
@@ -24,7 +24,7 @@
24#include "extent_io.h" 24#include "extent_io.h"
25#include "locking.h" 25#include "locking.h"
26 26
27void btrfs_assert_tree_read_locked(struct extent_buffer *eb); 27static void btrfs_assert_tree_read_locked(struct extent_buffer *eb);
28 28
29/* 29/*
30 * if we currently have a spinning reader or writer lock 30 * if we currently have a spinning reader or writer lock
@@ -264,7 +264,7 @@ void btrfs_assert_tree_locked(struct extent_buffer *eb)
264 BUG_ON(!atomic_read(&eb->write_locks)); 264 BUG_ON(!atomic_read(&eb->write_locks));
265} 265}
266 266
267void btrfs_assert_tree_read_locked(struct extent_buffer *eb) 267static void btrfs_assert_tree_read_locked(struct extent_buffer *eb)
268{ 268{
269 BUG_ON(!atomic_read(&eb->read_locks)); 269 BUG_ON(!atomic_read(&eb->read_locks));
270} 270}
diff --git a/fs/btrfs/print-tree.h b/fs/btrfs/print-tree.h
index da75efe534d5..7faddfacc5bd 100644
--- a/fs/btrfs/print-tree.h
+++ b/fs/btrfs/print-tree.h
@@ -19,5 +19,5 @@
19#ifndef __PRINT_TREE_ 19#ifndef __PRINT_TREE_
20#define __PRINT_TREE_ 20#define __PRINT_TREE_
21void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l); 21void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l);
22void btrfs_print_tree(struct btrfs_root *root, struct extent_buffer *t); 22void btrfs_print_tree(struct btrfs_root *root, struct extent_buffer *c);
23#endif 23#endif
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index 9a79fb790adb..0740621daf6c 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -410,7 +410,7 @@ static void remove_rbio_from_cache(struct btrfs_raid_bio *rbio)
410/* 410/*
411 * remove everything in the cache 411 * remove everything in the cache
412 */ 412 */
413void btrfs_clear_rbio_cache(struct btrfs_fs_info *info) 413static void btrfs_clear_rbio_cache(struct btrfs_fs_info *info)
414{ 414{
415 struct btrfs_stripe_hash_table *table; 415 struct btrfs_stripe_hash_table *table;
416 unsigned long flags; 416 unsigned long flags;
@@ -1010,12 +1010,12 @@ static int alloc_rbio_parity_pages(struct btrfs_raid_bio *rbio)
1010 * this will try to merge into existing bios if possible, and returns 1010 * this will try to merge into existing bios if possible, and returns
1011 * zero if all went well. 1011 * zero if all went well.
1012 */ 1012 */
1013int rbio_add_io_page(struct btrfs_raid_bio *rbio, 1013static int rbio_add_io_page(struct btrfs_raid_bio *rbio,
1014 struct bio_list *bio_list, 1014 struct bio_list *bio_list,
1015 struct page *page, 1015 struct page *page,
1016 int stripe_nr, 1016 int stripe_nr,
1017 unsigned long page_index, 1017 unsigned long page_index,
1018 unsigned long bio_max_len) 1018 unsigned long bio_max_len)
1019{ 1019{
1020 struct bio *last = bio_list->tail; 1020 struct bio *last = bio_list->tail;
1021 u64 last_end = 0; 1021 u64 last_end = 0;
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 63cdd9246c70..d338df405e72 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -326,8 +326,7 @@ static struct rb_node *tree_search(struct rb_root *root, u64 bytenr)
326 return NULL; 326 return NULL;
327} 327}
328 328
329void backref_tree_panic(struct rb_node *rb_node, int errno, 329static void backref_tree_panic(struct rb_node *rb_node, int errno, u64 bytenr)
330 u64 bytenr)
331{ 330{
332 331
333 struct btrfs_fs_info *fs_info = NULL; 332 struct btrfs_fs_info *fs_info = NULL;
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 28db5dcde0aa..47500c25262e 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -3012,28 +3012,6 @@ int btrfs_scrub_cancel_dev(struct btrfs_fs_info *fs_info,
3012 return 0; 3012 return 0;
3013} 3013}
3014 3014
3015int btrfs_scrub_cancel_devid(struct btrfs_root *root, u64 devid)
3016{
3017 struct btrfs_fs_info *fs_info = root->fs_info;
3018 struct btrfs_device *dev;
3019 int ret;
3020
3021 /*
3022 * we have to hold the device_list_mutex here so the device
3023 * does not go away in cancel_dev. FIXME: find a better solution
3024 */
3025 mutex_lock(&fs_info->fs_devices->device_list_mutex);
3026 dev = btrfs_find_device(fs_info, devid, NULL, NULL);
3027 if (!dev) {
3028 mutex_unlock(&fs_info->fs_devices->device_list_mutex);
3029 return -ENODEV;
3030 }
3031 ret = btrfs_scrub_cancel_dev(fs_info, dev);
3032 mutex_unlock(&fs_info->fs_devices->device_list_mutex);
3033
3034 return ret;
3035}
3036
3037int btrfs_scrub_progress(struct btrfs_root *root, u64 devid, 3015int btrfs_scrub_progress(struct btrfs_root *root, u64 devid,
3038 struct btrfs_scrub_progress *progress) 3016 struct btrfs_scrub_progress *progress)
3039{ 3017{
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 2037fc0efab1..ff40f1c00ce3 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -387,7 +387,7 @@ static struct btrfs_path *alloc_path_for_send(void)
387 return path; 387 return path;
388} 388}
389 389
390int write_buf(struct file *filp, const void *buf, u32 len, loff_t *off) 390static int write_buf(struct file *filp, const void *buf, u32 len, loff_t *off)
391{ 391{
392 int ret; 392 int ret;
393 mm_segment_t old_fs; 393 mm_segment_t old_fs;
diff --git a/fs/btrfs/send.h b/fs/btrfs/send.h
index 8bb18f7ccaa6..48d425aef05b 100644
--- a/fs/btrfs/send.h
+++ b/fs/btrfs/send.h
@@ -131,5 +131,4 @@ enum {
131 131
132#ifdef __KERNEL__ 132#ifdef __KERNEL__
133long btrfs_ioctl_send(struct file *mnt_file, void __user *arg); 133long btrfs_ioctl_send(struct file *mnt_file, void __user *arg);
134int write_buf(struct file *filp, const void *buf, u32 len, loff_t *off);
135#endif 134#endif
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 18d6fb7be265..0544587d74f4 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -34,7 +34,7 @@
34 34
35#define BTRFS_ROOT_TRANS_TAG 0 35#define BTRFS_ROOT_TRANS_TAG 0
36 36
37void put_transaction(struct btrfs_transaction *transaction) 37static void put_transaction(struct btrfs_transaction *transaction)
38{ 38{
39 WARN_ON(atomic_read(&transaction->use_count) == 0); 39 WARN_ON(atomic_read(&transaction->use_count) == 0);
40 if (atomic_dec_and_test(&transaction->use_count)) { 40 if (atomic_dec_and_test(&transaction->use_count)) {
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h
index f6edd5e6baa3..24c97335a59f 100644
--- a/fs/btrfs/transaction.h
+++ b/fs/btrfs/transaction.h
@@ -146,5 +146,4 @@ int btrfs_wait_marked_extents(struct btrfs_root *root,
146 struct extent_io_tree *dirty_pages, int mark); 146 struct extent_io_tree *dirty_pages, int mark);
147int btrfs_transaction_blocked(struct btrfs_fs_info *info); 147int btrfs_transaction_blocked(struct btrfs_fs_info *info);
148int btrfs_transaction_in_commit(struct btrfs_fs_info *info); 148int btrfs_transaction_in_commit(struct btrfs_fs_info *info);
149void put_transaction(struct btrfs_transaction *transaction);
150#endif 149#endif
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 705aee6bd15b..c276ac9a0ec3 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3839,9 +3839,9 @@ out:
3839 * only logging is done of any parent directories that are older than 3839 * only logging is done of any parent directories that are older than
3840 * the last committed transaction 3840 * the last committed transaction
3841 */ 3841 */
3842int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, 3842static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
3843 struct btrfs_root *root, struct inode *inode, 3843 struct btrfs_root *root, struct inode *inode,
3844 struct dentry *parent, int exists_only) 3844 struct dentry *parent, int exists_only)
3845{ 3845{
3846 int inode_only = exists_only ? LOG_INODE_EXISTS : LOG_INODE_ALL; 3846 int inode_only = exists_only ? LOG_INODE_EXISTS : LOG_INODE_ALL;
3847 struct super_block *sb; 3847 struct super_block *sb;
diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h
index 862ac813f6b8..1d4ae0d15a70 100644
--- a/fs/btrfs/tree-log.h
+++ b/fs/btrfs/tree-log.h
@@ -40,9 +40,6 @@ int btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
40 struct inode *inode, u64 dirid); 40 struct inode *inode, u64 dirid);
41void btrfs_end_log_trans(struct btrfs_root *root); 41void btrfs_end_log_trans(struct btrfs_root *root);
42int btrfs_pin_log_trans(struct btrfs_root *root); 42int btrfs_pin_log_trans(struct btrfs_root *root);
43int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
44 struct btrfs_root *root, struct inode *inode,
45 struct dentry *parent, int exists_only);
46void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans, 43void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
47 struct inode *dir, struct inode *inode, 44 struct inode *dir, struct inode *inode,
48 int for_rename); 45 int for_rename);
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index c1a22178c6e8..a191bac31d85 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -46,6 +46,7 @@ static int init_first_rw_device(struct btrfs_trans_handle *trans,
46 struct btrfs_device *device); 46 struct btrfs_device *device);
47static int btrfs_relocate_sys_chunks(struct btrfs_root *root); 47static int btrfs_relocate_sys_chunks(struct btrfs_root *root);
48static void __btrfs_reset_dev_stats(struct btrfs_device *dev); 48static void __btrfs_reset_dev_stats(struct btrfs_device *dev);
49static void btrfs_dev_stat_print_on_error(struct btrfs_device *dev);
49static void btrfs_dev_stat_print_on_load(struct btrfs_device *device); 50static void btrfs_dev_stat_print_on_load(struct btrfs_device *device);
50 51
51static DEFINE_MUTEX(uuid_mutex); 52static DEFINE_MUTEX(uuid_mutex);
@@ -1199,10 +1200,10 @@ out:
1199 return ret; 1200 return ret;
1200} 1201}
1201 1202
1202int btrfs_alloc_dev_extent(struct btrfs_trans_handle *trans, 1203static int btrfs_alloc_dev_extent(struct btrfs_trans_handle *trans,
1203 struct btrfs_device *device, 1204 struct btrfs_device *device,
1204 u64 chunk_tree, u64 chunk_objectid, 1205 u64 chunk_tree, u64 chunk_objectid,
1205 u64 chunk_offset, u64 start, u64 num_bytes) 1206 u64 chunk_offset, u64 start, u64 num_bytes)
1206{ 1207{
1207 int ret; 1208 int ret;
1208 struct btrfs_path *path; 1209 struct btrfs_path *path;
@@ -1329,9 +1330,9 @@ error:
1329 * the device information is stored in the chunk root 1330 * the device information is stored in the chunk root
1330 * the btrfs_device struct should be fully filled in 1331 * the btrfs_device struct should be fully filled in
1331 */ 1332 */
1332int btrfs_add_device(struct btrfs_trans_handle *trans, 1333static int btrfs_add_device(struct btrfs_trans_handle *trans,
1333 struct btrfs_root *root, 1334 struct btrfs_root *root,
1334 struct btrfs_device *device) 1335 struct btrfs_device *device)
1335{ 1336{
1336 int ret; 1337 int ret;
1337 struct btrfs_path *path; 1338 struct btrfs_path *path;
@@ -1710,8 +1711,8 @@ void btrfs_destroy_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
1710 mutex_unlock(&fs_info->fs_devices->device_list_mutex); 1711 mutex_unlock(&fs_info->fs_devices->device_list_mutex);
1711} 1712}
1712 1713
1713int btrfs_find_device_by_path(struct btrfs_root *root, char *device_path, 1714static int btrfs_find_device_by_path(struct btrfs_root *root, char *device_path,
1714 struct btrfs_device **device) 1715 struct btrfs_device **device)
1715{ 1716{
1716 int ret = 0; 1717 int ret = 0;
1717 struct btrfs_super_block *disk_super; 1718 struct btrfs_super_block *disk_super;
@@ -3607,7 +3608,7 @@ static int btrfs_cmp_device_info(const void *a, const void *b)
3607 return 0; 3608 return 0;
3608} 3609}
3609 3610
3610struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES] = { 3611static struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES] = {
3611 [BTRFS_RAID_RAID10] = { 3612 [BTRFS_RAID_RAID10] = {
3612 .sub_stripes = 2, 3613 .sub_stripes = 2,
3613 .dev_stripes = 1, 3614 .dev_stripes = 1,
@@ -5120,9 +5121,9 @@ struct async_sched {
5120 * This will add one bio to the pending list for a device and make sure 5121 * This will add one bio to the pending list for a device and make sure
5121 * the work struct is scheduled. 5122 * the work struct is scheduled.
5122 */ 5123 */
5123noinline void btrfs_schedule_bio(struct btrfs_root *root, 5124static noinline void btrfs_schedule_bio(struct btrfs_root *root,
5124 struct btrfs_device *device, 5125 struct btrfs_device *device,
5125 int rw, struct bio *bio) 5126 int rw, struct bio *bio)
5126{ 5127{
5127 int should_queue = 1; 5128 int should_queue = 1;
5128 struct btrfs_pending_bios *pending_bios; 5129 struct btrfs_pending_bios *pending_bios;
@@ -5940,7 +5941,7 @@ void btrfs_dev_stat_inc_and_print(struct btrfs_device *dev, int index)
5940 btrfs_dev_stat_print_on_error(dev); 5941 btrfs_dev_stat_print_on_error(dev);
5941} 5942}
5942 5943
5943void btrfs_dev_stat_print_on_error(struct btrfs_device *dev) 5944static void btrfs_dev_stat_print_on_error(struct btrfs_device *dev)
5944{ 5945{
5945 if (!dev->dev_stats_valid) 5946 if (!dev->dev_stats_valid)
5946 return; 5947 return;
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 062d8604d35b..845ccbb0d2e3 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -254,10 +254,6 @@ int btrfs_account_dev_extents_size(struct btrfs_device *device, u64 start,
254#define btrfs_bio_size(n) (sizeof(struct btrfs_bio) + \ 254#define btrfs_bio_size(n) (sizeof(struct btrfs_bio) + \
255 (sizeof(struct btrfs_bio_stripe) * (n))) 255 (sizeof(struct btrfs_bio_stripe) * (n)))
256 256
257int btrfs_alloc_dev_extent(struct btrfs_trans_handle *trans,
258 struct btrfs_device *device,
259 u64 chunk_tree, u64 chunk_objectid,
260 u64 chunk_offset, u64 start, u64 num_bytes);
261int btrfs_map_block(struct btrfs_fs_info *fs_info, int rw, 257int btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
262 u64 logical, u64 *length, 258 u64 logical, u64 *length,
263 struct btrfs_bio **bbio_ret, int mirror_num); 259 struct btrfs_bio **bbio_ret, int mirror_num);
@@ -282,11 +278,6 @@ void btrfs_close_extra_devices(struct btrfs_fs_info *fs_info,
282int btrfs_find_device_missing_or_by_path(struct btrfs_root *root, 278int btrfs_find_device_missing_or_by_path(struct btrfs_root *root,
283 char *device_path, 279 char *device_path,
284 struct btrfs_device **device); 280 struct btrfs_device **device);
285int btrfs_find_device_by_path(struct btrfs_root *root, char *device_path,
286 struct btrfs_device **device);
287int btrfs_add_device(struct btrfs_trans_handle *trans,
288 struct btrfs_root *root,
289 struct btrfs_device *device);
290int btrfs_rm_device(struct btrfs_root *root, char *device_path); 281int btrfs_rm_device(struct btrfs_root *root, char *device_path);
291void btrfs_cleanup_fs_uuids(void); 282void btrfs_cleanup_fs_uuids(void);
292int btrfs_num_copies(struct btrfs_fs_info *fs_info, u64 logical, u64 len); 283int btrfs_num_copies(struct btrfs_fs_info *fs_info, u64 logical, u64 len);
@@ -307,7 +298,6 @@ int btrfs_cancel_balance(struct btrfs_fs_info *fs_info);
307int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset); 298int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset);
308int find_free_dev_extent(struct btrfs_device *device, u64 num_bytes, 299int find_free_dev_extent(struct btrfs_device *device, u64 num_bytes,
309 u64 *start, u64 *max_avail); 300 u64 *start, u64 *max_avail);
310void btrfs_dev_stat_print_on_error(struct btrfs_device *device);
311void btrfs_dev_stat_inc_and_print(struct btrfs_device *dev, int index); 301void btrfs_dev_stat_inc_and_print(struct btrfs_device *dev, int index);
312int btrfs_get_dev_stats(struct btrfs_root *root, 302int btrfs_get_dev_stats(struct btrfs_root *root,
313 struct btrfs_ioctl_get_dev_stats *stats); 303 struct btrfs_ioctl_get_dev_stats *stats);
@@ -321,9 +311,6 @@ void btrfs_destroy_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
321void btrfs_init_dev_replace_tgtdev_for_resume(struct btrfs_fs_info *fs_info, 311void btrfs_init_dev_replace_tgtdev_for_resume(struct btrfs_fs_info *fs_info,
322 struct btrfs_device *tgtdev); 312 struct btrfs_device *tgtdev);
323int btrfs_scratch_superblock(struct btrfs_device *device); 313int btrfs_scratch_superblock(struct btrfs_device *device);
324void btrfs_schedule_bio(struct btrfs_root *root,
325 struct btrfs_device *device,
326 int rw, struct bio *bio);
327int btrfs_is_parity_mirror(struct btrfs_mapping_tree *map_tree, 314int btrfs_is_parity_mirror(struct btrfs_mapping_tree *map_tree,
328 u64 logical, u64 len, int mirror_num); 315 u64 logical, u64 len, int mirror_num);
329unsigned long btrfs_full_stripe_len(struct btrfs_root *root, 316unsigned long btrfs_full_stripe_len(struct btrfs_root *root,
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index 446a6848c554..05740b9789e4 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -406,8 +406,8 @@ int btrfs_removexattr(struct dentry *dentry, const char *name)
406 XATTR_REPLACE); 406 XATTR_REPLACE);
407} 407}
408 408
409int btrfs_initxattrs(struct inode *inode, const struct xattr *xattr_array, 409static int btrfs_initxattrs(struct inode *inode,
410 void *fs_info) 410 const struct xattr *xattr_array, void *fs_info)
411{ 411{
412 const struct xattr *xattr; 412 const struct xattr *xattr;
413 struct btrfs_trans_handle *trans = fs_info; 413 struct btrfs_trans_handle *trans = fs_info;