Displaying 20 results from an estimated 21 matches for "file_debug_zero".
2019 Jan 05
0
[PATCH nbdkit v2 07/11] file: Implement NBDKIT_API_VERSION 2.
...fdef FALLOC_FL_PUNCH_HOLE
- if (h->can_punch_hole && may_trim) {
+ if (h->can_punch_hole && (flags & NBDKIT_FLAG_MAY_TRIM)) {
r = do_fallocate (h->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
offset, count);
if (r == 0) {
if (file_debug_zero)
nbdkit_debug ("h->can_punch_hole && may_trim: "
"zero succeeded using fallocate");
- return 0;
+ goto out;
}
if (errno != EOPNOTSUPP) {
@@ -355,7 +382,7 @@ file_zero (void *handle, uint32_t count, uint64_t offset,...
2020 Apr 09
0
[PATCH nbdkit v2 1/3] file: Move file operators to a new common/fileops mini-library.
...ot;
+#include "fileops.h"
+#include "isaligned.h"
+
+#ifndef HAVE_FDATASYNC
+#define fdatasync fsync
+#endif
+
+/* Any callbacks using lseek must be protected by this lock. */
+static pthread_mutex_t lseek_lock = PTHREAD_MUTEX_INITIALIZER;
+
+/* To enable: -D file.zero=1 */
+int file_debug_zero;
+
+static bool
+is_enotsup (int err)
+{
+ return err == ENOTSUP || err == EOPNOTSUPP;
+}
+
+/* Print some extra information about how the plugin was compiled. */
+void
+fileops_dump_plugin (void)
+{
+#ifdef BLKSSZGET
+ printf ("file_blksszget=yes\n");
+#endif
+#ifdef BLKZEROOUT
+ prin...
2019 Mar 23
1
Re: [PATCH nbdkit 8/8] file: Implement extents.
...PM, Richard W.M. Jones wrote:
> This uses lseek SEEK_DATA/SEEK_HOLE to search for allocated data and
> holes in the underlying file.
> ---
> plugins/file/file.c | 139 ++++++++++++++++++++++++++++++++++++++++----
> 1 file changed, 129 insertions(+), 10 deletions(-)
>
> -int file_debug_zero; /* to enable: -D file.zero=1 */
> +/* Any callbacks using lseek must be protected by this lock. */
> +static pthread_mutex_t lseek_lock = PTHREAD_MUTEX_INITIALIZER;
> +
> +/* to enable: -D file.zero=1 */
> +int file_debug_zero;
>
> static void
> file_unload (...
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;
/*
2019 Mar 20
0
[PATCH nbdkit 8/8] file: Implement extents.
...8 @@
#include <sys/ioctl.h>
#include <errno.h>
+#include <pthread.h>
+
#if defined(__linux__) && !defined(FALLOC_FL_PUNCH_HOLE)
#include <linux/falloc.h> /* For FALLOC_FL_*, glibc < 2.18 */
#endif
@@ -68,7 +71,11 @@
static char *filename = NULL;
-int file_debug_zero; /* to enable: -D file.zero=1 */
+/* Any callbacks using lseek must be protected by this lock. */
+static pthread_mutex_t lseek_lock = PTHREAD_MUTEX_INITIALIZER;
+
+/* to enable: -D file.zero=1 */
+int file_debug_zero;
static void
file_unload (void)
@@ -220,6 +227,21 @@ file_close (v...
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.
2019 Mar 28
0
[PATCH nbdkit v5 FINAL 15/19] file: Implement extents.
...8 @@
#include <sys/ioctl.h>
#include <errno.h>
+#include <pthread.h>
+
#if defined(__linux__) && !defined(FALLOC_FL_PUNCH_HOLE)
#include <linux/falloc.h> /* For FALLOC_FL_*, glibc < 2.18 */
#endif
@@ -68,7 +71,11 @@
static char *filename = NULL;
-int file_debug_zero; /* to enable: -D file.zero=1 */
+/* Any callbacks using lseek must be protected by this lock. */
+static pthread_mutex_t lseek_lock = PTHREAD_MUTEX_INITIALIZER;
+
+/* to enable: -D file.zero=1 */
+int file_debug_zero;
static void
file_unload (void)
@@ -220,6 +227,23 @@ file_close (v...
2018 Sep 17
4
[PATCH nbdkit v2] common: isaligned: Use a macro instead of relying on implicit truncation.
...*/
- 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)
- nbdkit_debug ("h->can_zeroout && is_aligned: "
+ nbdkit_debug ("h->can_zeroout && IS_ALIGNED: "
"zero succeeded using BLKZEROOUT");
return 0;
}
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vdd...
2019 Aug 13
3
[nbdkit PATCH 0/2] errno cleanup patches
I ran into these while trying to prepare patches to add
NBD_CMD_FLAG_FAST_ZERO, which will expose a new NBD_ENOTSUP wire
value.
Eric Blake (2):
plugins: Don't lose original error when emulating FUA
plugins: Permit ENOTSUP as synonym for EOPNOTSUPP
docs/nbdkit-filter.pod | 11 ++++++-----
docs/nbdkit-plugin.pod | 12 +++++++-----
plugins/file/file.c | 16 +++++++++++-----
2018 Sep 17
0
[PATCH nbdkit v3 1/3] common: isaligned: Use a macro instead of relying on implicit truncation.
...*/
- 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)
- nbdkit_debug ("h->can_zeroout && is_aligned: "
+ nbdkit_debug ("h->can_zeroout && IS_ALIGNED: "
"zero succeeded using BLKZEROOUT");
return 0;
}
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vdd...
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
2018 Sep 17
0
Re: [PATCH nbdkit v2] common: isaligned: Use a macro instead of relying on implicit truncation.
...&& 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)
> - nbdkit_debug ("h->can_zeroout && is_aligned: "
> + nbdkit_debug ("h->can_zeroout && IS_ALIGNED: "
> "zero succeeded using BLKZEROOUT");
> return 0;
> }
> diff --git a/plugins/...
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]
2019 Aug 13
0
[nbdkit PATCH 2/2] plugins: Permit ENOTSUP as synonym for EOPNOTSUPP
...partial writes (instead, these would be
diff --git a/plugins/file/file.c b/plugins/file/file.c
index 9df5001d..a9d6491a 100644
--- a/plugins/file/file.c
+++ b/plugins/file/file.c
@@ -73,6 +73,12 @@ static pthread_mutex_t lseek_lock = PTHREAD_MUTEX_INITIALIZER;
/* to enable: -D file.zero=1 */
int file_debug_zero;
+static bool
+file_is_enotsup (int err)
+{
+ return err == ENOTSUP || err == EOPNOTSUPP;
+}
+
static void
file_unload (void)
{
@@ -399,7 +405,7 @@ file_zero (void *handle, uint32_t count, uint64_t offset, uint32_t flags)
goto out;
}
- if (errno != EOPNOTSUPP) {
+ if (!file_...
2020 Aug 07
0
[nbdkit PATCH 2/4] file: Add .list_exports support
...* Any callbacks using lseek must be protected by this lock. */
-static pthread_mutex_t lseek_lock = PTHREAD_MUTEX_INITIALIZER;
+/* Any callbacks using readdir or lseek must be protected by this lock. */
+static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
/* to enable: -D file.zero=1 */
int file_debug_zero;
@@ -83,10 +86,14 @@ static void
file_unload (void)
{
free (filename);
+ free (directory);
+ if (dir)
+ closedir (dir);
}
/* Called for each key=value passed on the command line. This plugin
- * only accepts file=<filename>, which is required.
+ * only accepts file=<filename&...
2019 Mar 20
15
[PATCH nbdkit 0/8] Implement extents using a simpler array.
Not sure what version we're up to, but this reimplements extents using
the new simpler structure described in this thread:
https://www.redhat.com/archives/libguestfs/2019-March/msg00077.html
I also fixed most of the things that Eric pointed out in the previous
review, although I need to go back over his replies and check I've got
everything.
This needs a bit more testing. However the
2019 Mar 26
21
[PATCH nbdkit v4 00/15] Implement Block Status.
I'm not sure exactly which version we're up to, but let's say it's
version 4.
I'm a lot happier with this version:
- all filters have been reviewed and changed where I think that's necessary
- can_extents is properly defined and implemented now
- NBD protocol is followed
- I believe it addresses all previous review points where possible
The "only" thing
2019 Mar 19
15
[PATCH nbdkit 0/9] [mainly for discussion and early review] Implement extents.
I want to post this but mainly for discussion and early review. It's
not safe for these patches to all go upstream yet (because not all
filters have been checked/adjusted), but if any patches were to go
upstream then probably 1 & 2 only are safe.
File, VDDK, memory and data plugins all work, although I have only
done minimal testing on them.
The current tests, such as they are, all
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.
2020 Aug 07
8
[nbdkit PATCH 0/4] More .list_exports uses
Here's changes to the file plugin (which I'm happy with) and a new
exportname filter (which is still at RFC stage; I need to finish
implementing strict mode in .open, and add tests).
I also discovered that we really want .list_exports and .open to know
when they are used on plaintext vs. tls clients for --tls=on, and we
may want to split out a new .default_export callback rather than