qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block/nfs: fix calculation of allocated file size
@ 2015-08-20 10:46 Peter Lieven
  2015-08-21 16:33 ` Max Reitz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Peter Lieven @ 2015-08-20 10:46 UTC (permalink / raw)
  To: qemu-devel, qemu-block; +Cc: kwolf, jcody, Peter Lieven, qemu-stable

st.st_blocks is always counted in 512 byte units. Do not
use st.st_blksize as multiplicator which may be larger.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Lieven <pl@kamp.de>
---
 block/nfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/nfs.c b/block/nfs.c
index c026ff6..02eb4e4 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -475,7 +475,7 @@ static int64_t nfs_get_allocated_file_size(BlockDriverState *bs)
         aio_poll(client->aio_context, true);
     }
 
-    return (task.ret < 0 ? task.ret : st.st_blocks * st.st_blksize);
+    return (task.ret < 0 ? task.ret : st.st_blocks * 512);
 }
 
 static int nfs_file_truncate(BlockDriverState *bs, int64_t offset)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] block/nfs: fix calculation of allocated file size
  2015-08-20 10:46 [Qemu-devel] [PATCH] block/nfs: fix calculation of allocated file size Peter Lieven
@ 2015-08-21 16:33 ` Max Reitz
  2015-08-26 15:42 ` Jeff Cody
  2015-08-26 18:38 ` Jeff Cody
  2 siblings, 0 replies; 4+ messages in thread
From: Max Reitz @ 2015-08-21 16:33 UTC (permalink / raw)
  To: Peter Lieven, qemu-devel, qemu-block; +Cc: kwolf, jcody, qemu-stable

On 2015-08-20 at 03:46, Peter Lieven wrote:
> st.st_blocks is always counted in 512 byte units. Do not
> use st.st_blksize as multiplicator which may be larger.
>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Peter Lieven <pl@kamp.de>
> ---
>   block/nfs.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/nfs.c b/block/nfs.c
> index c026ff6..02eb4e4 100644
> --- a/block/nfs.c
> +++ b/block/nfs.c
> @@ -475,7 +475,7 @@ static int64_t nfs_get_allocated_file_size(BlockDriverState *bs)
>           aio_poll(client->aio_context, true);
>       }
>   
> -    return (task.ret < 0 ? task.ret : st.st_blocks * st.st_blksize);
> +    return (task.ret < 0 ? task.ret : st.st_blocks * 512);
>   }
>   
>   static int nfs_file_truncate(BlockDriverState *bs, int64_t offset)

Reviewed-by: Max Reitz <mreitz@redhat.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] block/nfs: fix calculation of allocated file size
  2015-08-20 10:46 [Qemu-devel] [PATCH] block/nfs: fix calculation of allocated file size Peter Lieven
  2015-08-21 16:33 ` Max Reitz
@ 2015-08-26 15:42 ` Jeff Cody
  2015-08-26 18:38 ` Jeff Cody
  2 siblings, 0 replies; 4+ messages in thread
From: Jeff Cody @ 2015-08-26 15:42 UTC (permalink / raw)
  To: Peter Lieven; +Cc: kwolf, qemu-devel, qemu-block, qemu-stable

On Thu, Aug 20, 2015 at 12:46:47PM +0200, Peter Lieven wrote:
> st.st_blocks is always counted in 512 byte units. Do not
> use st.st_blksize as multiplicator which may be larger.
> 
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Peter Lieven <pl@kamp.de>
> ---
>  block/nfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/nfs.c b/block/nfs.c
> index c026ff6..02eb4e4 100644
> --- a/block/nfs.c
> +++ b/block/nfs.c
> @@ -475,7 +475,7 @@ static int64_t nfs_get_allocated_file_size(BlockDriverState *bs)
>          aio_poll(client->aio_context, true);
>      }
>  
> -    return (task.ret < 0 ? task.ret : st.st_blocks * st.st_blksize);
> +    return (task.ret < 0 ? task.ret : st.st_blocks * 512);
>  }
>  
>  static int nfs_file_truncate(BlockDriverState *bs, int64_t offset)
> -- 
> 1.9.1
> 

Reviewed-by: Jeff Cody <jcody@redhat.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] block/nfs: fix calculation of allocated file size
  2015-08-20 10:46 [Qemu-devel] [PATCH] block/nfs: fix calculation of allocated file size Peter Lieven
  2015-08-21 16:33 ` Max Reitz
  2015-08-26 15:42 ` Jeff Cody
@ 2015-08-26 18:38 ` Jeff Cody
  2 siblings, 0 replies; 4+ messages in thread
From: Jeff Cody @ 2015-08-26 18:38 UTC (permalink / raw)
  To: Peter Lieven; +Cc: kwolf, qemu-devel, qemu-block, qemu-stable

On Thu, Aug 20, 2015 at 12:46:47PM +0200, Peter Lieven wrote:
> st.st_blocks is always counted in 512 byte units. Do not
> use st.st_blksize as multiplicator which may be larger.
> 
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Peter Lieven <pl@kamp.de>
> ---
>  block/nfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/nfs.c b/block/nfs.c
> index c026ff6..02eb4e4 100644
> --- a/block/nfs.c
> +++ b/block/nfs.c
> @@ -475,7 +475,7 @@ static int64_t nfs_get_allocated_file_size(BlockDriverState *bs)
>          aio_poll(client->aio_context, true);
>      }
>  
> -    return (task.ret < 0 ? task.ret : st.st_blocks * st.st_blksize);
> +    return (task.ret < 0 ? task.ret : st.st_blocks * 512);
>  }
>  
>  static int nfs_file_truncate(BlockDriverState *bs, int64_t offset)
> -- 
> 1.9.1
>

Thanks, applied to my block tree:

git://github.com/codyprime/qemu-kvm-jtc.git block

-Jeff

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-08-26 18:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-20 10:46 [Qemu-devel] [PATCH] block/nfs: fix calculation of allocated file size Peter Lieven
2015-08-21 16:33 ` Max Reitz
2015-08-26 15:42 ` Jeff Cody
2015-08-26 18:38 ` Jeff Cody

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).