diff mbox series

[4.4.y,2/2] dm table: fix no_sg_merge iterate_devices based device capability checks

Message ID 20210305063051.51030-3-jefflexu@linux.alibaba.com
State New
Headers show
Series dm: device capability check fixes | expand

Commit Message

Jingbo Xu March 5, 2021, 6:30 a.m. UTC
Similar to commit a4c8dd9c2d09 ("dm table: fix iterate_devices based
device capability checks"), fix NO_SG_MERGE capability check and invert
logic of the corresponding iterate_devices_callout_fn so that all
devices' NO_SG_MERGE capabilities are properly checked.

Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
Fixes: 200612ec33e5 ("dm table: propagate QUEUE_FLAG_NO_SG_MERGE")
---
 drivers/md/dm-table.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Jingbo Xu March 8, 2021, 3:21 a.m. UTC | #1
Hi, Mike,

Would you please spare some time to review the following patches for
stable tree?

- [1] for 4.4.y
- [2] for 4.9.y
- [3] for 4.14.y
- [4] for 4.19.y

While backporting [5] for stable tree, there's some extra code specific
to stable tree needs to be fixed, see [6] for the background info.

[1] https://www.spinics.net/lists/stable/msg448728.html
[2] https://www.spinics.net/lists/stable/msg448737.html
[3] https://www.spinics.net/lists/stable/msg448740.html
[4] https://www.spinics.net/lists/stable/msg448748.html
[5]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.12-rc2&id=a4c8dd9c2d0987cf542a2a0c42684c9c6d78a04e
[6] https://www.spinics.net/lists/stable/msg448757.html


Thanks,
Jeffle


On 3/5/21 2:30 PM, Jeffle Xu wrote:
> Similar to commit a4c8dd9c2d09 ("dm table: fix iterate_devices based

> device capability checks"), fix NO_SG_MERGE capability check and invert

> logic of the corresponding iterate_devices_callout_fn so that all

> devices' NO_SG_MERGE capabilities are properly checked.

> 

> Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>

> Fixes: 200612ec33e5 ("dm table: propagate QUEUE_FLAG_NO_SG_MERGE")

> ---

>  drivers/md/dm-table.c | 12 ++++++------

>  1 file changed, 6 insertions(+), 6 deletions(-)

> 

> diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c

> index 6580de65b81d..7ee520d4d216 100644

> --- a/drivers/md/dm-table.c

> +++ b/drivers/md/dm-table.c

> @@ -1436,12 +1436,12 @@ static int device_is_not_random(struct dm_target *ti, struct dm_dev *dev,

>  	return q && !blk_queue_add_random(q);

>  }

>  

> -static int queue_supports_sg_merge(struct dm_target *ti, struct dm_dev *dev,

> -				   sector_t start, sector_t len, void *data)

> +static int queue_no_sg_merge(struct dm_target *ti, struct dm_dev *dev,

> +			     sector_t start, sector_t len, void *data)

>  {

>  	struct request_queue *q = bdev_get_queue(dev->bdev);

>  

> -	return q && !test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags);

> +	return q && test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags);

>  }

>  

