linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] More structure shrinking and cleanups
@ 2018-07-20 14:30 David Sterba
  2018-07-20 14:30 ` [PATCH 1/4] btrfs: remove unused member btrfs_root::name David Sterba
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: David Sterba @ 2018-07-20 14:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

A few more structure member leftovers spotted, and some trivial cleanups.

David Sterba (4):
  btrfs: remove unused member btrfs_root::name
  btrfs: dev-replace: remove unused members of btrfs_dev_replace
  btrfs: constify strings passed to assertion helper
  btrfs: merge free_fs_root helpers

 fs/btrfs/ctree.h   |  5 +----
 fs/btrfs/disk-io.c | 20 +++++---------------
 2 files changed, 6 insertions(+), 19 deletions(-)

-- 
2.18.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/4] btrfs: remove unused member btrfs_root::name
  2018-07-20 14:30 [PATCH 0/4] More structure shrinking and cleanups David Sterba
@ 2018-07-20 14:30 ` David Sterba
  2018-07-20 14:30 ` [PATCH 2/4] btrfs: dev-replace: remove unused members of btrfs_dev_replace David Sterba
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2018-07-20 14:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Added in 58176a9604c ("Btrfs: Add per-root block accounting and sysfs
entries") in 2007, the roots had names exported in sysfs. The code
was commented out in 4df27c4d5cc1dda54ed ("Btrfs: change how subvolumes
are organized") and cleaned by 182608c8294b5fe9 ("btrfs: remove old
unused commented out code").

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/ctree.h   | 1 -
 fs/btrfs/disk-io.c | 2 --
 2 files changed, 3 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 9c638931b75e..4ca6c4e141ea 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1219,7 +1219,6 @@ struct btrfs_root {
 	u64 defrag_trans_start;
 	struct btrfs_key defrag_progress;
 	struct btrfs_key defrag_max;
-	char *name;
 
 	/* the dirty list is only used by non-reference counted roots */
 	struct list_head dirty_list;
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 9b208ccf24fe..3830867e0225 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1154,7 +1154,6 @@ static void __setup_root(struct btrfs_root *root, struct btrfs_fs_info *fs_info,
 	root->highest_objectid = 0;
 	root->nr_delalloc_inodes = 0;
 	root->nr_ordered_extents = 0;
-	root->name = NULL;
 	root->inode_tree = RB_ROOT;
 	INIT_RADIX_TREE(&root->delayed_nodes_tree, GFP_ATOMIC);
 	root->block_rsv = NULL;
@@ -3849,7 +3848,6 @@ static void free_fs_root(struct btrfs_root *root)
 	free_extent_buffer(root->commit_root);
 	kfree(root->free_ino_ctl);
 	kfree(root->free_ino_pinned);
-	kfree(root->name);
 	btrfs_put_fs_root(root);
 }
 
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] btrfs: dev-replace: remove unused members of btrfs_dev_replace
  2018-07-20 14:30 [PATCH 0/4] More structure shrinking and cleanups David Sterba
  2018-07-20 14:30 ` [PATCH 1/4] btrfs: remove unused member btrfs_root::name David Sterba
