All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@novell.com>
To: Li Dongyang <jerry87905@gmail.com>
Cc: xen-devel@lists.xensource.com, owen.smith@citrix.com
Subject: Re: [PATCH V2 2/3] xen-blkfront: teach blkfront driver handle trim request
Date: Mon, 22 Aug 2011 10:55:51 +0100	[thread overview]
Message-ID: <4E5243C702000078000526D5@nat28.tlf.novell.com> (raw)
In-Reply-To: <CAKH3R4-e2pd4kyLdDf9wLyMLQDUGmbcAjGhqOugfuoRvMGDqMg@mail.gmail.com>

>>> On 22.08.11 at 11:19, Li Dongyang <jerry87905@gmail.com> wrote:
> On Thu, Aug 18, 2011 at 6:18 PM, Jan Beulich <JBeulich@novell.com> wrote:
>>        >>> On 18.08.11 at 11:35, Li Dongyang <lidongyang@novell.com> wrote:
>>> @@ -1178,7 +1211,24 @@ static void blkfront_connect(struct blkfront_info
>>> *info)
>>>               info->feature_flush = REQ_FLUSH;
>>>               info->flush_op = BLKIF_OP_FLUSH_DISKCACHE;
>>>       }
>>> -
>>> +
>>> +     err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
>>> +                         "feature-trim", "%d", &trim,
>>> +                         NULL);
>>
>> So you switched this to use "trim", but ...
>>
>>> +
>>> +     if (!err && trim) {
>>> +             info->feature_trim = 1;
>>> +             err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
>>> +                     "discard_granularity", "%u", &discard_granularity,
>>> +                     "discard_alignment", "%u", &discard_alignment,
>>
>> ... you kept these using "discard" - quite inconsistent.
> the discard_granularity and discard_alignment are taken from struct 
> queue_limits
> they are needed to setup the queue in guest if we are using a phy
> device has trim.
> so I think we can keep the names here.

The way Linux names them doesn't matter for the xenstore interface.
I think they should be named so that the connection to the base
node's name is obvious.

>>
>> Also, I think (but I may be wrong) that dashes are preferred over
>> underscores in xenstore node names.
> that could be done in xenstore, I used dashes because they are taken
> from struct queue_limits
>>
>>> +                     NULL);
>>> +             if (!err) {
>>> +                     info->discard_granularity = discard_granularity;
>>> +                     info->discard_alignment = discard_alignment;
>>
>> I think you should set info->feature_trim only here (and then you can
>> eliminate the local variables).
> those discard_granularity and discard_alignment are only meaningful if
> the backend is a phy device has trim,
> and the 2 args are read from the queue limits from host. if the
> backend is a file, we can go with no discard_granularity
> and discard_alignment because we are about to punch a hole in the image 
> file.

Then you should update the condition accordingly. Setting
info->feature_trim prematurely is just calling for later problems.

Jan

  reply	other threads:[~2011-08-22  9:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <6688c4e4.427@victor.provo.novell.com>
2011-08-18 10:18 ` <subject missing #2> Jan Beulich
     [not found] ` <4E4D02F80200007800051CB6@victor.provo.novell.com>
2011-08-22  9:19   ` Li Dongyang
2011-08-22  9:55     ` Jan Beulich [this message]
2011-08-18  9:34 [PATCH V2 0/3] xen-blkfront/xen-blkback trim support Li Dongyang
2011-08-18  9:34 ` [PATCH V2 2/3] xen-blkfront: teach blkfront driver handle trim request Li Dongyang
2011-08-18 15:05   ` Konrad Rzeszutek Wilk

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=4E5243C702000078000526D5@nat28.tlf.novell.com \
    --to=jbeulich@novell.com \
    --cc=jerry87905@gmail.com \
    --cc=owen.smith@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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.