linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH 09/17] btrfs: move btrfs_chunk_item_size out of ctree.h
Date: Wed, 14 Sep 2022 11:06:33 -0400	[thread overview]
Message-ID: <3744e0ae6f8087daa9608174aeee00c53732f8bb.1663167823.git.josef@toxicpanda.com> (raw)
In-Reply-To: <cover.1663167823.git.josef@toxicpanda.com>

This is more of a volumes related helper, additionally it has a BUG_ON()
which isn't defined in the related header.  Move the code to volumes.c,
change the BUG_ON() to an ASSERT(), and move the prototype to volumes.h.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/ctree.h   | 7 -------
 fs/btrfs/volumes.c | 7 +++++++
 fs/btrfs/volumes.h | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 2e6a947a48de..60f8817f5b7c 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -58,13 +58,6 @@ struct btrfs_ioctl_encoded_io_args;
 
 #define BTRFS_MAX_EXTENT_SIZE SZ_128M
 
-static inline unsigned long btrfs_chunk_item_size(int num_stripes)
-{
-	BUG_ON(num_stripes == 0);
-	return sizeof(struct btrfs_chunk) +
-		sizeof(struct btrfs_stripe) * (num_stripes - 1);
-}
-
 /*
  * Runtime (in-memory) states of filesystem
  */
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 94ba46d57920..b4de4d5ed69f 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -160,6 +160,13 @@ const struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES] = {
 	},
 };
 
+unsigned long btrfs_chunk_item_size(int num_stripes)
+{
+	ASSERT(num_stripes);
+	return sizeof(struct btrfs_chunk) +
+		sizeof(struct btrfs_stripe) * (num_stripes - 1);
+}
+
 /*
  * Convert block group flags (BTRFS_BLOCK_GROUP_*) to btrfs_raid_types, which
  * can be used as index to access btrfs_raid_array[].
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index f19a1cd1bfcf..96a7b437ff20 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -730,5 +730,5 @@ int btrfs_bg_type_to_factor(u64 flags);
 const char *btrfs_bg_type_to_raid_name(u64 flags);
 int btrfs_verify_dev_extents(struct btrfs_fs_info *fs_info);
 bool btrfs_repair_one_zone(struct btrfs_fs_info *fs_info, u64 logical);
-
+unsigned long btrfs_chunk_item_size(int num_stripes);
 #endif
-- 
2.26.3


  parent reply	other threads:[~2022-09-14 15:07 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14 15:06 [PATCH 00/17] btrfs: initial ctree.h cleanups, simple stuff Josef Bacik
2022-09-14 15:06 ` [PATCH 01/17] btrfs: remove set/clear_pending_info helpers Josef Bacik
2022-09-15  9:03   ` Qu Wenruo
2022-09-15 14:11   ` Johannes Thumshirn
2022-10-07 16:51   ` David Sterba
2022-09-14 15:06 ` [PATCH 02/17] btrfs: remove BTRFS_TOTAL_BYTES_PINNED_BATCH Josef Bacik
2022-09-15  9:03   ` Qu Wenruo
2022-09-15 14:11   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 03/17] btrfs: remove BTRFS_IOPRIO_READA Josef Bacik
2022-09-15  9:03   ` Qu Wenruo
2022-09-15 14:12   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 04/17] btrfs: move btrfs on disk definitions out of ctree.h Josef Bacik
2022-09-15  9:07   ` Qu Wenruo
2022-10-07 17:07     ` David Sterba
2022-10-07 23:50       ` Qu Wenruo
2022-09-14 15:06 ` [PATCH 05/17] btrfs: move btrfs_get_block_group helper out of disk-io.h Josef Bacik
2022-09-15  9:10   ` Qu Wenruo
2022-09-15 14:14   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 06/17] btrfs: move maximum limits to btrfs_tree.h Josef Bacik
2022-09-15  9:10   ` Qu Wenruo
2022-09-15 14:15   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 07/17] btrfs: move BTRFS_MAX_MIRRORS into scrub.c Josef Bacik
2022-09-15  9:11   ` Qu Wenruo
2022-09-15 14:16   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 08/17] btrfs: move discard stat defs to free-space-cache.h Josef Bacik
2022-09-15  9:13   ` Qu Wenruo
2022-09-15 14:18   ` Johannes Thumshirn
2022-10-07 17:17     ` David Sterba
2022-10-07 17:16   ` David Sterba
2022-09-14 15:06 ` Josef Bacik [this message]
2022-09-15  9:14   ` [PATCH 09/17] btrfs: move btrfs_chunk_item_size out of ctree.h Qu Wenruo
2022-10-07 17:23     ` David Sterba
2022-09-15 14:19   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 10/17] btrfs: move btrfs_should_fragment_free_space into block-group.c Josef Bacik
2022-09-15  9:16   ` Qu Wenruo
2022-09-15 14:21   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 11/17] btrfs: move flush related definitions to space-info.h Josef Bacik
2022-09-15  9:21   ` Qu Wenruo
2022-10-07 17:28     ` David Sterba
2022-09-15 14:21   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 12/17] btrfs: move btrfs_print_data_csum_error into inode.c Josef Bacik
2022-09-15  9:22   ` Qu Wenruo
2022-10-07 17:31     ` David Sterba
2022-09-15 14:23   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 13/17] btrfs: move trans_handle_cachep out of ctree.h Josef Bacik
2022-09-15  9:23   ` Qu Wenruo
2022-09-15 14:24   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 14/17] btrfs: move btrfs_path_cachep " Josef Bacik
2022-09-15  9:27   ` Qu Wenruo
2022-09-15 14:27   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 15/17] btrfs: move free space cachep's " Josef Bacik
2022-09-15  9:27   ` Qu Wenruo
2022-09-15 14:27   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 16/17] btrfs: move btrfs_next_old_item into ctree.c Josef Bacik
2022-09-15  9:29   ` Qu Wenruo
2022-09-15 14:29   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 17/17] btrfs: move the btrfs_verity_descriptor_item defs up in ctree.h Josef Bacik
2022-09-15  9:30   ` Qu Wenruo
2022-09-15 14:30   ` Johannes Thumshirn
2022-09-15  9:47 ` [PATCH 00/17] btrfs: initial ctree.h cleanups, simple stuff Qu Wenruo
2022-10-07 17:51   ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3744e0ae6f8087daa9608174aeee00c53732f8bb.1663167823.git.josef@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).