@ 2018-07-20 14:30 ` David Sterba
  2018-07-20 14:30 ` [PATCH 3/4] btrfs: constify strings passed to assertion helper David Sterba
  2018-07-20 14:30 ` [PATCH 4/4] btrfs: merge free_fs_root helpers David Sterba
  3 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2018-07-20 14:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Lock owner and nesting level have been unused since day 1, probably
copy&pasted from the extent_buffer locking scheme without much thinking.
The locking of device replace is simpler and does not need any lock
nesting.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/ctree.h   | 2 --
 fs/btrfs/disk-io.c | 2 --
 2 files changed, 4 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 4ca6c4e141ea..5f6ec80d374f 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -365,8 +365,6 @@ struct btrfs_dev_replace {
 	struct btrfs_device *srcdev;
 	struct btrfs_device *tgtdev;
 
-	pid_t lock_owner;
-	atomic_t nesting_level;
 	struct mutex lock_finishing_cancel_unmount;
 	rwlock_t lock;
 	atomic_t read_locks;
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 3830867e0225..c1d287a766c1 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2154,8 +2154,6 @@ static void btrfs_init_btree_inode(struct btrfs_fs_info *fs_info)
 
 static void btrfs_init_dev_replace_locks(struct btrfs_fs_info *fs_info)
 {
-	fs_info->dev_replace.lock_owner = 0;
-	atomic_set(&fs_info->dev_replace.nesting_level, 0);
 	mutex_init(&fs_info->dev_replace.lock_finishing_cancel_unmount);
 	rwlock_init(&fs_info->dev_replace.lock);
 	atomic_set(&fs_info->dev_replace.read_locks, 0);
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] btrfs: constify strings passed to assertion helper
  2018-07-20 14:30 [PATCH 0/4] More structure shrinking and cleanups David Sterba
  2018-07-20 14:30 ` [PATCH 1/4] btrfs: remove unused member btrfs_root::name David Sterba
  2018-07-20 14:30 ` [PATCH 2/4] btrfs: dev-replace: remove unused members of btrfs_dev_replace David Sterba
@ 2018-07-20 14:30 ` David Sterba
  2018-07-20 14:30 ` [PATCH 4/4] btrfs: merge free_fs_root helpers David Sterba
  3 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2018-07-20 14:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/ctree.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 5f6ec80d374f..2e32584c635f 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3425,7 +3425,7 @@ do {								\
 #ifdef CONFIG_BTRFS_ASSERT
 
 __cold
-static inline void assfail(char *expr, char *file, int line)
+static inline void assfail(const char *expr, const char *file, int line)
 {
 	pr_err("assertion failed: %s, file: %s, line: %d\n",
 	       expr, file, line);
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] btrfs: merge free_fs_root helpers
  2018-07-20 14:30 [PATCH 0/4] More structure shrinking and cleanups David Sterba
                   ` (2 preceding siblings ...)
  2018-07-20 14:30 ` [PATCH 3/4] btrfs: constify strings passed to assertion helper David Sterba
@ 2018-07-20 14:30 ` David Sterba
  3 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2018-07-20 14:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The exported helper just calls the static one. There's no obvious reason
to have them separate eg. for performance reasons where the static one
could be better optimized in the same unit. There's a slight decrease in
code size and stack consumption.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/disk-io.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index c1d287a766c1..468365dd3b59 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -52,7 +52,6 @@
 
 static const struct extent_io_ops btree_extent_io_ops;
 static void end_workqueue_fn(struct btrfs_work *work);
-static void free_fs_root(struct btrfs_root *root);
 static void btrfs_destroy_ordered_extents(struct btrfs_root *root);
 static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
 				      struct btrfs_fs_info *fs_info);
@@ -1504,7 +1503,7 @@ int btrfs_init_fs_root(struct btrfs_root *root)
 
 	return 0;
 fail:
-	/* the caller is responsible to call free_fs_root */
+	/* the caller is responsible to call btrfs_free_fs_root */
 	return ret;
 }
 
@@ -1609,14 +1608,14 @@ struct btrfs_root *btrfs_get_fs_root(struct btrfs_fs_info *fs_info,
 	ret = btrfs_insert_fs_root(fs_info, root);
 	if (ret) {
 		if (ret == -EEXIST) {
-			free_fs_root(root);
+			btrfs_free_fs_root(root);
 			goto again;
 		}
 		goto fail;
 	}
 	return root;
 fail:
-	free_fs_root(root);
+	btrfs_free_fs_root(root);
 	return ERR_PTR(ret);
 }
 
@@ -3831,10 +3830,10 @@ void btrfs_drop_and_free_fs_root(struct btrfs_fs_info *fs_info,
 		__btrfs_remove_free_space_cache(root->free_ino_pinned);
 	if (root->free_ino_ctl)
 		__btrfs_remove_free_space_cache(root->free_ino_ctl);
-	free_fs_root(root);
+	btrfs_free_fs_root(root);
 }
 
-static void free_fs_root(struct btrfs_root *root)
+void btrfs_free_fs_root(struct btrfs_root *root)
 {
 	iput(root->ino_cache_inode);
 	WARN_ON(!RB_EMPTY_ROOT(&root->inode_tree));
@@ -3849,11 +3848,6 @@ static void free_fs_root(struct btrfs_root *root)
 	btrfs_put_fs_root(root);
 }
 
-void btrfs_free_fs_root(struct btrfs_root *root)
-{
-	free_fs_root(root);
-}
-
 int btrfs_cleanup_fs_roots(struct btrfs_fs_info *fs_info)
 {
 	u64 root_objectid = 0;
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-07-20 15:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-20 14:30 [PATCH 0/4] More structure shrinking and cleanups David Sterba
2018-07-20 14:30 ` [PATCH 1/4] btrfs: remove unused member btrfs_root::name David Sterba
2018-07-20 14:30 ` [PATCH 2/4] btrfs: dev-replace: remove unused members of btrfs_dev_replace David Sterba
2018-07-20 14:30 ` [PATCH 3/4] btrfs: constify strings passed to assertion helper David Sterba
2018-07-20 14:30 ` [PATCH 4/4] btrfs: merge free_fs_root helpers David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).