Btrfs: remove unused hint byte argument for btrfs_drop_extents
authorJosef Bacik <jbacik@fusionio.com>
Wed, 29 Aug 2012 16:24:27 +0000 (12:24 -0400)
committerChris Mason <chris.mason@fusionio.com>
Mon, 1 Oct 2012 19:19:06 +0000 (15:19 -0400)
I audited all users of btrfs_drop_extents and found that nobody actually uses
the hint_byte argument.  I'm sure it was used for something at some point but
it's not used now, and the way the pinning works the disk bytenr would never be
immediately useful anyway so lets just remove it.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/ctree.h
fs/btrfs/file.c
fs/btrfs/inode.c
fs/btrfs/ioctl.c
fs/btrfs/tree-log.c

index 81c772b5dc8ec43a8d5bc040c26854ae1742c800..71d6ff13d76eff6aa75ab19cbfd5b28dcf6f8183 100644 (file)
@@ -3323,10 +3323,10 @@ extern const struct file_operations btrfs_file_operations;
 int __btrfs_drop_extents(struct btrfs_trans_handle *trans,
                         struct btrfs_root *root, struct inode *inode,
                         struct btrfs_path *path, u64 start, u64 end,
-                        u64 *hint_byte, int drop_cache);
+                        int drop_cache);
 int btrfs_drop_extents(struct btrfs_trans_handle *trans,
                       struct btrfs_root *root, struct inode *inode, u64 start,
-                      u64 end, u64 *hint_byte, int drop_cache);
+                      u64 end, int drop_cache);
 int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
                              struct inode *inode, u64 start, u64 end);
 int btrfs_release_file(struct inode *inode, struct file *file);
index 399f9d71a92674e43551bc9540632f590b1adce6..58598c249951fe030f660272b0adb3cab4dbad6f 100644 (file)
@@ -584,7 +584,7 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
 int __btrfs_drop_extents(struct btrfs_trans_handle *trans,
                         struct btrfs_root *root, struct inode *inode,
                         struct btrfs_path *path, u64 start, u64 end,
-                        u64 *hint_byte, int drop_cache)
+                        int drop_cache)
 {
        struct extent_buffer *leaf;
        struct btrfs_file_extent_item *fi;
@@ -716,7 +716,6 @@ next_slot:
                                                new_key.objectid,
                                                start - extent_offset, 0);
                                BUG_ON(ret); /* -ENOMEM */
-                               *hint_byte = disk_bytenr;
                        }
                        key.offset = start;
                }
@@ -736,10 +735,8 @@ next_slot:
                        btrfs_set_file_extent_num_bytes(leaf, fi,
                                                        extent_end - end);
                        btrfs_mark_buffer_dirty(leaf);
-                       if (update_refs && disk_bytenr > 0) {
+                       if (update_refs && disk_bytenr > 0)
                                inode_sub_bytes(inode, end - key.offset);
-                               *hint_byte = disk_bytenr;
-                       }
                        break;
                }
 
@@ -755,10 +752,8 @@ next_slot:
                        btrfs_set_file_extent_num_bytes(leaf, fi,
                                                        start - key.offset);
                        btrfs_mark_buffer_dirty(leaf);
-                       if (update_refs && disk_bytenr > 0) {
+                       if (update_refs && disk_bytenr > 0)
                                inode_sub_bytes(inode, extent_end - start);
-                               *hint_byte = disk_bytenr;
-                       }
                        if (end == extent_end)
                                break;
 
@@ -794,7 +789,6 @@ next_slot:
                                BUG_ON(ret); /* -ENOMEM */
                                inode_sub_bytes(inode,
                                                extent_end - key.offset);
-                               *hint_byte = disk_bytenr;
                        }
 
                        if (end == extent_end)
@@ -834,7 +828,7 @@ next_slot:
 
 int btrfs_drop_extents(struct btrfs_trans_handle *trans,
                       struct btrfs_root *root, struct inode *inode, u64 start,
-                      u64 end, u64 *hint_byte, int drop_cache)
+                      u64 end, int drop_cache)
 {
        struct btrfs_path *path;
        int ret;
@@ -843,7 +837,7 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans,
        if (!path)
                return -ENOMEM;
        ret = __btrfs_drop_extents(trans, root, inode, path, start, end,
-                                  hint_byte, drop_cache);
+                                  drop_cache);
        btrfs_free_path(path);
        return ret;
 }
