search for: can_zero_range

Displaying 20 results from an estimated 27 matches for "can_zero_range".

2018 Aug 03
0
[PATCH v2 1/4] file: Avoid unsupported fallocate() calls
...@@ -33,6 +33,7 @@ #include <config.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -118,6 +119,8 @@ file_config_complete (void) /* The per-connection handle. */ struct handle { int fd; + bool can_punch_hole; + bool can_zero_range; }; /* Create the per-connection handle. */ @@ -146,6 +149,18 @@ file_open (int readonly) return NULL; } +#ifdef FALLOC_FL_PUNCH_HOLE + h->can_punch_hole = true; +#else + h->can_punch_hole = false; +#endif + +#ifdef FALLOC_FL_ZERO_RANGE + h->can_zero_range = true; +#else +...
2018 Aug 18
0
[PATCH v3 1/4] file: Avoid unsupported fallocate() calls
...@@ -33,6 +33,7 @@ #include <config.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -118,6 +119,8 @@ file_config_complete (void) /* The per-connection handle. */ struct handle { int fd; + bool can_punch_hole; + bool can_zero_range; }; /* Create the per-connection handle. */ @@ -146,6 +149,18 @@ file_open (int readonly) return NULL; } +#ifdef FALLOC_FL_PUNCH_HOLE + h->can_punch_hole = true; +#else + h->can_punch_hole = false; +#endif + +#ifdef FALLOC_FL_ZERO_RANGE + h->can_zero_range = true; +#else +...
2018 Aug 19
0
[PATCH v4 1/4] file: Avoid unsupported fallocate() calls
...nclude <stdio.h> #include <stdlib.h> +#include <stdbool.h> #include <string.h> #include <fcntl.h> #include <unistd.h> @@ -118,6 +119,8 @@ file_config_complete (void) /* The per-connection handle. */ struct handle { int fd; + bool can_punch_hole; + bool can_zero_range; }; /* Create the per-connection handle. */ @@ -146,6 +149,18 @@ file_open (int readonly) return NULL; } +#ifdef FALLOC_FL_PUNCH_HOLE + h->can_punch_hole = true; +#else + h->can_punch_hole = false; +#endif + +#ifdef FALLOC_FL_ZERO_RANGE + h->can_zero_range = true; +#else +...
2018 Aug 02
10
[PATCH 0/3] file: Zero for block devices and older file systems
This is the second version to support efficient zero for block devices on older kernels (e.g. RHEL 7.5), and file systems that do not support yet FALLOC_FS_ZERO_RANGE (e.g. NFS 4.2). Changes since v1: - Split to smaller patches - Skip linux only includes on other systems - Skip code using BLKZEROOUT if the macro is not defined - Try BLKZEROOUT only if the offset and count are aligned to device
2018 Aug 02
0
[PATCH 1/3] file: Avoid unsupported fallocate() calls
...@@ -33,6 +33,7 @@ #include <config.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -118,6 +119,8 @@ file_config_complete (void) /* The per-connection handle. */ struct handle { int fd; + bool can_punch_hole; + bool can_zero_range; }; /* Create the per-connection handle. */ @@ -146,6 +149,18 @@ file_open (int readonly) return NULL; } +#ifdef FALLOC_FL_PUNCH_HOLE + h->can_punch_hole = true; +#else + h->can_punch_hole = false; +#endif + +#ifdef FALLOC_FL_ZERO_RANGE + h->can_zero_range = true; +#else +...
2018 Aug 02
2
Re: [PATCH 1/3] file: Avoid unsupported fallocate() calls
...trim changed to: > 1. If we can punch hole, try PUNCH_HOLE > 2. Succeed Seems reasonable from the description. > @@ -118,6 +119,8 @@ file_config_complete (void) > /* The per-connection handle. */ > struct handle { > int fd; > + bool can_punch_hole; > + bool can_zero_range; Would it be better to make these tri-state rather than merely bool? (Indeterminate, supported, known to fail) > }; > > /* Create the per-connection handle. */ > @@ -146,6 +149,18 @@ file_open (int readonly) > return NULL; > } > > +#ifdef FALLOC_FL_PUN...
2018 Aug 18
7
[PATCH v3 0/4] file: Zero for block devices and older file systems
This version addresses some of the comments on v2. Changes since v2: - file_zero: Add missing space in function call - is_aligned: Assert that align is indeed a power of 2 - Spelling in commit message Not changed: - Eric commented that spacing was off: https://www.redhat.com/archives/libguestfs/2018-August/msg00113.html but I could not find anything wrong. - Eric asked if ioctl.h will cause
2018 Aug 19
9
[PATCH v3 0/4] file: Zero for block devices and older file systems
This version addresses comments on v3. Changes since v3: - Finally got spacing right (Eric) - Reorder includes (Richard) - Return 0 or -1 instead of r (Richard) - Add common/include/isaligned.h to Makefile.am (Richard) v3 was here: https://www.redhat.com/archives/libguestfs/2018-August/msg00177.html Nir Soffer (4): file: Avoid unsupported fallocate() calls file: Support zero without
2018 Aug 03
10
[PATCH v2 0/4] file: Zero for block devices and older file systems
This is the third version to support efficient zero for block devices on older kernels (e.g. RHEL 7.5), and file systems that do not support yet FALLOC_FS_ZERO_RANGE (e.g. NFS 4.2). Changes since v2: - Revert file_can_trim change, since it is too late to change the value after negotiation. Changing the capability dinamically may be useful internally, but it should be done via other means. -
2018 Aug 13
2
Re: [PATCH v2 1/4] file: Avoid unsupported fallocate() calls
...------- > 1 file changed, 53 insertions(+), 27 deletions(-) > > #ifdef FALLOC_FL_ZERO_RANGE > - r = do_fallocate (h->fd, FALLOC_FL_ZERO_RANGE, offset, count); > - if (r == -1 && errno != EOPNOTSUPP) { > - nbdkit_error ("zero: %m"); > + if (h->can_zero_range) { > + r = do_fallocate (h->fd, FALLOC_FL_ZERO_RANGE, offset, count); > + if (r== 0) Spacing is off. Otherwise looks good to me. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
2018 Aug 18
2
Re: [PATCH v2 1/4] file: Avoid unsupported fallocate() calls
...redhat.com> wrote: > >> > #ifdef FALLOC_FL_ZERO_RANGE >> > - r = do_fallocate (h->fd, FALLOC_FL_ZERO_RANGE, offset, count); >> > - if (r == -1 && errno != EOPNOTSUPP) { >> > - nbdkit_error ("zero: %m"); >> > + if (h->can_zero_range) { >> > + r = do_fallocate (h->fd, FALLOC_FL_ZERO_RANGE, offset, count); >> > + if (r== 0) >> >> Spacing is off. >> > It does look off in my mail client (inbox), but looks fine (2 spaces indentation) in my editor. Nir
2018 Aug 02
0
[PATCH] file: Zero support for block devices and NFS 4.2
...C_FL_* on RHEL, glibc < 2.18 */ +#include <sys/ioctl.h> +#include <linux/fs.h> #include <nbdkit-plugin.h> @@ -116,6 +119,10 @@ file_config_complete (void) /* The per-connection handle. */ struct handle { int fd; + bool is_block_device; + bool can_punch_hole; + bool can_zero_range; + bool can_fallocate; }; /* Create the per-connection handle. */ @@ -123,6 +130,7 @@ static void * file_open (int readonly) { struct handle *h; + struct stat statbuf; int flags; h = malloc (sizeof *h); @@ -144,6 +152,23 @@ file_open (int readonly) return NULL; } + if...
2018 Aug 02
0
Re: [PATCH 1/3] file: Avoid unsupported fallocate() calls
..., try PUNCH_HOLE > > 2. Succeed > > Seems reasonable from the description. > > > @@ -118,6 +119,8 @@ file_config_complete (void) > > /* The per-connection handle. */ > > struct handle { > > int fd; > > + bool can_punch_hole; > > + bool can_zero_range; > > Would it be better to make these tri-state rather than merely bool? > (Indeterminate, supported, known to fail) > What is the advantage of having tri-state? > > }; > > > > /* Create the per-connection handle. */ > > @@ -146,6 +149,18 @@ file_open (int...
2020 Apr 09
0
[PATCH nbdkit v2 1/3] file: Move file operators to a new common/fileops mini-library.
....h> + +/* Either use this as the per-connection handle, or it must appear as + * the first member of the per-connection handle. Don’t access these + * fields directly from your plugin. + */ +struct fileops { + int fd; + int sector_size; + bool is_block_device; + bool can_punch_hole; + bool can_zero_range; + bool can_fallocate; + bool can_zeroout; +}; + +/* Initialize the fileops struct. ‘fd’ is a file descriptor opened on + * the local file or block device that you want to serve. Call this + * from your .open callback after allocating the handle and setting up + * the file descriptor. + */ +ext...
2020 Apr 09
1
[PATCH nbdkit PRELIMINARY] file: Move file operators to a new fileops mini-library
There's a lot of code in nbdkit-file-plugin which it would be nice to reuse elsewhere. One possible approach (as outlined here) is simply to move the file callbacks (like file.pread, file.pwrite, file.zero etc) to a new mini-library. They can then be consumed by other plugins fairly easily by doing: static void * foo_open (int readonly) { struct fileops *fops; int fd, flags; /*
2018 Aug 02
0
[PATCH 2/3] file: Support zero without ZERO_RANGE
...ile/file.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/plugins/file/file.c b/plugins/file/file.c index 8bb9a2d..aa05492 100644 --- a/plugins/file/file.c +++ b/plugins/file/file.c @@ -121,6 +121,7 @@ struct handle { int fd; bool can_punch_hole; bool can_zero_range; + bool can_fallocate; }; /* Create the per-connection handle. */ @@ -161,6 +162,8 @@ file_open (int readonly) h->can_zero_range = false; #endif + h->can_fallocate = true; + return h; } @@ -297,6 +300,35 @@ file_zero (void *handle, uint32_t count, uint64_t offset, int may_tr...
2018 Aug 03
0
[PATCH v2 2/4] file: Support zero without ZERO_RANGE
...ile/file.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/plugins/file/file.c b/plugins/file/file.c index 5daab63..a2cea4a 100644 --- a/plugins/file/file.c +++ b/plugins/file/file.c @@ -121,6 +121,7 @@ struct handle { int fd; bool can_punch_hole; bool can_zero_range; + bool can_fallocate; }; /* Create the per-connection handle. */ @@ -161,6 +162,8 @@ file_open (int readonly) h->can_zero_range = false; #endif + h->can_fallocate = true; + return h; } @@ -301,6 +304,35 @@ file_zero (void *handle, uint32_t count, uint64_t offset, int may_tr...
2018 Aug 19
1
Re: [PATCH v3 1/4] file: Avoid unsupported fallocate() calls
...u put stdbook after stdlib for consistency with the other source files. > #ifdef FALLOC_FL_ZERO_RANGE > - r = do_fallocate (h->fd, FALLOC_FL_ZERO_RANGE, offset, count); > - if (r == -1 && errno != EOPNOTSUPP) { > - nbdkit_error ("zero: %m"); > + if (h->can_zero_range) { > + r = do_fallocate (h->fd, FALLOC_FL_ZERO_RANGE, offset, count); > + if (r== 0) Spacing. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds...
2018 Jul 29
3
[PATCH] file: Zero support for block devices and NFS 4.2
...C_FL_* on RHEL, glibc < 2.18 */ +#include <sys/ioctl.h> +#include <linux/fs.h> #include <nbdkit-plugin.h> @@ -116,6 +119,10 @@ file_config_complete (void) /* The per-connection handle. */ struct handle { int fd; + bool is_block_device; + bool can_punch_hole; + bool can_zero_range; + bool can_fallocate; }; /* Create the per-connection handle. */ @@ -123,6 +130,7 @@ static void * file_open (int readonly) { struct handle *h; + struct stat statbuf; int flags; h = malloc (sizeof *h); @@ -144,6 +152,23 @@ file_open (int readonly) return NULL; } + if...
2020 Apr 09
6
[PATCH nbdkit v2 0/3] Implement fileops.
Needs some work still, see in particular the commit message for patch 3. Rich.