similar to: [PATCH nbdkit v2] common: isaligned: Use a macro instead of relying on implicit truncation.

Displaying 20 results from an estimated 2000 matches similar to: "[PATCH nbdkit v2] common: isaligned: Use a macro instead of relying on implicit truncation."

2018 Sep 17
0
[PATCH nbdkit v3 1/3] common: isaligned: Use a macro instead of relying on implicit truncation.
--- common/include/isaligned.h | 11 +++++------ plugins/file/file.c | 4 ++-- plugins/vddk/vddk.c | 8 ++++---- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/common/include/isaligned.h b/common/include/isaligned.h index e693820..81ce8a7 100644 --- a/common/include/isaligned.h +++ b/common/include/isaligned.h @@ -36,16 +36,15 @@ #include <assert.h>
2018 Sep 17
0
Re: [PATCH nbdkit v2] common: isaligned: Use a macro instead of relying on implicit truncation.
On Mon, Sep 17, 2018 at 11:27 PM Richard W.M. Jones <rjones@redhat.com> wrote: > --- > common/include/isaligned.h | 11 +++++------ > plugins/file/file.c | 4 ++-- > plugins/vddk/vddk.c | 8 ++++---- > 3 files changed, 11 insertions(+), 12 deletions(-) > > diff --git a/common/include/isaligned.h b/common/include/isaligned.h > index e693820..81ce8a7
2018 Sep 17
7
[PATCH nbdkit v3 0/3] Add partitioning plugin.
The partitioning plugin patch is the same (except for rebasing). However I have changed the first two patches based on feedback received. In particular this fixes a very serious bug found by Eric Blake in the current truncate filter. Rich.
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 19
1
Re: [PATCH v3 3/4] common: Add isaligned helper module
On Sun, Aug 19, 2018 at 01:13:07AM +0300, Nir Soffer wrote: > is_aligned (size, align) returns true if size is aligned to align, > assuming that align is power of 2. > > Suggested by Eric Blake in > https://www.redhat.com/archives/libguestfs/2018-August/msg00036.html > --- > common/include/isaligned.h | 51 ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 51
2018 Sep 17
2
Re: [PATCH nbdkit v2] common: isaligned: Use a macro instead of relying on implicit truncation.
On 9/17/18 3:39 PM, Nir Soffer wrote: >> +#define IS_ALIGNED(size, align) ({ \ >> + assert (is_power_of_2 ((align))); \ >> + !((size) & ((align) - 1)); \ >> +}) >> > > But this version will happily accept singed int, and I think this code > behavior with signed int is undefined. Well, sort of. Bit shifts
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 Sep 17
3
Re: [PATCH nbdkit 1/3] common: isaligned: Use uint64_t instead of unsigned int.
On Mon, Sep 17, 2018 at 6:03 PM Richard W.M. Jones <rjones@redhat.com> wrote: > This should have no effect. However it's probably better to pass the > full type explicitly rather than using an implicit truncation. > Why is it better? We care only about the least significant bits; current code is clear about that. This is also specified behavior, although the only reference
2018 Sep 17
1
Re: [PATCH nbdkit v2] common: isaligned: Use a macro instead of relying on implicit truncation.
On 9/17/18 4:41 PM, Nir Soffer wrote: > The FreeBSD version: > > #define IS_ALIGNED <http://fxr.watson.org/fxr/ident?i=IS_ALIGNED>(n > <http://fxr.watson.org/fxr/ident?i=n>,align) (!((uint32_t)(n > <http://fxr.watson.org/fxr/ident?i=n>) & (align - 1))) > > http://fxr.watson.org/fxr/source/contrib/ncsw/inc/ncsw_ext.h#L182 Which truncates to 32
2018 Sep 17
0
Re: [PATCH nbdkit v2] common: isaligned: Use a macro instead of relying on implicit truncation.
On Tue, Sep 18, 2018 at 12:13 AM Eric Blake <eblake@redhat.com> wrote: > On 9/17/18 3:39 PM, Nir Soffer wrote: > > >> +#define IS_ALIGNED(size, align) ({ \ > >> + assert (is_power_of_2 ((align))); \ > >> + !((size) & ((align) - 1)); \ > >> +}) > >> > > > > But this version will
2019 Mar 20
0
[PATCH nbdkit 7/8] vddk: Implement extents.
This uses a new API VixDiskLib_QueryAllocatedBlocks provided in VDDK >= 6.7. Thanks: Martin Kletzander. --- plugins/vddk/vddk-structs.h | 15 +++- plugins/vddk/vddk.c | 138 ++++++++++++++++++++++++++++++++++++ 2 files changed, 152 insertions(+), 1 deletion(-) diff --git a/plugins/vddk/vddk-structs.h b/plugins/vddk/vddk-structs.h index dbed94a..df88322 100644 ---
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.
2018 Aug 02
2
Re: [PATCH 3/3] file: Zero for block devices on old kernels
On 08/02/2018 02:05 PM, Nir Soffer wrote: > fallocate(FALLOC_FL_ZERO_RANGE) is supportd for block devices with > modern kernel, but when it is not, we fall back to manual zeroing. > > Check if the underlying file is a block device when opening the file, > and fall back to ioctl(BLKZEROOUT) for aligned zero requests for a > block device. > > +++ b/plugins/file/file.c >
2018 Aug 19
0
[PATCH v4 4/4] file: Zero for block devices on old kernels
fallocate(FALLOC_FL_ZERO_RANGE) is supported for block devices with modern kernel, but when it is not, we fall back to manual zeroing. For block device, try also to use ioctl(BLKZEROOUT) if offset and count are aligned to block device sector size. Here is an example run without this change on RHEL 7.5: $ export SOCK=/tmp/nbd.sock $ export
2018 Aug 03
0
[PATCH v2 4/4] file: Zero for block devices on old kernels
fallocate(FALLOC_FL_ZERO_RANGE) is supportd for block devices with modern kernel, but when it is not, we fall back to manual zeroing. For block device, try also to use ioctl(BLKZEROOUT) if offset and count are aligned to block device sector size. Here is an example run without this change on RHEL 7.5: $ export SOCK=/tmp/nbd.sock $ export
2019 Mar 23
2
Re: [PATCH nbdkit 7/8] vddk: Implement extents.
On 3/20/19 5:11 PM, Richard W.M. Jones wrote: > This uses a new API VixDiskLib_QueryAllocatedBlocks provided in > VDDK >= 6.7. > > Thanks: Martin Kletzander. > --- > plugins/vddk/vddk-structs.h | 15 +++- > plugins/vddk/vddk.c | 138 ++++++++++++++++++++++++++++++++++++ > 2 files changed, 152 insertions(+), 1 deletion(-) > > +static int >
2020 Apr 09
0
[PATCH nbdkit v2 1/3] file: Move file operators to a new common/fileops mini-library.
Writing "file-like" plugins is hard because you have to implement your own .zero, .trim, .extents, etc, and that is very complicated. However implementations of these functions already exist in the file plugin. By factoring out the file plugin into a separate "fileops" mini-library we can reuse these implementations in other plugins. This refactoring commit creates a new
2018 Aug 13
1
Re: [PATCH v2 3/4] common: Add isaligned helper module
On 08/03/2018 02:28 PM, Nir Soffer wrote: > is_aligned (size, align) returns true if size is aligned to align, > assuming that align is power of 2. > > Suggested by Eric in > https://www.redhat.com/archives/libguestfs/2018-August/msg00036.html > --- > common/include/isaligned.h | 50 ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 50 insertions(+) > create