search for: can_zeroout

Displaying 18 results from an estimated 18 matches for "can_zeroout".

2018 Sep 17
4
[PATCH nbdkit v2] common: isaligned: Use a macro instead of relying on implicit truncation.
...b/plugins/file/file.c index 9d03f18..1391f62 100644 --- a/plugins/file/file.c +++ b/plugins/file/file.c @@ -397,13 +397,13 @@ file_zero (void *handle, uint32_t count, uint64_t offset, int may_trim) #ifdef BLKZEROOUT /* For aligned range and block device, we can use BLKZEROOUT. */ - if (h->can_zeroout && is_aligned (offset | count, h->sector_size)) { + if (h->can_zeroout && IS_ALIGNED (offset | count, h->sector_size)) { uint64_t range[2] = {offset, count}; r = ioctl (h->fd, BLKZEROOUT, &range); if (r == 0) { if (file_debug_zero) - n...
2018 Sep 17
0
[PATCH nbdkit v3 1/3] common: isaligned: Use a macro instead of relying on implicit truncation.
...b/plugins/file/file.c index 9d03f18..1391f62 100644 --- a/plugins/file/file.c +++ b/plugins/file/file.c @@ -397,13 +397,13 @@ file_zero (void *handle, uint32_t count, uint64_t offset, int may_trim) #ifdef BLKZEROOUT /* For aligned range and block device, we can use BLKZEROOUT. */ - if (h->can_zeroout && is_aligned (offset | count, h->sector_size)) { + if (h->can_zeroout && IS_ALIGNED (offset | count, h->sector_size)) { uint64_t range[2] = {offset, count}; r = ioctl (h->fd, BLKZEROOUT, &range); if (r == 0) { if (file_debug_zero) - n...
2018 Sep 17
0
Re: [PATCH nbdkit v2] common: isaligned: Use a macro instead of relying on implicit truncation.
...391f62 100644 > --- a/plugins/file/file.c > +++ b/plugins/file/file.c > @@ -397,13 +397,13 @@ file_zero (void *handle, uint32_t count, uint64_t > offset, int may_trim) > > #ifdef BLKZEROOUT > /* For aligned range and block device, we can use BLKZEROOUT. */ > - if (h->can_zeroout && is_aligned (offset | count, h->sector_size)) { > + if (h->can_zeroout && IS_ALIGNED (offset | count, h->sector_size)) { > uint64_t range[2] = {offset, count}; > > r = ioctl (h->fd, BLKZEROOUT, &range); > if (r == 0) { > if...
2018 Aug 19
0
[PATCH v4 4/4] file: Zero for block devices on old kernels
...ligned.h" + #ifndef O_CLOEXEC #define O_CLOEXEC 0 #endif @@ -119,9 +126,12 @@ file_config_complete (void) /* The per-connection handle. */ struct handle { int fd; + bool is_block_device; + int sector_size; bool can_punch_hole; bool can_zero_range; bool can_fallocate; + bool can_zeroout; }; /* Create the per-connection handle. */ @@ -129,6 +139,7 @@ static void * file_open (int readonly) { struct handle *h; + struct stat statbuf; int flags; h = malloc (sizeof *h); @@ -150,6 +161,22 @@ file_open (int readonly) return NULL; } + if (fstat (h->fd, &...
2018 Aug 03
0
[PATCH v2 4/4] file: Zero for block devices on old kernels
...ligned.h" + #ifndef O_CLOEXEC #define O_CLOEXEC 0 #endif @@ -119,9 +126,12 @@ file_config_complete (void) /* The per-connection handle. */ struct handle { int fd; + bool is_block_device; + int sector_size; bool can_punch_hole; bool can_zero_range; bool can_fallocate; + bool can_zeroout; }; /* Create the per-connection handle. */ @@ -129,6 +139,7 @@ static void * file_open (int readonly) { struct handle *h; + struct stat statbuf; int flags; h = malloc (sizeof *h); @@ -150,6 +161,22 @@ file_open (int readonly) return NULL; } + if (fstat (h->fd, &...
2020 Apr 09
0
[PATCH nbdkit v2 1/3] file: Move file operators to a new common/fileops mini-library.
...ion 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. + */ +extern int init_fileops (int fd, struct fileops...
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 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
2020 Feb 10
2
[nbdkit PATCH 05/10] plugins: Wire up file-based plugin support for NBD_INFO_INIT_STATE
...2019 Red Hat Inc. + * Copyright (C) 2013-2020 Red Hat Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -154,6 +154,9 @@ struct handle { bool can_zero_range; bool can_fallocate; bool can_zeroout; + bool can_extents; + bool init_sparse; + bool init_zero; }; /* Create the per-connection handle. */ @@ -214,6 +217,52 @@ file_open (int readonly) h->can_fallocate = true; h->can_zeroout = h->is_block_device; + h->can_extents = false; + h->init_sparse = false; + h-&g...
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 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 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. -
2020 Feb 11
0
Re: [nbdkit PATCH 05/10] plugins: Wire up file-based plugin support for NBD_INFO_INIT_STATE
On Mon, Feb 10, 2020 at 03:43:58PM -0600, Eric Blake wrote: > @@ -214,6 +217,52 @@ file_open (int readonly) > h->can_fallocate = true; > h->can_zeroout = h->is_block_device; > > + h->can_extents = false; > + h->init_sparse = false; > + h->init_zero = false; > +#ifdef SEEK_HOLE > + if (!h->is_block_device) { > + off_t r; > + > + /* A simple test to see whether SEEK_DATA/SEEK_HOLE are likely to wo...
2019 Jan 05
0
[PATCH nbdkit v2 07/11] file: Implement NBDKIT_API_VERSION 2.
..."zero succeeded using fallocate"); - return 0; + goto out; } if (errno != EOPNOTSUPP) { @@ -410,7 +437,7 @@ file_zero (void *handle, uint32_t count, uint64_t offset, int may_trim) if (file_debug_zero) nbdkit_debug ("h->can_zeroout && IS_ALIGNED: " "zero succeeded using BLKZEROOUT"); - return 0; + goto out; } if (errno != ENOTTY) { @@ -427,25 +454,16 @@ file_zero (void *handle, uint32_t count, uint64_t offset, int may_trim) nbdkit_debug ("zero falli...
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.
2019 Jan 04
10
[PATCH nbdkit 0/7] server: Implement NBD_FLAG_CAN_MULTI_CONN.
First thing to say is that I need to do a *lot* more testing on this, so this is just an early peek. In particular, although it passed ‘make check && make check-valgrind’ I have *not* tested it against a multi-conn-aware client such as the Linux kernel >= 4.9. This implements NBD_FLAG_CAN_MULTI_CONN, described in the protocol doc as: "NBD_FLAG_CAN_MULTI_CONN: Indicates that
2019 Jan 05
15
[PATCH nbdkit v2 01/11] server: Implement NBD_FLAG_CAN_MULTI_CONN.
For existing commits, this is almost identical to v1, except that I updated some commit messages and reordered the commits in a somewhat more logical sequence. The main changes are the extra commits: [06/11] plugins: Return NBD_FLAG_CAN_MULTI_CONN from some readonly plugins. - Readonly plugins that can set the flag unconditionally. [09/11] partitioning: Return NBD_FLAG_CAN_MULTI_CONN. [10/11]
2020 Feb 10
17
Cross-project NBD extension proposal: NBD_INFO_INIT_STATE
I will be following up to this email with four separate threads each addressed to the appropriate single list, with proposed changes to: - the NBD protocol - qemu: both server and client - libnbd: client - nbdkit: server The feature in question adds a new optional NBD_INFO_ packet to the NBD_OPT_GO portion of handshake, adding up to 16 bits of information that the server can advertise to the