Skip to contentSkip to conversation

iSCSI support for QEMU, update

Qemu-devel [email protected] 2 participants 6 messages Apr 21, 2011 – Apr 22, 2011

lore
Share & tools
lore
#0 lore raw

iSCSI block driver for QEMU

Please find an updated iSCSI patch.
This patch adds setting FUA on all writes when the bit BDRV_O_CACHE_WB is not set.

regards
ronnie sahlberg

From: Ronnie Sahlberg <[email protected]>
Subject: iSCSI support for QEMU, update In-Reply-To:

#1 lore raw
Quoted 5 lines · On Fri, Apr 22, 2011 at 06:23:58AM +1000, [email protected] wrote:

iSCSI block driver for QEMU

Please find an updated iSCSI patch.
This patch adds setting FUA on all writes when the bit BDRV_O_CACHE_WB is not set.

At this point you need to check for BDRV_O_CACHE_WB and BDRV_O_NOCACHE as they both have writeback cache semantics. I submitted a patch to clean that up, but it didn't get merged yet.

#2 lore raw

Thanks,

Quoted 11 lines · Christoph Hellwig
Quoted 5 lines · On Fri, Apr 22, 2011 at 06:23:58AM +1000, [email protected] wrote:

iSCSI block driver for QEMU

Please find an updated iSCSI patch.
This patch adds setting FUA on all writes when the bit BDRV_O_CACHE_WB is not set.

At this point you need to check for BDRV_O_CACHE_WB and BDRV_O_NOCACHE as they both have writeback cache semantics.  I submitted a patch to clean that up, but it didn't get merged yet.

So I should set FUA when
BDRV_O_CACHE_WB==0 or BDRV_O_NOCACHE==1
right?

regards
ronnie sahlberg

#3 lore raw
Quoted 3 lines · ronnie sahlberg

So I should set FUA when
BDRV_O_CACHE_WB==0 or BDRV_O_NOCACHE==1
right?

At this point you need to set it if either the BDRV_O_CACHE_WB and BDRV_O_NOCACHE flags are set. And yes, the naming of the nocache flag is rather confusing.

Take a look at block.c:bdrv_open_common():

/*
* Yes, BDRV_O_NOCACHE aka O_DIRECT means we have to present a
* write cache to the guest. We do need the fdatasync to flush
* out transactions for block allocations, and we maybe have a
* volatile write cache in our backing device to deal with. */
if (flags & (BDRV_O_CACHE_WB|BDRV_O_NOCACHE))
bs->enable_write_cache = 1;

#4 lore raw

Ok, I am confused

Quoted 11 lines · Christoph Hellwig
Quoted 3 lines · ronnie sahlberg

So I should set FUA when
BDRV_O_CACHE_WB==0  or  BDRV_O_NOCACHE==1
right?

At this point you need to set it if either the BDRV_O_CACHE_WB and BDRV_O_NOCACHE flags are set.  And yes, the naming of the nocache flag is rather confusing.

Take a look at block.c:bdrv_open_common():

Quoted 9 lines

   /*
    * Yes, BDRV_O_NOCACHE aka O_DIRECT means we have to present a
    * write cache to the guest.  We do need the fdatasync to flush
    * out transactions for block allocations, and we maybe have a
    * volatile write cache in our backing device to deal with. */
   if (flags & (BDRV_O_CACHE_WB|BDRV_O_NOCACHE)) bs->enable_write_cache = 1;

I have to set FUA if the WB(I guessed this meant write-back) flag is set? Not the opposite (I assume opposite of write-back is write-through) ?

So that would mean
if (flags & (BDRV_O_CACHE_WB|BDRV_O_NOCACHE))
caching is NOT ok, write with FUA=1
else
caching is ok, write with FUA=0
right ?

regards
ronnie sahlberg

#5 lore raw
Quoted 1 line · ronnie sahlberg

Ok, I am confused

And this time it's my fault, sorry.

Quoted 2 lines

I have to set FUA if the WB(I guessed this meant write-back) flag is set? Not the opposite (I assume opposite of write-back is write-through) ?

Sorry, I meant exactly the opposite. You do not have to set FUA if either of those two flags is present, so:

if (flags & (BDRV_O_CACHE_WB|BDRV_O_NOCACHE))
caching is ok, write with FUA=0
else
caching is NOT ok, write with FUA=1