[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1.1 19/22] block: implement is_allocated for raw
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH 1.1 19/22] block: implement is_allocated for raw |
Date: |
Wed, 09 May 2012 15:40:39 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 |
Am 08.05.2012 16:51, schrieb Paolo Bonzini:
> Either FIEMAP, or SEEK_DATA+SEEK_HOLE can be used to implement the
> is_allocated callback for raw files. Ext4, btrfs and XFS all support
> it.
>
> Signed-off-by: Paolo Bonzini <address@hidden>
This is for 1.2, I'll queue it in block-next.
> ---
> block/raw-posix.c | 102
> +++++++++++++++++++++++++++++++++++++++++++++++++++++
> block/raw.c | 8 +++++
> 2 files changed, 110 insertions(+)
>
> diff --git a/block/raw-posix.c b/block/raw-posix.c
> index 03fcfcc..6753c73 100644
> --- a/block/raw-posix.c
> +++ b/block/raw-posix.c
> @@ -52,6 +52,10 @@
> #include <sys/param.h>
> #include <linux/cdrom.h>
> #include <linux/fd.h>
> +#include <linux/fs.h>
> +#endif
> +#ifdef CONFIG_FIEMAP
> +#include <linux/fiemap.h>
> #endif
> #if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
> #include <sys/disk.h>
> @@ -104,6 +108,13 @@
> #define O_DIRECT O_DSYNC
> #endif
>
> +#ifndef SEEK_DATA
> +#define SEEK_DATA 3
> +#endif
> +#ifndef SEEK_HOLE
> +#define SEEK_HOLE 4
> +#endif
How is that going to be portable? You assume that on non-Linux you'll
get -EINVAL, but what does guarantee that 3 or 4 aren't already used for
the standard SEEK_* constants or for a different non-standard extension?
Kevin
- [Qemu-devel] [PATCH 1.1 18/22] stream: do not copy unallocated sectors from the base, (continued)
- [Qemu-devel] [PATCH 1.1 18/22] stream: do not copy unallocated sectors from the base, Paolo Bonzini, 2012/05/08
- [Qemu-devel] [PATCH 1.1 20/22] stream: tweak usage of bdrv_co_is_allocated, Paolo Bonzini, 2012/05/08
- [Qemu-devel] [PATCH 1.1 21/22] stream: move is_allocated_above to block.c, Paolo Bonzini, 2012/05/08
- [Qemu-devel] [PATCH 1.1 22/22] stream: move rate limiting to a separate header file, Paolo Bonzini, 2012/05/08
- [Qemu-devel] [PATCH 1.1 11/22] qemu-io: correctly print non-integer values as decimals, Paolo Bonzini, 2012/05/08
- [Qemu-devel] [PATCH 1.1 19/22] block: implement is_allocated for raw, Paolo Bonzini, 2012/05/08
- Re: [Qemu-devel] [PATCH 1.1 19/22] block: implement is_allocated for raw,
Kevin Wolf <=
[Qemu-devel] [PATCH 1.1 12/22] qemu-io: fix the alloc command, Paolo Bonzini, 2012/05/08