diff mbox series

[RFC,ONLY,2/8] btrfs: move btrfs_io_context to volumes.h

Message ID 6bd71ff55e48686fc917736e686143ca7d5d2c64.1652711187.git.johannes.thumshirn@wdc.com (mailing list archive)
State New, archived
Headers show
Series btrfs: introduce raid-stripe-tree | expand

Commit Message

Johannes Thumshirn May 16, 2022, 2:31 p.m. UTC
In preparation for upcoming changes, move 'struct btrfs_io_context' to
volumes.h, so we can use it outside of volumes.c

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 fs/btrfs/volumes.h | 90 +++++++++++++++++++++++-----------------------
 1 file changed, 45 insertions(+), 45 deletions(-)

Comments

Qu Wenruo May 17, 2022, 7:42 a.m. UTC | #1
On 2022/5/16 22:31, Johannes Thumshirn wrote:
> In preparation for upcoming changes, move 'struct btrfs_io_context' to
> volumes.h, so we can use it outside of volumes.c

In fact I don't think the naming itself (from myself) is that good.

It maybe a good idea to also do a rename here.

I have some bad alternatives, but doesn't seem better than the current
generic naming either:

- btrfs_io_mapping
- btrfs_mapping_context

Thus I guess the current name is chosen mostly due to lack of better ones.

Thanks,
Qu

