* [PATCH] tcmu: clean up the scatter helper
@ 2017-07-13 6:33 lixiubo
2017-07-13 18:14 ` Mike Christie
2017-07-30 22:19 ` Nicholas A. Bellinger
0 siblings, 2 replies; 6+ messages in thread
From: lixiubo @ 2017-07-13 6:33 UTC (permalink / raw)
To: nab, mchristi; +Cc: bryantly, linux-scsi, target-devel, Xiubo Li
From: Xiubo Li <lixiubo@cmss.chinamobile.com>
Add some comments to make the scatter code to be more readable.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
---
drivers/target/target_core_user.c | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index 9030c2a..4f529ed3 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -532,8 +532,7 @@ static inline size_t head_to_end(size_t head, size_t size)
return size - head;
}
-static inline void new_iov(struct iovec **iov, int *iov_cnt,
- struct tcmu_dev *udev)
+static inline void new_iov(struct iovec **iov, int *iov_cnt)
{
struct iovec *iovec;
@@ -586,19 +585,38 @@ static int scatter_data_area(struct tcmu_dev *udev,
to = kmap_atomic(page);
}
- copy_bytes = min_t(size_t, sg_remaining,
- block_remaining);
+ /*
+ * Covert to virtual offset of the ring data area.
+ */
to_offset = get_block_offset_user(udev, dbi,
block_remaining);
+ /*
+ * The following code will gather and map the blocks
+ * to the same iovec when the blocks are all next to
+ * each other.
+ */
+ copy_bytes = min_t(size_t, sg_remaining,
+ block_remaining);
if (*iov_cnt != 0 &&
to_offset == iov_tail(*iov)) {
+ /*
+ * Will append to the current iovec, because
+ * the current block page is next to the
+ * previous one.
+ */
(*iov)->iov_len += copy_bytes;
} else {
- new_iov(iov, iov_cnt, udev);
+ /*
+ * Will allocate a new iovec because we are
+ * first time here or the current block page
+ * is not next to the previous one.
+ */
+ new_iov(iov, iov_cnt);
(*iov)->iov_base = (void __user *)to_offset;
(*iov)->iov_len = copy_bytes;
}
+
if (copy_data) {
offset = DATA_BLOCK_SIZE - block_remaining;
memcpy(to + offset,
@@ -606,11 +624,13 @@ static int scatter_data_area(struct tcmu_dev *udev,
copy_bytes);
tcmu_flush_dcache_range(to, copy_bytes);
}
+
sg_remaining -= copy_bytes;
block_remaining -= copy_bytes;
}
kunmap_atomic(from - sg->offset);
}
+
if (to)
kunmap_atomic(to);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] tcmu: clean up the scatter helper
2017-07-13 6:33 [PATCH] tcmu: clean up the scatter helper lixiubo
@ 2017-07-13 18:14 ` Mike Christie
2017-07-30 22:19 ` Nicholas A. Bellinger
1 sibling, 0 replies; 6+ messages in thread
From: Mike Christie @ 2017-07-13 18:14 UTC (permalink / raw)
To: lixiubo, nab; +Cc: bryantly, linux-scsi, target-devel
On 07/13/2017 01:33 AM, lixiubo@cmss.chinamobile.com wrote:
> From: Xiubo Li <lixiubo@cmss.chinamobile.com>
>
> Add some comments to make the scatter code to be more readable.
>
> Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
> ---
Reviewed-by: Mike Christie <mchristi@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tcmu: clean up the scatter helper
2017-07-13 6:33 [PATCH] tcmu: clean up the scatter helper lixiubo
2017-07-13 18:14 ` Mike Christie
@ 2017-07-30 22:19 ` Nicholas A. Bellinger
2017-11-08 22:39 ` Bryant G. Ly
1 sibling, 1 reply; 6+ messages in thread
From: Nicholas A. Bellinger @ 2017-07-30 22:19 UTC (permalink / raw)
To: lixiubo; +Cc: mchristi, bryantly, linux-scsi, target-devel
On Thu, 2017-07-13 at 14:33 +0800, lixiubo@cmss.chinamobile.com wrote:
> From: Xiubo Li <lixiubo@cmss.chinamobile.com>
>
> Add some comments to make the scatter code to be more readable.
>
> Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
> ---
> drivers/target/target_core_user.c | 30 +++++++++++++++++++++++++-----
> 1 file changed, 25 insertions(+), 5 deletions(-)
>
Applied to target-pending/for-next.
Thanks Xiubo + MNC.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tcmu: clean up the scatter helper
2017-07-30 22:19 ` Nicholas A. Bellinger
@ 2017-11-08 22:39 ` Bryant G. Ly
2017-11-08 22:44 ` Mike Christie
0 siblings, 1 reply; 6+ messages in thread
From: Bryant G. Ly @ 2017-11-08 22:39 UTC (permalink / raw)
To: Nicholas A. Bellinger, lixiubo; +Cc: mchristi, linux-scsi, target-devel
On 7/30/17 5:19 PM, Nicholas A. Bellinger wrote:
> On Thu, 2017-07-13 at 14:33 +0800, lixiubo@cmss.chinamobile.com wrote:
>> From: Xiubo Li <lixiubo@cmss.chinamobile.com>
>>
>> Add some comments to make the scatter code to be more readable.
>>
>> Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
>> ---
>> drivers/target/target_core_user.c | 30 +++++++++++++++++++++++++-----
>> 1 file changed, 25 insertions(+), 5 deletions(-)
>>
> Applied to target-pending/for-next.
>
> Thanks Xiubo + MNC.
>
This one seems to also be missing from the tree.
-Bryant
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tcmu: clean up the scatter helper
2017-11-08 22:39 ` Bryant G. Ly
@ 2017-11-08 22:44 ` Mike Christie
2017-11-08 22:49 ` Bryant G. Ly
0 siblings, 1 reply; 6+ messages in thread
From: Mike Christie @ 2017-11-08 22:44 UTC (permalink / raw)
To: Bryant G. Ly, Nicholas A. Bellinger, lixiubo; +Cc: linux-scsi, target-devel
On 11/08/2017 04:39 PM, Bryant G. Ly wrote:
> On 7/30/17 5:19 PM, Nicholas A. Bellinger wrote:
>
>> On Thu, 2017-07-13 at 14:33 +0800, lixiubo@cmss.chinamobile.com wrote:
>>> From: Xiubo Li <lixiubo@cmss.chinamobile.com>
>>>
>>> Add some comments to make the scatter code to be more readable.
>>>
>>> Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
>>> ---
>>> drivers/target/target_core_user.c | 30 +++++++++++++++++++++++++-----
>>> 1 file changed, 25 insertions(+), 5 deletions(-)
>>>
>> Applied to target-pending/for-next.
>>
>> Thanks Xiubo + MNC.
>>
> This one seems to also be missing from the tree.
>
I ported this one to my patchset that is built without the
"tcmu: Add fifo type waiter list support to avoid starvation" patch:
https://www.spinics.net/lists/target-devel/msg16153.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tcmu: clean up the scatter helper
2017-11-08 22:44 ` Mike Christie
@ 2017-11-08 22:49 ` Bryant G. Ly
0 siblings, 0 replies; 6+ messages in thread
From: Bryant G. Ly @ 2017-11-08 22:49 UTC (permalink / raw)
To: Mike Christie, Nicholas A. Bellinger, lixiubo; +Cc: linux-scsi, target-devel
> On 11/08/2017 04:39 PM, Bryant G. Ly wrote:
>> On 7/30/17 5:19 PM, Nicholas A. Bellinger wrote:
>>
>>> On Thu, 2017-07-13 at 14:33 +0800, lixiubo@cmss.chinamobile.com wrote:
>>>> From: Xiubo Li <lixiubo@cmss.chinamobile.com>
>>>>
>>>> Add some comments to make the scatter code to be more readable.
>>>>
>>>> Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
>>>> ---
>>>> drivers/target/target_core_user.c | 30 +++++++++++++++++++++++++-----
>>>> 1 file changed, 25 insertions(+), 5 deletions(-)
>>>>
>>> Applied to target-pending/for-next.
>>>
>>> Thanks Xiubo + MNC.
>>>
>> This one seems to also be missing from the tree.
>>
> I ported this one to my patchset that is built without the
> "tcmu: Add fifo type waiter list support to avoid starvation" patch:
>
> https://www.spinics.net/lists/target-devel/msg16153.html
>
Thanks Mike! I was trying to catch up and I missed all that. I see that the current for-next has everything.
-Bryant
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-11-08 22:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-13 6:33 [PATCH] tcmu: clean up the scatter helper lixiubo
2017-07-13 18:14 ` Mike Christie
2017-07-30 22:19 ` Nicholas A. Bellinger
2017-11-08 22:39 ` Bryant G. Ly
2017-11-08 22:44 ` Mike Christie
2017-11-08 22:49 ` Bryant G. Ly
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).