All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeffle Xu <jefflexu@linux.alibaba.com>
To: gregkh@linuxfoundation.org, sashal@kernel.org
Cc: stable@vger.kernel.org, jefflexu@linux.alibaba.com, snitzer@redhat.com
Subject: [PATCH 4.9.y 2/3] dm table: fix no_sg_merge iterate_devices based device capability checks
Date: Fri,  5 Mar 2021 14:46:24 +0800	[thread overview]
Message-ID: <20210305064625.63098-3-jefflexu@linux.alibaba.com> (raw)
In-Reply-To: <20210305064625.63098-1-jefflexu@linux.alibaba.com>

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 ba56be34cd5d..1728e3638136 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1532,12 +1532,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,
@@ -1638,10 +1638,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);
 
-- 
2.27.0


  parent reply	other threads:[~2021-03-05  6:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01 13:44 FAILED: patch "[PATCH] dm table: fix iterate_devices based device capability checks" failed to apply to 4.9-stable tree gregkh
2021-03-05  6:46 ` [PATCH 4.9.y 0/3] dm: device capability check fixes Jeffle Xu
2021-03-05  6:46   ` [PATCH 4.9.y 1/3] dm table: fix iterate_devices based device capability checks Jeffle Xu
2021-03-07 15:09     ` Greg KH
2021-03-08  2:16       ` JeffleXu
2021-03-08  9:57         ` Greg KH
2021-03-08 13:31           ` JeffleXu
2021-03-05  6:46   ` Jeffle Xu [this message]
2021-03-05  6:46   ` [PATCH 4.9.y 3/3] dm table: fix DAX " Jeffle Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210305064625.63098-3-jefflexu@linux.alibaba.com \
    --to=jefflexu@linux.alibaba.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=sashal@kernel.org \
    --cc=snitzer@redhat.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.