index 24745b8f2745a1a797cca4151b67785533815117..f0a4792492ed7f41eec63ce0ad69eedb0e9598b1 100644 (file)
@@ -230,7 +230,6 @@ static noinline int cow_file_range_inline(struct btrfs_trans_handle *trans,
        u64 inline_len = actual_end - start;
        u64 aligned_end = (end + root->sectorsize - 1) &
                        ~((u64)root->sectorsize - 1);
-       u64 hint_byte;
        u64 data_len = inline_len;
        int ret;
 
@@ -247,8 +246,7 @@ static noinline int cow_file_range_inline(struct btrfs_trans_handle *trans,
                return 1;
        }
 
-       ret = btrfs_drop_extents(trans, root, inode, start, aligned_end,
-                                &hint_byte, 1);
+       ret = btrfs_drop_extents(trans, root, inode, start, aligned_end, 1);
        if (ret)
                return ret;
 
@@ -1786,7 +1784,6 @@ static int insert_reserved_file_extent(struct btrfs_trans_handle *trans,
        struct btrfs_path *path;
        struct extent_buffer *leaf;
        struct btrfs_key ins;
-       u64 hint;
        int ret;
 
        path = btrfs_alloc_path();
@@ -1805,8 +1802,7 @@ static int insert_reserved_file_extent(struct btrfs_trans_handle *trans,
         * with the others.
         */
        ret = btrfs_drop_extents(trans, root, inode, file_pos,
-                                file_pos + num_bytes,
-                                &hint, 0);
+                                file_pos + num_bytes, 0);
        if (ret)
                goto out;
 
@@ -3629,7 +3625,6 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size)
                last_byte = (last_byte + mask) & ~mask;
                if (!test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) {
                        struct extent_map *hole_em;
-                       u64 hint_byte = 0;
                        hole_size = last_byte - cur_offset;
 
                        trans = btrfs_start_transaction(root, 3);
@@ -3640,8 +3635,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size)
 
                        err = btrfs_drop_extents(trans, root, inode,
                                                 cur_offset,
-                                                cur_offset + hole_size,
-                                                &hint_byte, 1);
+                                                cur_offset + hole_size, 1);
                        if (err) {
                                btrfs_abort_transaction(trans, root, err);
                                btrfs_end_transaction(trans, root);
index 95223222d5ad27eaa149e786f15aacc88f867664..5543fd562b552c3f0bad4156fb012f280012ab29 100644 (file)
@@ -2353,7 +2353,6 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
        int ret;
        u64 len = olen;
        u64 bs = root->fs_info->sb->s_blocksize;
-       u64 hint_byte;
 
        /*
         * TODO:
@@ -2579,7 +2578,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
                                ret = btrfs_drop_extents(trans, root, inode,
                                                         new_key.offset,
                                                         new_key.offset + datal,
-                                                        &hint_byte, 1);
+                                                        1);
                                if (ret) {
                                        btrfs_abort_transaction(trans, root,
                                                                ret);
@@ -2653,7 +2652,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
                                ret = btrfs_drop_extents(trans, root, inode,
                                                         new_key.offset,
                                                         new_key.offset + datal,
-                                                        &hint_byte, 1);
+                                                        1);
                                if (ret) {
                                        btrfs_abort_transaction(trans, root,
                                                                ret);
index 5e2ffb95cc64cfbfd44b21741b21d205e65571dc..0c39f58973db153fd8fcaf5b2e3ec47da830073c 100644 (file)
@@ -485,7 +485,6 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
        int found_type;
        u64 mask = root->sectorsize - 1;
        u64 extent_end;
-       u64 alloc_hint;
        u64 start = key->offset;
        u64 saved_nbytes;
        struct btrfs_file_extent_item *item;
@@ -551,8 +550,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
 
        saved_nbytes = inode_get_bytes(inode);
        /* drop any overlapping extents */
-       ret = btrfs_drop_extents(trans, root, inode, start, extent_end,
-                                &alloc_hint, 1);
+       ret = btrfs_drop_extents(trans, root, inode, start, extent_end, 1);
        BUG_ON(ret);
 
        if (found_type == BTRFS_FILE_EXTENT_REG ||
@@ -2843,9 +2841,8 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
        int ret;
 
        if (BTRFS_I(inode)->logged_trans == trans->transid) {
-               u64 tmp;
                ret = __btrfs_drop_extents(trans, log, inode, dst_path, start,
-                                          start + len, &tmp, 0);
+                                          start + len, 0);
                if (ret)
                        return ret;
        }