>  static int device_not_write_same_capable(struct dm_target *ti, struct dm_dev *dev,

> @@ -1542,10 +1542,10 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,

>  	if (!dm_table_supports_write_same(t))

>  		q->limits.max_write_same_sectors = 0;

>  

> -	if (dm_table_all_devices_attribute(t, queue_supports_sg_merge))

> -		queue_flag_clear_unlocked(QUEUE_FLAG_NO_SG_MERGE, q);

> -	else

> +	if (dm_table_any_dev_attr(t, queue_no_sg_merge))

>  		queue_flag_set_unlocked(QUEUE_FLAG_NO_SG_MERGE, q);

> +	else

> +		queue_flag_clear_unlocked(QUEUE_FLAG_NO_SG_MERGE, q);

>  

>  	dm_table_verify_integrity(t);

>  

> 


-- 
Thanks,
Jeffle
Jingbo Xu March 8, 2021, 1:45 p.m. UTC | #2
On 3/8/21 11:21 AM, JeffleXu wrote:
> Hi, Mike,

> 

> Would you please spare some time to review the following patches for

> stable tree?

> 

> - [1] for 4.4.y

> - [2] for 4.9.y

> - [3] for 4.14.y

> - [4] for 4.19.y

> 

> While backporting [5] for stable tree, there's some extra code specific

> to stable tree needs to be fixed, see [6] for the background info.

> 

> [1] https://www.spinics.net/lists/stable/msg448728.html

> [2] https://www.spinics.net/lists/stable/msg448737.html

> [3] https://www.spinics.net/lists/stable/msg448740.html

> [4] https://www.spinics.net/lists/stable/msg448748.html

> [5]

> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.12-rc2&id=a4c8dd9c2d0987cf542a2a0c42684c9c6d78a04e

> [6] https://www.spinics.net/lists/stable/msg448757.html

> 


Sorry, it seems that this patch should not be separated from patch [5],
as the NO_SG_MERGE capability check also calls
dm_table_all_devices_attribute(), which has been removed in patch [5].
It will break the per-patch build-test when leave this patch not applied.

I will send a new version later. Please review on the new version directly.


> 

> 

> On 3/5/21 2:30 PM, Jeffle Xu wrote:

>> Similar to commit a4c8dd9c2d09 ("dm table: fix iterate_devices based

>> device capability checks"), fix NO_SG_MERGE capability check and invert

>> logic of the corresponding iterate_devices_callout_fn so that all

>> devices' NO_SG_MERGE capabilities are properly checked.

>>

>> Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>

>> Fixes: 200612ec33e5 ("dm table: propagate QUEUE_FLAG_NO_SG_MERGE")

>> ---

>>  drivers/md/dm-table.c | 12 ++++++------

>>  1 file changed, 6 insertions(+), 6 deletions(-)

>>

>> diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c

>> index 6580de65b81d..7ee520d4d216 100644

>> --- a/drivers/md/dm-table.c

>> +++ b/drivers/md/dm-table.c

>> @@ -1436,12 +1436,12 @@ static int device_is_not_random(struct dm_target *ti, struct dm_dev *dev,

>>  	return q && !blk_queue_add_random(q);

>>  }

>>  

>> -static int queue_supports_sg_merge(struct dm_target *ti, struct dm_dev *dev,

>> -				   sector_t start, sector_t len, void *data)

>> +static int queue_no_sg_merge(struct dm_target *ti, struct dm_dev *dev,

>> +			     sector_t start, sector_t len, void *data)

>>  {

>>  	struct request_queue *q = bdev_get_queue(dev->bdev);

>>  

>> -	return q && !test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags);

>> +	return q && test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags);

>>  }

>>  

>>  static int device_not_write_same_capable(struct dm_target *ti, struct dm_dev *dev,

>> @@ -1542,10 +1542,10 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,

>>  	if (!dm_table_supports_write_same(t))

>>  		q->limits.max_write_same_sectors = 0;

>>  

>> -	if (dm_table_all_devices_attribute(t, queue_supports_sg_merge))

>> -		queue_flag_clear_unlocked(QUEUE_FLAG_NO_SG_MERGE, q);

>> -	else

>> +	if (dm_table_any_dev_attr(t, queue_no_sg_merge))

>>  		queue_flag_set_unlocked(QUEUE_FLAG_NO_SG_MERGE, q);

>> +	else

>> +		queue_flag_clear_unlocked(QUEUE_FLAG_NO_SG_MERGE, q);

>>  

>>  	dm_table_verify_integrity(t);

>>  

>>

> 


-- 
Thanks,
Jeffle
diff mbox series

Patch

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 6580de65b81d..7ee520d4d216 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1436,12 +1436,12 @@  static int device_is_not_random(struct dm_target *ti, struct dm_dev *dev,
 	return q && !blk_queue_add_random(q);
 }
 
-static int queue_supports_sg_merge(struct dm_target *ti, struct dm_dev *dev,
-				   sector_t start, sector_t len, void *data)
+static int queue_no_sg_merge(struct dm_target *ti, struct dm_dev *dev,
+			     sector_t start, sector_t len, void *data)
 {
 	struct request_queue *q = bdev_get_queue(dev->bdev);
 
-	return q && !test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags);
+	return q && test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags);
 }
 
 static int device_not_write_same_capable(struct dm_target *ti, struct dm_dev *dev,
@@ -1542,10 +1542,10 @@  void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
 	if (!dm_table_supports_write_same(t))
 		q->limits.max_write_same_sectors = 0;
 
-	if (dm_table_all_devices_attribute(t, queue_supports_sg_merge))
-		queue_flag_clear_unlocked(QUEUE_FLAG_NO_SG_MERGE, q);
-	else
+	if (dm_table_any_dev_attr(t, queue_no_sg_merge))
 		queue_flag_set_unlocked(QUEUE_FLAG_NO_SG_MERGE, q);
+	else
+		queue_flag_clear_unlocked(QUEUE_FLAG_NO_SG_MERGE, q);
 
 	dm_table_verify_integrity(t);