[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] xen-blkfront: don't make discard-alignment mandatory


  • To: <linux-kernel@xxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Mon, 18 Jan 2021 16:15:28 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=guD3dwThuVjNlUiHYl4Q2Z+Crgc3pWLg845vDPYqznE=; b=SASDiVJBNSa1zMGKp+a8twOrD3c5XyiKcYtNj/KU341XdlwYpJkSY/4D6u7yeeIOGenGC0iDRSYOhYdBM+qYu6aEojhtSF3uH7MC3e533klNypQ+zyJZGQ61ZAgn6TKGAKb/Dt0+vK+oBpdLS5n800KcXoDqDRW69ZApgyIpBawvrV0DHxr5Gsig8lid390Rh87tcaKR910k/Qad2T4Af5ykCTgt7A2ACRPAPFTs21YiOU6gjuzNIp7gg/KeK8xMfVpLamXefMgERfZfCRm2wCEWntn7atm3yRX6R3BoH+P76Ftj3lApRlW9+VZvdULkwP1P+kn4pt9YZPqPf4hwFg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cCnNe4zYfzKqE5QS6cN114pMCkX8zyo/LYMfeCkYIzvA8aSCVM8FXfmWiDGlj1eV9yLwep1CGJjMI+bhoXrEtr3CAIaR+5jvAlptL/SasPAcuVc9/ep0p0EDr/zyaik257Xin4ecxpRm+bqSw2w+k6+CI4lwEJPdoBvfSUKMCNjkbqyjmoq5nP0hd85wtASkscr1ute4w9bnwHs93M6kZzZlHM5pLWY+Zs6F4kV6adRyvFGHZYDMQZFvCsSDDeUPEZ9/LXeCpmcwJNnrglhC7j3+ZXFgqL9ThRbaqC4V/MB4Ldhpa2ktQL6oKPaPRzCl1+N3dXlDnHluYkqJMi2VpA==
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Arthur Borsboom <arthurborsboom@xxxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, Jens Axboe <axboe@xxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <linux-block@xxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 18 Jan 2021 15:15:52 +0000
  • Ironport-sdr: Y83MYN4NDffAqUbvcFxaH5yKXlhbMq0V3XFE7B9f1x18ewnHbsZtYiX6SMSoyp8/tAoYAUhZcR 4qGfE/Zn8Zcn5CaySklj8hE7YBOGcSgNR6y5jfOLxiI+7ECtfgY/CEWKJy/3WLNT9dB64uhNOx 47PsT1Rj7Vp/WStw3dgWN0lCHwu2iqMraDT9bvnTPElsKzv/8DBwmEgvuInJeFK/UWdxpi3N4B GofwyccRoHg6XfaGF6fPgnM5B2jpspFDkBfz0Ojh4TC1arxm5ZFqmm9QxfQtoa71Mr7n/0qgqv gcU=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Don't require the discard-alignment xenstore node to be present in
order to correctly setup the feature. This can happen with versions of
QEMU that only write the discard-granularity but not the
discard-alignment node.

Assume discard-alignment is 0 if not present. While there also fix the
logic to not enable the discard feature if discard-granularity is not
present.

Reported-by: Arthur Borsboom <arthurborsboom@xxxxxxxxx>
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Cc: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
Cc: Juergen Gross <jgross@xxxxxxxx>
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Cc: "Roger Pau Monné" <roger.pau@xxxxxxxxxx>
Cc: Jens Axboe <axboe@xxxxxxxxx>
Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
Cc: linux-block@xxxxxxxxxxxxxxx
Cc: Arthur Borsboom <arthurborsboom@xxxxxxxxx>
---
 drivers/block/xen-blkfront.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 5265975b3fba..5a93f7cc2939 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -2179,22 +2179,23 @@ static void blkfront_closing(struct blkfront_info *info)
 
 static void blkfront_setup_discard(struct blkfront_info *info)
 {
-       int err;
-       unsigned int discard_granularity;
-       unsigned int discard_alignment;
+       unsigned int discard_granularity = 0;
+       unsigned int discard_alignment = 0;
+       unsigned int discard_secure = 0;
 
-       info->feature_discard = 1;
-       err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
+       xenbus_gather(XBT_NIL, info->xbdev->otherend,
                "discard-granularity", "%u", &discard_granularity,
                "discard-alignment", "%u", &discard_alignment,
+               "discard-secure", "%u", &discard_secure,
                NULL);
-       if (!err) {
-               info->discard_granularity = discard_granularity;
-               info->discard_alignment = discard_alignment;
-       }
-       info->feature_secdiscard =
-               !!xenbus_read_unsigned(info->xbdev->otherend, "discard-secure",
-                                      0);
+
+       if (!discard_granularity)
+               return;
+
+       info->feature_discard = 1;
+       info->discard_granularity = discard_granularity;
+       info->discard_alignment = discard_alignment;
+       info->feature_secdiscard = !!discard_secure;
 }
 
 static int blkfront_setup_indirect(struct blkfront_ring_info *rinfo)
-- 
2.29.2




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.