Re: [PATCH v6 1/2] tcmu: Add dynamic growing data area featuresupport

2017-05-01 Thread Mike Christie
On 04/30/2017 05:22 AM, Xiubo Li wrote:
> On 2017年04月30日 13:48, Mike Christie wrote:
>> On 04/26/2017 01:25 AM, lixi...@cmss.chinamobile.com wrote:
>>>   for_each_sg(data_sg, sg, data_nents, i) {
>>> @@ -275,22 +371,26 @@ static void alloc_and_scatter_data_area(struct
>>> tcmu_dev *udev,
>>>   from = kmap_atomic(sg_page(sg)) + sg->offset;
>>>   while (sg_remaining > 0) {
>>>   if (block_remaining == 0) {
>>> -block = find_first_zero_bit(udev->data_bitmap,
>>> -DATA_BLOCK_BITS);
>>>   block_remaining = DATA_BLOCK_SIZE;
>>> -set_bit(block, udev->data_bitmap);
>>> +dbi = tcmu_get_empty_block(udev, );
>>> +if (dbi < 0)
>>
>> I know it you fixed the missing kunmap_atomic here and missing unlock in
>> tcmu_queue_cmd_ring in the next patch, but I think normally people
>> prefer that one patch does not add a bug, then the next patch fixes it.
> Do you mean the following kmap_atomic() ?
> 
> from = kmap_atomic(sg_page(sg)) + sg->offset;
> 
> In this patch there has no new kmap/kunmap introduced. This is the old
> code and
> the kunmap is at the end of aasda().

You added a new return in the error path in this patch in the if case
above, but did not add a kunmap_atomic.


Re: [PATCH v6 1/2] tcmu: Add dynamic growing data area featuresupport

2017-05-01 Thread Mike Christie
On 04/30/2017 05:22 AM, Xiubo Li wrote:
> On 2017年04月30日 13:48, Mike Christie wrote:
>> On 04/26/2017 01:25 AM, lixi...@cmss.chinamobile.com wrote:
>>>   for_each_sg(data_sg, sg, data_nents, i) {
>>> @@ -275,22 +371,26 @@ static void alloc_and_scatter_data_area(struct
>>> tcmu_dev *udev,
>>>   from = kmap_atomic(sg_page(sg)) + sg->offset;
>>>   while (sg_remaining > 0) {
>>>   if (block_remaining == 0) {
>>> -block = find_first_zero_bit(udev->data_bitmap,
>>> -DATA_BLOCK_BITS);
>>>   block_remaining = DATA_BLOCK_SIZE;
>>> -set_bit(block, udev->data_bitmap);
>>> +dbi = tcmu_get_empty_block(udev, );
>>> +if (dbi < 0)
>>
>> I know it you fixed the missing kunmap_atomic here and missing unlock in
>> tcmu_queue_cmd_ring in the next patch, but I think normally people
>> prefer that one patch does not add a bug, then the next patch fixes it.
> Do you mean the following kmap_atomic() ?
> 
> from = kmap_atomic(sg_page(sg)) + sg->offset;
> 
> In this patch there has no new kmap/kunmap introduced. This is the old
> code and
> the kunmap is at the end of aasda().

You added a new return in the error path in this patch in the if case
above, but did not add a kunmap_atomic.


Re: [PATCH v6 1/2] tcmu: Add dynamic growing data area featuresupport

2017-04-30 Thread Xiubo Li

On 2017年04月30日 13:48, Mike Christie wrote:

On 04/26/2017 01:25 AM, lixi...@cmss.chinamobile.com wrote:

for_each_sg(data_sg, sg, data_nents, i) {
@@ -275,22 +371,26 @@ static void alloc_and_scatter_data_area(struct tcmu_dev 
*udev,
from = kmap_atomic(sg_page(sg)) + sg->offset;
while (sg_remaining > 0) {
if (block_remaining == 0) {
-   block = find_first_zero_bit(udev->data_bitmap,
-   DATA_BLOCK_BITS);
block_remaining = DATA_BLOCK_SIZE;
-   set_bit(block, udev->data_bitmap);
+   dbi = tcmu_get_empty_block(udev, );
+   if (dbi < 0)


I know it you fixed the missing kunmap_atomic here and missing unlock in
tcmu_queue_cmd_ring in the next patch, but I think normally people
prefer that one patch does not add a bug, then the next patch fixes it.

Do you mean the following kmap_atomic() ?

from = kmap_atomic(sg_page(sg)) + sg->offset;

In this patch there has no new kmap/kunmap introduced. This is the old 
code and

the kunmap is at the end of aasda().

This as the initial patch, the memory is from slab cache now. But since 
the second

patch followed will covert to use memory page from the buddy directly.


Thanks,

BRs
Xiubo Li





Re: [PATCH v6 1/2] tcmu: Add dynamic growing data area featuresupport

2017-04-30 Thread Xiubo Li

On 2017年04月30日 13:48, Mike Christie wrote:

On 04/26/2017 01:25 AM, lixi...@cmss.chinamobile.com wrote:

for_each_sg(data_sg, sg, data_nents, i) {
@@ -275,22 +371,26 @@ static void alloc_and_scatter_data_area(struct tcmu_dev 
*udev,
from = kmap_atomic(sg_page(sg)) + sg->offset;
while (sg_remaining > 0) {
if (block_remaining == 0) {
-   block = find_first_zero_bit(udev->data_bitmap,
-   DATA_BLOCK_BITS);
block_remaining = DATA_BLOCK_SIZE;
-   set_bit(block, udev->data_bitmap);
+   dbi = tcmu_get_empty_block(udev, );
+   if (dbi < 0)


I know it you fixed the missing kunmap_atomic here and missing unlock in
tcmu_queue_cmd_ring in the next patch, but I think normally people
prefer that one patch does not add a bug, then the next patch fixes it.

Do you mean the following kmap_atomic() ?

from = kmap_atomic(sg_page(sg)) + sg->offset;

In this patch there has no new kmap/kunmap introduced. This is the old 
code and

the kunmap is at the end of aasda().

This as the initial patch, the memory is from slab cache now. But since 
the second

patch followed will covert to use memory page from the buddy directly.


Thanks,

BRs
Xiubo Li