On 12/25/2012 03:47 PM, MORITA Kazutaka wrote:
> I wonder if we should disable cache when cache=none.  Many management
> frontend uses cache=none by default but, I think, users still expect
> that data is cached (e.g. by disk write cache when a raw format is
> used).  cache=none only means that the host page cache is not used for
> VM disk IO.
> 
> In that sense,
> 

I am fine to adopt option to this semantics.

>> > @@ -1118,12 +1118,19 @@ static int sd_open(BlockDriverState *bs, const 
>> > char *filename, int flags)
>> >          goto out;
>> >      }
>> >  
>> > -    s->cache_enabled = true;
>> > -    s->flush_fd = connect_to_sdog(s->addr, s->port);
>> > -    if (s->flush_fd < 0) {
>> > -        error_report("failed to connect");
>> > -        ret = s->flush_fd;
>> > -        goto out;
>> > +    if (flags & BDRV_O_NOCACHE) {
>> > +        s->cache_flags = SD_FLAG_CMD_DIRECT;
>> > +    } else if (flags & BDRV_O_CACHE_WB) {
> 'else' should be removed, and
> 

Seems should not. We need this 'else if' to allow writethrough flag.

>> > +        s->cache_flags = SD_FLAG_CMD_CACHE;
>> > +    }
>> > +
>> > +    if (s->cache_flags != SD_FLAG_CMD_DIRECT) {
> should be 's->cache_flags == SD_FLAG_CMD_CACHE'?  Do we need to send a
> flush request when cache=writethourgh?

Looks good to me. I'll change it at V2.

Thanks,
Yuan


Reply via email to