>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
>   fs/btrfs/volumes.h | 90 +++++++++++++++++++++++-----------------------
>   1 file changed, 45 insertions(+), 45 deletions(-)
>
> diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
> index bd297f23d19e..894d289a3b50 100644
> --- a/fs/btrfs/volumes.h
> +++ b/fs/btrfs/volumes.h
> @@ -32,6 +32,51 @@ struct btrfs_io_geometry {
>   	u64 raid56_stripe_offset;
>   };
>
> +struct btrfs_io_stripe {
> +	struct btrfs_device *dev;
> +	u64 physical;
> +	u64 length; /* only used for discard mappings */
> +};
> +
> +/*
> + * Context for IO subsmission for device stripe.
> + *
> + * - Track the unfinished mirrors for mirror based profiles
> + *   Mirror based profiles are SINGLE/DUP/RAID1/RAID10.
> + *
> + * - Contain the logical -> physical mapping info
> + *   Used by submit_stripe_bio() for mapping logical bio
> + *   into physical device address.
> + *
> + * - Contain device replace info
> + *   Used by handle_ops_on_dev_replace() to copy logical bios
> + *   into the new device.
> + *
> + * - Contain RAID56 full stripe logical bytenrs
> + */
> +struct btrfs_io_context {
> +	refcount_t refs;
> +	atomic_t stripes_pending;
> +	struct btrfs_fs_info *fs_info;
> +	u64 map_type; /* get from map_lookup->type */
> +	bio_end_io_t *end_io;
> +	struct bio *orig_bio;
> +	void *private;
> +	atomic_t error;
> +	int max_errors;
> +	int num_stripes;
> +	int mirror_num;
> +	int num_tgtdevs;
> +	int *tgtdev_map;
> +	/*
> +	 * logical block numbers for the start of each stripe
> +	 * The last one or two are p/q.  These are sorted,
> +	 * so raid_map[0] is the start of our full stripe
> +	 */
> +	u64 *raid_map;
> +	struct btrfs_io_stripe stripes[];
> +};
> +
>   /*
>    * Use sequence counter to get consistent device stat data on
>    * 32-bit processors.
> @@ -354,51 +399,6 @@ static inline void btrfs_bio_free_csum(struct btrfs_bio *bbio)
>   	}
>   }
>
> -struct btrfs_io_stripe {
> -	struct btrfs_device *dev;
> -	u64 physical;
> -	u64 length; /* only used for discard mappings */
> -};
> -
> -/*
> - * Context for IO subsmission for device stripe.
> - *
> - * - Track the unfinished mirrors for mirror based profiles
> - *   Mirror based profiles are SINGLE/DUP/RAID1/RAID10.
> - *
> - * - Contain the logical -> physical mapping info
> - *   Used by submit_stripe_bio() for mapping logical bio
> - *   into physical device address.
> - *
> - * - Contain device replace info
> - *   Used by handle_ops_on_dev_replace() to copy logical bios
> - *   into the new device.
> - *
> - * - Contain RAID56 full stripe logical bytenrs
> - */
> -struct btrfs_io_context {
> -	refcount_t refs;
> -	atomic_t stripes_pending;
> -	struct btrfs_fs_info *fs_info;
> -	u64 map_type; /* get from map_lookup->type */
> -	bio_end_io_t *end_io;
> -	struct bio *orig_bio;
> -	void *private;
> -	atomic_t error;
> -	int max_errors;
> -	int num_stripes;
> -	int mirror_num;
> -	int num_tgtdevs;
> -	int *tgtdev_map;
> -	/*
> -	 * logical block numbers for the start of each stripe
> -	 * The last one or two are p/q.  These are sorted,
> -	 * so raid_map[0] is the start of our full stripe
> -	 */
> -	u64 *raid_map;
> -	struct btrfs_io_stripe stripes[];
> -};
> -
>   struct btrfs_device_info {
>   	struct btrfs_device *dev;
>   	u64 dev_offset;
Johannes Thumshirn May 17, 2022, 7:51 a.m. UTC | #2
On 17/05/2022 09:42, Qu Wenruo wrote:
> 
> On 2022/5/16 22:31, Johannes Thumshirn wrote:
>> In preparation for upcoming changes, move 'struct btrfs_io_context' to
>> volumes.h, so we can use it outside of volumes.c
> In fact I don't think the naming itself (from myself) is that good.
> 
> It maybe a good idea to also do a rename here.
> 
> I have some bad alternatives, but doesn't seem better than the current
> generic naming either:
> 
> - btrfs_io_mapping
> - btrfs_mapping_context
> 
> Thus I guess the current name is chosen mostly due to lack of better ones.

Yep but I'm not any better in naming *cough* btrfs_dp_stripe *cough*. Maybe
someone else has an idea.
Qu Wenruo May 17, 2022, 7:58 a.m. UTC | #3
On 2022/5/17 15:51, Johannes Thumshirn wrote:
> On 17/05/2022 09:42, Qu Wenruo wrote:
>>
>> On 2022/5/16 22:31, Johannes Thumshirn wrote:
>>> In preparation for upcoming changes, move 'struct btrfs_io_context' to
>>> volumes.h, so we can use it outside of volumes.c
>> In fact I don't think the naming itself (from myself) is that good.
>>
>> It maybe a good idea to also do a rename here.
>>
>> I have some bad alternatives, but doesn't seem better than the current
>> generic naming either:
>>
>> - btrfs_io_mapping
>> - btrfs_mapping_context
>>
>> Thus I guess the current name is chosen mostly due to lack of better ones.
>
> Yep but I'm not any better in naming *cough* btrfs_dp_stripe *cough*. Maybe
> someone else has an idea.

Forgot to ask in that thread, what does the "dp" naming mean?

Thanks,
Qu
Johannes Thumshirn May 17, 2022, 8:01 a.m. UTC | #4
On 17/05/2022 09:58, Qu Wenruo wrote:
> 
> 
> On 2022/5/17 15:51, Johannes Thumshirn wrote:
>> On 17/05/2022 09:42, Qu Wenruo wrote:
>>>
>>> On 2022/5/16 22:31, Johannes Thumshirn wrote:
>>>> In preparation for upcoming changes, move 'struct btrfs_io_context' to
>>>> volumes.h, so we can use it outside of volumes.c
>>> In fact I don't think the naming itself (from myself) is that good.
>>>
>>> It maybe a good idea to also do a rename here.
>>>
>>> I have some bad alternatives, but doesn't seem better than the current
>>> generic naming either:
>>>
>>> - btrfs_io_mapping
>>> - btrfs_mapping_context
>>>
>>> Thus I guess the current name is chosen mostly due to lack of better ones.
>>
>> Yep but I'm not any better in naming *cough* btrfs_dp_stripe *cough*. Maybe
>> someone else has an idea.
> 
> Forgot to ask in that thread, what does the "dp" naming mean?

Declustered Parity, but that's misleading actually, as RAID1 doesn't do parity
at all (although BTRFS RAID1 is a declustered RAID already).
diff mbox series

Patch

diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index bd297f23d19e..894d289a3b50 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -32,6 +32,51 @@  struct btrfs_io_geometry {
 	u64 raid56_stripe_offset;
 };
 
+struct btrfs_io_stripe {
+	struct btrfs_device *dev;
+	u64 physical;
+	u64 length; /* only used for discard mappings */
+};
+
+/*
+ * Context for IO subsmission for device stripe.
+ *
+ * - Track the unfinished mirrors for mirror based profiles
+ *   Mirror based profiles are SINGLE/DUP/RAID1/RAID10.
+ *
+ * - Contain the logical -> physical mapping info
+ *   Used by submit_stripe_bio() for mapping logical bio
+ *   into physical device address.
+ *
+ * - Contain device replace info
+ *   Used by handle_ops_on_dev_replace() to copy logical bios
+ *   into the new device.
+ *
+ * - Contain RAID56 full stripe logical bytenrs
+ */
+struct btrfs_io_context {
+	refcount_t refs;
+	atomic_t stripes_pending;
+	struct btrfs_fs_info *fs_info;
+	u64 map_type; /* get from map_lookup->type */
+	bio_end_io_t *end_io;
+	struct bio *orig_bio;
+	void *private;
+	atomic_t error;
+	int max_errors;
+	int num_stripes;
+	int mirror_num;
+	int num_tgtdevs;
+	int *tgtdev_map;
+	/*
+	 * logical block numbers for the start of each stripe
+	 * The last one or two are p/q.  These are sorted,
+	 * so raid_map[0] is the start of our full stripe
+	 */
+	u64 *raid_map;
+	struct btrfs_io_stripe stripes[];
+};
+
 /*
  * Use sequence counter to get consistent device stat data on
  * 32-bit processors.
@@ -354,51 +399,6 @@  static inline void btrfs_bio_free_csum(struct btrfs_bio *bbio)
 	}
 }
 
-struct btrfs_io_stripe {
-	struct btrfs_device *dev;
-	u64 physical;
-	u64 length; /* only used for discard mappings */
-};
-
-/*
- * Context for IO subsmission for device stripe.
- *
- * - Track the unfinished mirrors for mirror based profiles
- *   Mirror based profiles are SINGLE/DUP/RAID1/RAID10.
- *
- * - Contain the logical -> physical mapping info
- *   Used by submit_stripe_bio() for mapping logical bio
- *   into physical device address.
- *
- * - Contain device replace info
- *   Used by handle_ops_on_dev_replace() to copy logical bios
- *   into the new device.
- *
- * - Contain RAID56 full stripe logical bytenrs
- */
-struct btrfs_io_context {
-	refcount_t refs;
-	atomic_t stripes_pending;
-	struct btrfs_fs_info *fs_info;
-	u64 map_type; /* get from map_lookup->type */
-	bio_end_io_t *end_io;
-	struct bio *orig_bio;
-	void *private;
-	atomic_t error;
-	int max_errors;
-	int num_stripes;
-	int mirror_num;
-	int num_tgtdevs;
-	int *tgtdev_map;
-	/*
-	 * logical block numbers for the start of each stripe
-	 * The last one or two are p/q.  These are sorted,
-	 * so raid_map[0] is the start of our full stripe
-	 */
-	u64 *raid_map;
-	struct btrfs_io_stripe stripes[];
-};
-
 struct btrfs_device_info {
 	struct btrfs_device *dev;
 	u64 dev_offset;