diff mbox

[v3,1/7] bio: Introduce LightNVM payload

Message ID 1429712816-10336-2-git-send-email-m@bjorling.me (mailing list archive)
State New, archived
Headers show

Commit Message

Matias Bjørling April 22, 2015, 2:26 p.m. UTC
LightNVM integrates on both sides of the block layer. The lower layer
implements mapping of logical to physical addressing, while the layer
above can string together multiple LightNVM devices and expose them as a
single block device.

Having multiple devices underneath requires a way to resolve where the
IO came from when submitted through the block layer. Extending bio with
a LightNVM payload solves this problem.

Signed-off-by: Matias Bjørling <m@bjorling.me>
---
 include/linux/bio.h       | 9 +++++++++
 include/linux/blk_types.h | 4 +++-
 2 files changed, 12 insertions(+), 1 deletion(-)

Comments

Christoph Hellwig May 9, 2015, 4 p.m. UTC | #1
On Wed, Apr 22, 2015 at 04:26:50PM +0200, Matias Bj??rling wrote:
> LightNVM integrates on both sides of the block layer. The lower layer
> implements mapping of logical to physical addressing, while the layer
> above can string together multiple LightNVM devices and expose them as a
> single block device.
> 
> Having multiple devices underneath requires a way to resolve where the
> IO came from when submitted through the block layer. Extending bio with
> a LightNVM payload solves this problem.
> 
> Signed-off-by: Matias Bj??rling <m@bjorling.me>
> ---
>  include/linux/bio.h       | 9 +++++++++
>  include/linux/blk_types.h | 4 +++-
>  2 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/bio.h b/include/linux/bio.h
> index da3a127..4e31a1c 100644
> --- a/include/linux/bio.h
> +++ b/include/linux/bio.h
> @@ -354,6 +354,15 @@ static inline void bip_set_seed(struct bio_integrity_payload *bip,
>  
>  #endif /* CONFIG_BLK_DEV_INTEGRITY */
>  
> +#if defined(CONFIG_NVM)
> +
> +/* bio open-channel ssd payload */
> +struct bio_nvm_payload {
> +	void *private;
> +};

Can you explain why this needs to be done on a per-bio instead of a
per-request level?  I don't really think a low-level driver should add
fields to struct bio as that can be easily remapped.

On the other hand in th request you can already (ab)use the ->cmd and
related fields for your own purposes.

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Matias Bjørling May 11, 2015, 11:58 a.m. UTC | #2
On 05/09/2015 06:00 PM, Christoph Hellwig wrote:
> On Wed, Apr 22, 2015 at 04:26:50PM +0200, Matias Bj??rling wrote:
>> LightNVM integrates on both sides of the block layer. The lower layer
>> implements mapping of logical to physical addressing, while the layer
>> above can string together multiple LightNVM devices and expose them as a
>> single block device.
>>
>> Having multiple devices underneath requires a way to resolve where the
>> IO came from when submitted through the block layer. Extending bio with
>> a LightNVM payload solves this problem.
>>
>> Signed-off-by: Matias Bj??rling <m@bjorling.me>
>> ---
>>   include/linux/bio.h       | 9 +++++++++
>>   include/linux/blk_types.h | 4 +++-
>>   2 files changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/linux/bio.h b/include/linux/bio.h
>> index da3a127..4e31a1c 100644
>> --- a/include/linux/bio.h
>> +++ b/include/linux/bio.h
>> @@ -354,6 +354,15 @@ static inline void bip_set_seed(struct bio_integrity_payload *bip,
>>
>>   #endif /* CONFIG_BLK_DEV_INTEGRITY */
>>
>> +#if defined(CONFIG_NVM)
>> +
>> +/* bio open-channel ssd payload */
>> +struct bio_nvm_payload {
>> +	void *private;
>> +};
>
> Can you explain why this needs to be done on a per-bio instead of a
> per-request level?  I don't really think a low-level driver should add
> fields to struct bio as that can be easily remapped.

When a bio is submitted through the block layer, it can be 
merged/splitted on going through the block layer. Thus, we don't know 
the number of physical addresses that must be mapped before its on the 
other side.

There can be multiple targets using a single open-channel SSD. 
Therefore, when its on the other side, it has to figure out which target 
it was called from, so it can call the right mapping function.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christoph Hellwig May 12, 2015, 7:21 a.m. UTC | #3
On Mon, May 11, 2015 at 01:58:51PM +0200, Matias Bj?rling wrote:
> >Can you explain why this needs to be done on a per-bio instead of a
> >per-request level?  I don't really think a low-level driver should add
> >fields to struct bio as that can be easily remapped.
> 
> When a bio is submitted through the block layer, it can be merged/splitted
> on going through the block layer. Thus, we don't know the number of physical
> addresses that must be mapped before its on the other side.

For any sort of passthrough bios that should not be the case.  It's not
for BLOCK_PC, it's not for my new pass through NVMe commands and I don't
think it should be in this case.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/bio.h b/include/linux/bio.h
index da3a127..4e31a1c 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -354,6 +354,15 @@  static inline void bip_set_seed(struct bio_integrity_payload *bip,
 
 #endif /* CONFIG_BLK_DEV_INTEGRITY */
 
+#if defined(CONFIG_NVM)
+
+/* bio open-channel ssd payload */
+struct bio_nvm_payload {
+	void *private;
+};
+
+#endif /* CONFIG_NVM */
+
 extern void bio_trim(struct bio *bio, int offset, int size);
 extern struct bio *bio_split(struct bio *bio, int sectors,
 			     gfp_t gfp, struct bio_set *bs);
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index a1b25e3..272c17e 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -83,7 +83,9 @@  struct bio {
 		struct bio_integrity_payload *bi_integrity; /* data integrity */
 #endif
 	};
-
+#if defined(CONFIG_NVM)
+	struct bio_nvm_payload *bi_nvm; /* open-channel ssd backend */
+#endif
 	unsigned short		bi_vcnt;	/* how many bio_vec's */
 
 	/*