All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Dongyang <lidongyang@novell.com>
To: Jan Beulich <JBeulich@novell.com>
Cc: xen-devel@lists.xensource.com, owen.smith@citrix.com
Subject: Re: [PATCH V3 1/3] xen-blkback: add BLKIF_OP_TRIM and backend types
Date: Thu, 25 Aug 2011 14:34:14 +0800	[thread overview]
Message-ID: <CAKH3R4_T9sysco_KwPUzv22Ny2UiAxNwsaCE9pvcvTALm=upDQ@mail.gmail.com> (raw)
In-Reply-To: <4E54EE080200007800052DEC@victor.provo.novell.com>

On Wed, Aug 24, 2011 at 6:26 PM, Jan Beulich <JBeulich@novell.com> wrote:
>>>> On 24.08.11 at 11:23, Li Dongyang <lidongyang@novell.com> wrote:
>> This adds the BLKIF_OP_TRIM for blkfront and blkback, also 2 enums telling
>> us the type of the backend, used in blkback to determine what to do when we
>> see a trim request.
>> The BLKIF_OP_TRIM part is just taken from Owen Smith, Thanks
>>
>> Signed-off-by: Owen Smith <owen.smith@citrix.com>
>> Signed-off-by: Li Dongyang <lidongyang@novell.com>
>> ---
>>  drivers/block/xen-blkback/common.h |   10 +++++++++-
>>  include/xen/interface/io/blkif.h   |   19 +++++++++++++++++++
>>  2 files changed, 28 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/block/xen-blkback/common.h
>> b/drivers/block/xen-blkback/common.h
>> index 9e40b28..146d325 100644
>> --- a/drivers/block/xen-blkback/common.h
>> +++ b/drivers/block/xen-blkback/common.h
>> @@ -113,6 +113,11 @@ enum blkif_protocol {
>>       BLKIF_PROTOCOL_X86_64 = 3,
>>  };
>>
>> +enum blkif_backend_type {
>> +     BLKIF_BACKEND_PHY  = 1,
>> +     BLKIF_BACKEND_FILE = 2,
>> +};
>> +
>>  struct xen_vbd {
>>       /* What the domain refers to this vbd as. */
>>       blkif_vdev_t            handle;
>> @@ -138,6 +143,7 @@ struct xen_blkif {
>>       unsigned int            irq;
>>       /* Comms information. */
>>       enum blkif_protocol     blk_protocol;
>> +     enum blkif_backend_type blk_backend_type;
>>       union blkif_back_rings  blk_rings;
>>       struct vm_struct        *blk_ring_area;
>>       /* The VBD attached to this interface. */
>> @@ -159,8 +165,10 @@ struct xen_blkif {
>>       int                     st_wr_req;
>>       int                     st_oo_req;
>>       int                     st_f_req;
>> +     int                     st_tr_req;
>>       int                     st_rd_sect;
>>       int                     st_wr_sect;
>> +     int                     st_tr_sect;
>
> Just to repeat - I don't think this piece of statistic is very useful, the
> more that you use "int" here while ...
>
>>
>>       wait_queue_head_t       waiting_to_free;
>>
>> @@ -182,7 +190,7 @@ struct xen_blkif {
>>
>>  struct phys_req {
>>       unsigned short          dev;
>> -     unsigned short          nr_sects;
>> +     blkif_sector_t          nr_sects;
>
> ... you specifically widen the field to 64 bits here.
>
sounds reasonable, gonna kill the stat stuff
> Also, all of the changes to this header look somewhat misplaced, they
> should rather be part of the backend patch.
>
> Jan
>
>>       struct block_device     *bdev;
>>       blkif_sector_t          sector_number;
>>  };
>> diff --git a/include/xen/interface/io/blkif.h
>> b/include/xen/interface/io/blkif.h
>> index 3d5d6db..43762dd 100644
>> --- a/include/xen/interface/io/blkif.h
>> +++ b/include/xen/interface/io/blkif.h
>> @@ -57,6 +57,19 @@ typedef uint64_t blkif_sector_t;
>>   * "feature-flush-cache" node!
>>   */
>>  #define BLKIF_OP_FLUSH_DISKCACHE   3
>> +
>> +/*
>> + * Recognised only if "feature-trim" is present in backend xenbus info.
>> + * The "feature-trim" node contains a boolean indicating whether trim
>> + * requests are likely to succeed or fail. Either way, a trim request
>> + * may fail at any time with BLKIF_RSP_EOPNOTSUPP if it is unsupported by
>> + * the underlying block-device hardware. The boolean simply indicates
>> whether
>> + * or not it is worthwhile for the frontend to attempt trim requests.
>> + * If a backend does not recognise BLKIF_OP_TRIM, it should *not*
>> + * create the "feature-trim" node!
>> + */
>> +#define BLKIF_OP_TRIM              5
>> +
>>  /*
>>   * Maximum scatter/gather segments per request.
>>   * This is carefully chosen so that sizeof(struct blkif_ring) <= PAGE_SIZE.
>> @@ -74,6 +87,11 @@ struct blkif_request_rw {
>>       } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
>>  };
>>
>> +struct blkif_request_trim {
>> +     blkif_sector_t sector_number;
>> +     uint64_t nr_sectors;
>> +};
>> +
>>  struct blkif_request {
>>       uint8_t        operation;    /* BLKIF_OP_???                         */
>>       uint8_t        nr_segments;  /* number of segments                   */
>> @@ -81,6 +99,7 @@ struct blkif_request {
>>       uint64_t       id;           /* private guest value, echoed in resp  */
>>       union {
>>               struct blkif_request_rw rw;
>> +             struct blkif_request_trim trim;
>>       } u;
>>  };
>>
>
>
>
>

  parent reply	other threads:[~2011-08-25  6:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-24  9:23 [PATCH V3 0/3] xen-blkfront/xen-blkback trim support Li Dongyang
2011-08-24  9:23 ` [PATCH V3 1/3] xen-blkback: add BLKIF_OP_TRIM and backend types Li Dongyang
2011-08-24 10:26   ` Jan Beulich
     [not found]   ` <4E54EE080200007800052DEC@victor.provo.novell.com>
2011-08-25  6:34     ` Li Dongyang [this message]
2011-08-25  7:00       ` Jan Beulich
2011-08-24  9:23 ` [PATCH V3 2/3] xen-blkfront: teach blkfront driver handle trim request Li Dongyang
2011-08-24 10:42   ` Jan Beulich
     [not found]   ` <4E54F1C20200007800052DF8@victor.provo.novell.com>
2011-08-25  6:37     ` Li Dongyang
2011-08-25  7:03       ` Jan Beulich
2011-08-24  9:23 ` [PATCH V3 3/3] xen-blkback: handle trim request in backend driver Li Dongyang
2011-08-26 17:18   ` Konrad Rzeszutek Wilk
2011-08-24 14:17 ` [PATCH V3 0/3] xen-blkfront/xen-blkback trim support Pasi Kärkkäinen
2011-08-26 17:10   ` Konrad Rzeszutek Wilk
2011-08-29  7:47     ` Li Dongyang
2011-08-29 15:32       ` Konrad Rzeszutek Wilk
2011-08-26 16:56 ` Konrad Rzeszutek Wilk
2011-08-29  7:50   ` Li Dongyang
2011-08-29 15:31     ` Konrad Rzeszutek Wilk
2011-08-31  9:41       ` Li Dongyang

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='CAKH3R4_T9sysco_KwPUzv22Ny2UiAxNwsaCE9pvcvTALm=upDQ@mail.gmail.com' \
    --to=lidongyang@novell.com \
    --cc=JBeulich@novell.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.