RE: [RFC v2 PATCH] kvm tools, qcow: Add the support for copy-on-write clusters

2011-11-19 Thread Lan, Tianyu
Yeah. That will make the work quite simple.
After testing, fdatasync is better than fsync.

-Original Message-
From: Sasha Levin [mailto:levinsasha...@gmail.com] 
Sent: Sunday, November 20, 2011 2:23 PM
To: Lan, Tianyu
Cc: Kevin Wolf; penb...@kernel.org; kvm@vger.kernel.org; asias.he...@gmail.com; 
prasadjoshi...@gmail.com
Subject: RE: [RFC v2 PATCH] kvm tools, qcow: Add the support for copy-on-write 
clusters

On Sun, 2011-11-20 at 14:14 +0800, Lan, Tianyu wrote:
> OK. Thx.
> But fsync is too slow. I try to find a way to sync a range of file. 
> Are there any solutions to meet my purpose?

fdatasync() is as good as it'll get.

tbh, maybe we should just consider opening QCOW images with O_SYNC and
just get it over with?

> Thanks
> Tianyu Lan
> 
> -Original Message-
> From: Sasha Levin [mailto:levinsasha...@gmail.com] 
> Sent: Sunday, November 20, 2011 12:27 AM
> To: Lan, Tianyu
> Cc: Kevin Wolf; penb...@kernel.org; kvm@vger.kernel.org; 
> asias.he...@gmail.com; prasadjoshi...@gmail.com
> Subject: RE: [RFC v2 PATCH] kvm tools, qcow: Add the support for 
> copy-on-write clusters
> 
> On Sat, 2011-11-19 at 23:30 +0800, Lan, Tianyu wrote:
> > How about using the sync_file_range to sync the metadata?
> 
> sync_file_range() is only a hint, it doesn't actually assure anything.
> 

-- 

Sasha.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [RFC v2 PATCH] kvm tools, qcow: Add the support for copy-on-write clusters

2011-11-19 Thread Sasha Levin
On Sun, 2011-11-20 at 14:14 +0800, Lan, Tianyu wrote:
> OK. Thx.
> But fsync is too slow. I try to find a way to sync a range of file. 
> Are there any solutions to meet my purpose?

fdatasync() is as good as it'll get.

tbh, maybe we should just consider opening QCOW images with O_SYNC and
just get it over with?

> Thanks
> Tianyu Lan
> 
> -Original Message-
> From: Sasha Levin [mailto:levinsasha...@gmail.com] 
> Sent: Sunday, November 20, 2011 12:27 AM
> To: Lan, Tianyu
> Cc: Kevin Wolf; penb...@kernel.org; kvm@vger.kernel.org; 
> asias.he...@gmail.com; prasadjoshi...@gmail.com
> Subject: RE: [RFC v2 PATCH] kvm tools, qcow: Add the support for 
> copy-on-write clusters
> 
> On Sat, 2011-11-19 at 23:30 +0800, Lan, Tianyu wrote:
> > How about using the sync_file_range to sync the metadata?
> 
> sync_file_range() is only a hint, it doesn't actually assure anything.
> 

-- 

Sasha.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [RFC v2 PATCH] kvm tools, qcow: Add the support for copy-on-write clusters

2011-11-19 Thread Lan, Tianyu
OK. Thx.
But fsync is too slow. I try to find a way to sync a range of file. 
Are there any solutions to meet my purpose?

Thanks
Tianyu Lan

-Original Message-
From: Sasha Levin [mailto:levinsasha...@gmail.com] 
Sent: Sunday, November 20, 2011 12:27 AM
To: Lan, Tianyu
Cc: Kevin Wolf; penb...@kernel.org; kvm@vger.kernel.org; asias.he...@gmail.com; 
prasadjoshi...@gmail.com
Subject: RE: [RFC v2 PATCH] kvm tools, qcow: Add the support for copy-on-write 
clusters

On Sat, 2011-11-19 at 23:30 +0800, Lan, Tianyu wrote:
> How about using the sync_file_range to sync the metadata?

sync_file_range() is only a hint, it doesn't actually assure anything.

-- 

Sasha.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [RFC v2 PATCH] kvm tools, qcow: Add the support for copy-on-write clusters

2011-11-19 Thread Sasha Levin
On Sat, 2011-11-19 at 23:30 +0800, Lan, Tianyu wrote:
> How about using the sync_file_range to sync the metadata?

sync_file_range() is only a hint, it doesn't actually assure anything.

-- 

Sasha.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [RFC v2 PATCH] kvm tools, qcow: Add the support for copy-on-write clusters

2011-11-19 Thread Lan, Tianyu
How about using the sync_file_range to sync the metadata?

-Original Message-
From: kvm-ow...@vger.kernel.org [mailto:kvm-ow...@vger.kernel.org] On Behalf Of 
Lan, Tianyu
Sent: Saturday, November 19, 2011 10:09 AM
To: Kevin Wolf
Cc: penb...@kernel.org; kvm@vger.kernel.org; asias.he...@gmail.com; 
levinsasha...@gmail.com; prasadjoshi...@gmail.com
Subject: RE: [RFC v2 PATCH] kvm tools, qcow: Add the support for copy-on-write 
clusters

Hi Kevin:
Thanks for your review. The following means that there should be a 
fsync after updating 
metadata(refcunt block, l1 table and l2 table).

Thanks 
Tianyu Lan

-Original Message-
> + /*write l2 table*/
> + l2t->dirty = 1;
> + if (qcow_l2_cache_write(q, l2t) < 0)
>   goto free_cache;

You need to make sure that the refcount update is written first (e.g.
with fsync), otherwise you risk corruption when the host crashes in the middle.

>  
> - if (cache_table(q, l2t) < 0) {
> - if (ftruncate(q->fd, f_sz) < 0)
> - goto free_cache;
> + /* Update the l1 talble */
> + l1t->l1_table[l1t_idx] = cpu_to_be64(l2t_new_offset
> + | QCOW2_OFLAG_COPIED);
>  
> - goto free_cache;
> - }
> + if (pwrite_in_full(q->fd, l1t->l1_table,
> + l1t->table_size * sizeof(u64),
> + header->l1_table_offset) < 0)
> + goto error;

Likewise, the L1 table write must be ordered against the L2 write.

goto error is using the wrong label.

>  
> - /* Update the in-core entry */
> - l1t->l1_table[l1t_idx] = cpu_to_be64(l2t_offset);
> + /*cache l2 table*/
> + cache_table(q, l2t);

After so many explicit comments, you can probably guess what's wrong here...
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: KVM for the enterprise

2011-11-19 Thread Christoph Hellwig
On Fri, Nov 18, 2011 at 11:25:38AM -0500, Michael Waite wrote:
>  Hi,
> The Open Virtualization Alliance is going to be having a webinar on
> December 8th which is intended to help promote KVM as an enterprise
> class hypervisor. I see so much great engineering work going on to
> make KVM a really robust technology and we want to help tell this
> story to the world-wide audience.

Maybe it's time to create a kvm-marketing@whatever list for sneaky
marketing BS from people like you instead of spamming development lists
like this one?

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html