linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: "Jürgen Groß" <jgross@suse.com>
Cc: <linux-kernel@vger.kernel.org>,
	Arthur Borsboom <arthurborsboom@gmail.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Jens Axboe <axboe@kernel.dk>, <xen-devel@lists.xenproject.org>,
	<linux-block@vger.kernel.org>
Subject: Re: [PATCH] xen-blkfront: don't make discard-alignment mandatory
Date: Tue, 19 Jan 2021 11:06:51 +0100	[thread overview]
Message-ID: <20210119100651.afyccratx6ha52kc@Air-de-Roger> (raw)
In-Reply-To: <7cef385d-efe3-2661-bee2-9d21f159a5fb@suse.com>

On Tue, Jan 19, 2021 at 08:43:01AM +0100, Jürgen Groß wrote:
> On 18.01.21 16:15, Roger Pau Monne wrote:
> > 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@gmail.com>
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> > ---
> > Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> > Cc: Juergen Gross <jgross@suse.com>
> > Cc: Stefano Stabellini <sstabellini@kernel.org>
> > Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > Cc: "Roger Pau Monné" <roger.pau@citrix.com>
> > Cc: Jens Axboe <axboe@kernel.dk>
> > Cc: xen-devel@lists.xenproject.org
> > Cc: linux-block@vger.kernel.org
> > Cc: Arthur Borsboom <arthurborsboom@gmail.com>
> > ---
> >   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);
> 
> This would mean that "discard-secure" will be evaluated only if the
> other two items are set in Xenstore. From blkif.h I can't see this is
> required, and your patch is modifying today's behavior in this regard.
> 
> You might want to have three xenbus_read_unsigned() calls instead.

You are right, discard-secure should be fetched regardless of whether
discard-alignment exists.

I can fetch discard-granularity and discard-alignment using
xenbus_gather and keep discard-secure using xenbus_read_unsigned. Let
me send a new version.

Thanks, Roger.

  reply	other threads:[~2021-01-19 10:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-18 15:15 [PATCH] xen-blkfront: don't make discard-alignment mandatory Roger Pau Monne
2021-01-19  7:43 ` Jürgen Groß
2021-01-19 10:06   ` Roger Pau Monné [this message]
2021-01-19 10:11     ` Jürgen Groß
2021-01-19 10:21       ` Roger Pau Monné

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=20210119100651.afyccratx6ha52kc@Air-de-Roger \
    --to=roger.pau@citrix.com \
    --cc=arthurborsboom@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jgross@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.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 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).