btrfs: cleanup unusable parameters from ctree.h
diff mbox

Message ID 1451085669-5009-1-git-send-email-ticaiolima@gmail.com
State New
Headers show

Commit Message

Caio Lima Dec. 25, 2015, 11:21 p.m. UTC
Cleanup of ununsed parameters in btrfs_header_chunk_tree_uuid, btrfs_leaf_data and btrfs_defrag_cancelled

Signed-off-by: Caio Lima <ticaiolima@gmail.com>
---
 fs/btrfs/ctree.c       | 46 +++++++++++++++++++++++-----------------------
 fs/btrfs/ctree.h       | 10 +++++-----
 fs/btrfs/disk-io.c     |  4 ++--
 fs/btrfs/ioctl.c       |  4 ++--
 fs/btrfs/transaction.c |  2 +-
 5 files changed, 33 insertions(+), 33 deletions(-)

Comments

David Sterba Jan. 26, 2016, 3:57 p.m. UTC | #1
On Fri, Dec 25, 2015 at 06:21:09PM -0500, Caio Lima wrote:
> Cleanup of ununsed parameters in btrfs_header_chunk_tree_uuid,
> btrfs_leaf_data and btrfs_defrag_cancelled

The parameters are unused so the question is what are the functions
supposed to do. They just return offset within the header or leaf
structures.

Adding the _offset to the current function names would make them too
long, I suggest to opencode the 'offsetof(struct ..., member)' instead.
We do that anyway in many places.

Please keep btrfs_defrag_cancelled as-is for now.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 5b8e235..59b9bfe 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -3366,7 +3366,7 @@  static noinline int insert_new_root(struct btrfs_trans_handle *trans,
 			    BTRFS_FSID_SIZE);
 
 	write_extent_buffer(c, root->fs_info->chunk_tree_uuid,
-			    btrfs_header_chunk_tree_uuid(c), BTRFS_UUID_SIZE);
+			    btrfs_header_chunk_tree_uuid(), BTRFS_UUID_SIZE);
 
 	btrfs_set_node_key(c, &lower_key, 0);
 	btrfs_set_node_blockptr(c, 0, lower->start);
