qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Liu Yuan <namei.unix@gmail.com>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org,
	MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Subject: Re: [Qemu-devel] [PATCH] sheepdog: implement SD_OP_FLUSH_VDI operation
Date: Tue, 03 Apr 2012 13:14:54 +0800	[thread overview]
Message-ID: <4F7A874E.5050404@gmail.com> (raw)
In-Reply-To: <4F7A05A2.4010301@msgid.tls.msk.ru>

On 04/03/2012 04:01 AM, Michael Tokarev wrote:

> On 02.04.2012 21:35, Liu Yuan wrote:
>> From: Liu Yuan <tailai.ly@taobao.com>
>>
>> Flush operation is supposed to flush the write-back cache of
>> sheepdog cluster.
>>
>> By issuing flush operation, we can assure the Guest of data
>> reaching the sheepdog cluster storage.
>>
>> Cc: Kevin Wolf <kwolf@redhat.com>
>> Reviewd-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
>> Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
>> ---
>>  block/sheepdog.c |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
>>  1 files changed, 50 insertions(+), 0 deletions(-)
>>
>> diff --git a/block/sheepdog.c b/block/sheepdog.c
>> index 00276f6f..c08c69b 100644
>> --- a/block/sheepdog.c
>> +++ b/block/sheepdog.c
>> @@ -32,9 +32,11 @@
>>  #define SD_OP_RELEASE_VDI    0x13
>>  #define SD_OP_GET_VDI_INFO   0x14
>>  #define SD_OP_READ_VDIS      0x15
>> +#define SD_OP_FLUSH_VDI      0x16
>>  
>>  #define SD_FLAG_CMD_WRITE    0x01
>>  #define SD_FLAG_CMD_COW      0x02
>> +#define SD_FLAG_CMD_CACHE    0x04
>>  
>>  #define SD_RES_SUCCESS       0x00 /* Success */
>>  #define SD_RES_UNKNOWN       0x01 /* Unknown error */
>> @@ -179,6 +181,8 @@ typedef struct SheepdogInode {
>>      uint32_t data_vdi_id[MAX_DATA_OBJS];
>>  } SheepdogInode;
>>  
>> +static int cache_enabled;
> 
> Why it is a global property instead of per-device
> (in BDRVSheepdogState) property?
> 
>> @@ -1011,6 +1024,10 @@ static int sd_open(BlockDriverState *bs, const char *filename, int flags)
>>      QLIST_INIT(&s->outstanding_aio_head);
>>      s->fd = -1;
>>  
>> +    if (flags & BDRV_O_CACHE_WB) {
>> +            cache_enabled = 1;
>> +    }
> 
> You test per-device flag here, and set a global variable, why?
> 




Hi Michael,
	Yes, I'd better embed this variable into BDRVSheepdogState.

>> +static int coroutine_fn sd_co_flush_to_disk(BlockDriverState *bs)
>> +{
>> +    BDRVSheepdogState *s = bs->opaque;
>> +    SheepdogObjReq hdr = { 0 };
>> +    SheepdogObjRsp *rsp = (SheepdogObjRsp *)&hdr;
>> +    SheepdogInode *inode = &s->inode;
>> +    int fd, ret;
>> +    unsigned int wlen = 0, rlen = 0;
>> +
>> +    fd = connect_to_sdog(s->addr, s->port);
>> +    if (fd < 0) {
>> +        return -1;
>> +    }
> 
> Do you really need _another_ connection here?


I am unsure if I can use bs->fd or not, Kazum, would you please check
this usage? I tried use bs->fd in V2 and everything goes okay.

Thanks,
Yuan

  reply	other threads:[~2012-04-03  5:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-02 17:35 [Qemu-devel] [PATCH] sheepdog: implement SD_OP_FLUSH_VDI operation Liu Yuan
2012-04-02 20:01 ` Michael Tokarev
2012-04-03  5:14   ` Liu Yuan [this message]
2012-04-03  5:15   ` [Qemu-devel] [PATCH v2] " Liu Yuan
2012-04-03  7:23     ` Stefan Hajnoczi
2012-04-03  8:35       ` [Qemu-devel] [PATCH v3] " Liu Yuan
2012-04-03  9:12         ` Kevin Wolf
2012-04-03 10:04           ` [Qemu-devel] RE. [PATCH] sheepdog: fix send req helpers Liu Yuan
2012-04-03 11:13             ` MORITA Kazutaka
2012-04-03 11:34               ` Kevin Wolf
2012-04-03  9:52         ` [Qemu-devel] [PATCH v3] sheepdog: implement SD_OP_FLUSH_VDI operation MORITA Kazutaka
2012-04-03  9:58           ` [Qemu-devel] [PATCH v4] " Liu Yuan
2012-04-03 10:08             ` [Qemu-devel] [PATCH v4 UPDATE] " Liu Yuan
2012-04-03 10:32               ` MORITA Kazutaka
2012-04-03 10:30                 ` Kevin Wolf
2012-04-03 20:03                   ` [Qemu-devel] [PATCH v5] " Liu Yuan
2012-04-04  8:53                     ` Kevin Wolf
2012-04-04  8:58                       ` Liu Yuan
2012-04-04  9:20                         ` Kevin Wolf

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=4F7A874E.5050404@gmail.com \
    --to=namei.unix@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=mjt@tls.msk.ru \
    --cc=morita.kazutaka@lab.ntt.co.jp \
    --cc=qemu-devel@nongnu.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).