btrfs: make static code static & remove dead code
[deliverable/linux.git] / fs / btrfs / inode.c
index 33a9e9da726d51f0d9b2f994eb06b0e945219e06..ec63d7af34601a9b92540fac02c2bc73f1779580 100644 (file)
@@ -103,6 +103,8 @@ static struct extent_map *create_pinned_em(struct inode *inode, u64 start,
                                           u64 orig_block_len, u64 ram_bytes,
                                           int type);
 
+static int btrfs_dirty_inode(struct inode *inode);
+
 static int btrfs_init_inode_security(struct btrfs_trans_handle *trans,
                                     struct inode *inode,  struct inode *dir,
                                     const struct qstr *qstr)
@@ -920,7 +922,8 @@ static noinline int __cow_file_range(struct btrfs_trans_handle *trans,
                }
 
                em = alloc_extent_map();
-               BUG_ON(!em); /* -ENOMEM */
+               if (!em)
+                       goto out_reserve;
                em->start = start;
                em->orig_start = em->start;
                ram_size = ins.offset;
@@ -947,11 +950,14 @@ static noinline int __cow_file_range(struct btrfs_trans_handle *trans,
                        btrfs_drop_extent_cache(inode, start,
                                                start + ram_size - 1, 0);
                }
+               if (ret)
+                       goto out_reserve;
 
                cur_alloc_size = ins.offset;
                ret = btrfs_add_ordered_extent(inode, start, ins.objectid,
                                               ram_size, cur_alloc_size, 0);
-               BUG_ON(ret); /* -ENOMEM */
+               if (ret)
+                       goto out_reserve;
 
                if (root->root_key.objectid ==
                    BTRFS_DATA_RELOC_TREE_OBJECTID) {
@@ -959,7 +965,7 @@ static noinline int __cow_file_range(struct btrfs_trans_handle *trans,
                                                      cur_alloc_size);
                        if (ret) {
                                btrfs_abort_transaction(trans, root, ret);
-                               goto out_unlock;
+                               goto out_reserve;
                        }
                }
 
@@ -988,6 +994,8 @@ static noinline int __cow_file_range(struct btrfs_trans_handle *trans,
 out:
        return ret;
 
+out_reserve:
+       btrfs_free_reserved_extent(root, ins.objectid, ins.offset);
 out_unlock:
        extent_clear_unlock_delalloc(inode,
                     &BTRFS_I(inode)->io_tree,
@@ -3018,7 +3026,8 @@ int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode)
  * We have done the truncate/delete so we can go ahead and remove the orphan
  * item for this particular inode.
  */
-int btrfs_orphan_del(struct btrfs_trans_handle *trans, struct inode *inode)
+static int btrfs_orphan_del(struct btrfs_trans_handle *trans,
+                           struct inode *inode)
 {
        struct btrfs_root *root = BTRFS_I(inode)->root;
        int delete_item = 0;
@@ -5336,7 +5345,7 @@ int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc)
  * FIXME, needs more benchmarking...there are no reasons other than performance
  * to keep or drop this code.
  */
-int btrfs_dirty_inode(struct inode *inode)
+static int btrfs_dirty_inode(struct inode *inode)
 {
        struct btrfs_root *root = BTRFS_I(inode)->root;
        struct btrfs_trans_handle *trans;
@@ -7431,8 +7440,8 @@ static int btrfs_writepage(struct page *page, struct writeback_control *wbc)
        return extent_write_full_page(tree, page, btrfs_get_extent, wbc);
 }
 
-int btrfs_writepages(struct address_space *mapping,
-                    struct writeback_control *wbc)
+static int btrfs_writepages(struct address_space *mapping,
+                           struct writeback_control *wbc)
 {
        struct extent_io_tree *tree;
 
This page took 0.040492 seconds and 5 git commands to generate.