@@ -3502,7 +3502,7 @@  static noinline int split_node(struct btrfs_trans_handle *trans,
 	write_extent_buffer(split, root->fs_info->fsid,
 			    btrfs_header_fsid(), BTRFS_FSID_SIZE);
 	write_extent_buffer(split, root->fs_info->chunk_tree_uuid,
-			    btrfs_header_chunk_tree_uuid(split),
+			    btrfs_header_chunk_tree_uuid(),
 			    BTRFS_UUID_SIZE);
 
 	ret = tree_mod_log_eb_copy(root->fs_info, split, c, 0,
@@ -3664,14 +3664,14 @@  static noinline int __push_leaf_right(struct btrfs_trans_handle *trans,
 	/* make room in the right data area */
 	data_end = leaf_data_end(root, right);
 	memmove_extent_buffer(right,
-			      btrfs_leaf_data(right) + data_end - push_space,
-			      btrfs_leaf_data(right) + data_end,
+			      btrfs_leaf_data() + data_end - push_space,
+			      btrfs_leaf_data() + data_end,
 			      BTRFS_LEAF_DATA_SIZE(root) - data_end);
 
 	/* copy from the left data area */
-	copy_extent_buffer(right, left, btrfs_leaf_data(right) +
+	copy_extent_buffer(right, left, btrfs_leaf_data() +
 		     BTRFS_LEAF_DATA_SIZE(root) - push_space,
-		     btrfs_leaf_data(left) + leaf_data_end(root, left),
+		     btrfs_leaf_data() + leaf_data_end(root, left),
 		     push_space);
 
 	memmove_extent_buffer(right, btrfs_item_nr_offset(push_items),
@@ -3881,9 +3881,9 @@  static noinline int __push_leaf_left(struct btrfs_trans_handle *trans,
 	push_space = BTRFS_LEAF_DATA_SIZE(root) -
 		     btrfs_item_offset_nr(right, push_items - 1);
 
-	copy_extent_buffer(left, right, btrfs_leaf_data(left) +
+	copy_extent_buffer(left, right, btrfs_leaf_data() +
 		     leaf_data_end(root, left) - push_space,
-		     btrfs_leaf_data(right) +
+		     btrfs_leaf_data() +
 		     btrfs_item_offset_nr(right, push_items - 1),
 		     push_space);
 	old_left_nritems = btrfs_header_nritems(left);
@@ -3910,9 +3910,9 @@  static noinline int __push_leaf_left(struct btrfs_trans_handle *trans,
 	if (push_items < right_nritems) {
 		push_space = btrfs_item_offset_nr(right, push_items - 1) -
 						  leaf_data_end(root, right);
-		memmove_extent_buffer(right, btrfs_leaf_data(right) +
+		memmove_extent_buffer(right, btrfs_leaf_data() +
 				      BTRFS_LEAF_DATA_SIZE(root) - push_space,
-				      btrfs_leaf_data(right) +
+				      btrfs_leaf_data() +
 				      leaf_data_end(root, right), push_space);
 
 		memmove_extent_buffer(right, btrfs_item_nr_offset(0),
@@ -4057,8 +4057,8 @@  static noinline void copy_for_split(struct btrfs_trans_handle *trans,
 			   nritems * sizeof(struct btrfs_item));
 
 	copy_extent_buffer(right, l,
-		     btrfs_leaf_data(right) + BTRFS_LEAF_DATA_SIZE(root) -
-		     data_copy_size, btrfs_leaf_data(l) +
+		     btrfs_leaf_data() + BTRFS_LEAF_DATA_SIZE(root) -
+		     data_copy_size, btrfs_leaf_data() +
 		     leaf_data_end(root, l), data_copy_size);
 
 	rt_data_off = BTRFS_LEAF_DATA_SIZE(root) -
@@ -4283,7 +4283,7 @@  again:
 			    btrfs_header_fsid(), BTRFS_FSID_SIZE);
 
 	write_extent_buffer(right, fs_info->chunk_tree_uuid,
-			    btrfs_header_chunk_tree_uuid(right),
+			    btrfs_header_chunk_tree_uuid(),
 			    BTRFS_UUID_SIZE);
 
 	if (split == 0) {
@@ -4588,8 +4588,8 @@  void btrfs_truncate_item(struct btrfs_root *root, struct btrfs_path *path,
 
 	/* shift the data */
 	if (from_end) {
-		memmove_extent_buffer(leaf, btrfs_leaf_data(leaf) +
-			      data_end + size_diff, btrfs_leaf_data(leaf) +
+		memmove_extent_buffer(leaf, btrfs_leaf_data() +
+			      data_end + size_diff, btrfs_leaf_data() +
 			      data_end, old_data_start + new_size - data_end);
 	} else {
 		struct btrfs_disk_key disk_key;
@@ -4615,8 +4615,8 @@  void btrfs_truncate_item(struct btrfs_root *root, struct btrfs_path *path,
 			}
 		}
 
-		memmove_extent_buffer(leaf, btrfs_leaf_data(leaf) +
-			      data_end + size_diff, btrfs_leaf_data(leaf) +
+		memmove_extent_buffer(leaf, btrfs_leaf_data() +
+			      data_end + size_diff, btrfs_leaf_data() +
 			      data_end, old_data_start - data_end);
 
 		offset = btrfs_disk_key_offset(&disk_key);
@@ -4688,8 +4688,8 @@  void btrfs_extend_item(struct btrfs_root *root, struct btrfs_path *path,
 	}
 
 	/* shift the data */
-	memmove_extent_buffer(leaf, btrfs_leaf_data(leaf) +
-		      data_end - data_size, btrfs_leaf_data(leaf) +
+	memmove_extent_buffer(leaf, btrfs_leaf_data() +
+		      data_end - data_size, btrfs_leaf_data() +
 		      data_end, old_data - data_end);
 
 	data_end = old_data;
@@ -4770,8 +4770,8 @@  void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *path,
 			      (nritems - slot) * sizeof(struct btrfs_item));
 
 		/* shift the data */
-		memmove_extent_buffer(leaf, btrfs_leaf_data(leaf) +
-			      data_end - total_data, btrfs_leaf_data(leaf) +
+		memmove_extent_buffer(leaf, btrfs_leaf_data() +
+			      data_end - total_data, btrfs_leaf_data() +
 			      data_end, old_data - data_end);
 		data_end = old_data;
 	}
@@ -4961,9 +4961,9 @@  int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
 	if (slot + nr != nritems) {
 		int data_end = leaf_data_end(root, leaf);
 
-		memmove_extent_buffer(leaf, btrfs_leaf_data(leaf) +
+		memmove_extent_buffer(leaf, btrfs_leaf_data() +
 			      data_end + dsize,
-			      btrfs_leaf_data(leaf) + data_end,
+			      btrfs_leaf_data() + data_end,
 			      last_off - data_end);
 
 		for (i = slot + nr; i < nritems; i++) {
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 35489e7..4412cbc 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2910,7 +2910,7 @@  static inline unsigned long btrfs_header_fsid(void)
 	return offsetof(struct btrfs_header, fsid);
 }
 
-static inline unsigned long btrfs_header_chunk_tree_uuid(struct extent_buffer *eb)
+static inline unsigned long btrfs_header_chunk_tree_uuid(void)
 {
 	return offsetof(struct btrfs_header, chunk_tree_uuid);
 }
@@ -3148,7 +3148,7 @@  static inline int btrfs_super_csum_size(struct btrfs_super_block *s)
 	return btrfs_csum_sizes[t];
 }
 
-static inline unsigned long btrfs_leaf_data(struct extent_buffer *l)
+static inline unsigned long btrfs_leaf_data(void)
 {
 	return offsetof(struct btrfs_leaf, items);
 }
@@ -3352,11 +3352,11 @@  static inline struct btrfs_fs_info *btrfs_sb(struct super_block *sb)
 
 /* helper function to cast into the data area of the leaf. */
 #define btrfs_item_ptr(leaf, slot, type) \
-	((type *)(btrfs_leaf_data(leaf) + \
+	((type *)(btrfs_leaf_data() + \
 	btrfs_item_offset_nr(leaf, slot)))
 
 #define btrfs_item_ptr_offset(leaf, slot) \
-	((unsigned long)(btrfs_leaf_data(leaf) + \
+	((unsigned long)(btrfs_leaf_data() + \
 	btrfs_item_offset_nr(leaf, slot)))
 
 static inline bool btrfs_mixed_space_info(struct btrfs_space_info *space_info)
@@ -4374,7 +4374,7 @@  static inline int is_fstree(u64 rootid)
 	return 0;
 }
 
-static inline int btrfs_defrag_cancelled(struct btrfs_fs_info *fs_info)
+static inline int btrfs_defrag_cancelled(void)
 {
 	return signal_pending(current);
 }
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 974be09..80ddaaf 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1351,7 +1351,7 @@  struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
 	write_extent_buffer(leaf, fs_info->fsid, btrfs_header_fsid(),
 			    BTRFS_FSID_SIZE);
 	write_extent_buffer(leaf, fs_info->chunk_tree_uuid,
-			    btrfs_header_chunk_tree_uuid(leaf),
+			    btrfs_header_chunk_tree_uuid(),
 			    BTRFS_UUID_SIZE);
 	btrfs_mark_buffer_dirty(leaf);
 
@@ -2859,7 +2859,7 @@  int open_ctree(struct super_block *sb,
 	chunk_root->commit_root = btrfs_root_node(chunk_root);
 
 	read_extent_buffer(chunk_root->node, fs_info->chunk_tree_uuid,
-	   btrfs_header_chunk_tree_uuid(chunk_root->node), BTRFS_UUID_SIZE);
+	   btrfs_header_chunk_tree_uuid(), BTRFS_UUID_SIZE);
 
 	ret = btrfs_read_chunk_tree(chunk_root);
 	if (ret) {
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index da94138..678d6ff 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -503,7 +503,7 @@  static noinline int create_subvol(struct inode *dir,
 	write_extent_buffer(leaf, root->fs_info->fsid, btrfs_header_fsid(),
 			    BTRFS_FSID_SIZE);
 	write_extent_buffer(leaf, root->fs_info->chunk_tree_uuid,
-			    btrfs_header_chunk_tree_uuid(leaf),
+			    btrfs_header_chunk_tree_uuid(),
 			    BTRFS_UUID_SIZE);
 	btrfs_mark_buffer_dirty(leaf);
 
@@ -1345,7 +1345,7 @@  int btrfs_defrag_file(struct inode *inode, struct file *file,
 		if (!(inode->i_sb->s_flags & MS_ACTIVE))
 			break;
 
-		if (btrfs_defrag_cancelled(root->fs_info)) {
+		if (btrfs_defrag_cancelled()) {
 			btrfs_debug(root->fs_info, "defrag_file cancelled");
 			ret = -EAGAIN;
 			break;
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index be8eae8..c7ae477 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1276,7 +1276,7 @@  int btrfs_defrag_root(struct btrfs_root *root)
 		if (btrfs_fs_closing(root->fs_info) || ret != -EAGAIN)
 			break;
 
-		if (btrfs_defrag_cancelled(root->fs_info)) {
+		if (btrfs_defrag_cancelled()) {
 			pr_debug("BTRFS: defrag_root cancelled\n");
 			ret = -EAGAIN;
 			break;