Displaying 18 results from an estimated 18 matches for "sparse_array_zero".
2019 Aug 15
2
[nbdkit PATCH] data, memory: Optimize .zero > PAGE_SIZE
When sparse_array_zero() is used for a range larger than a page,
there's no need to waste time in memset() or is_zero() - we already
know the page will be free()d.
Signed-off-by: Eric Blake <eblake@redhat.com>
---
Here's a fun one :)
common/sparse/sparse.c | 7 +++++--
1 file changed, 5 insertions(+), 2...
2019 Apr 23
0
[nbdkit PATCH 4/4] plugins: Utilize ACQUIRE_LOCK_FOR_CURRENT_SCOPE
...turn r;
+ ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock);
+ return sparse_array_write (sa, buf, count, offset);
}
/* Zero. */
static int
data_zero (void *handle, uint32_t count, uint64_t offset, int may_trim)
{
- pthread_mutex_lock (&lock);
+ ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock);
sparse_array_zero (sa, count, offset);
- pthread_mutex_unlock (&lock);
return 0;
}
@@ -371,9 +366,8 @@ data_zero (void *handle, uint32_t count, uint64_t offset, int may_trim)
static int
data_trim (void *handle, uint32_t count, uint64_t offset)
{
- pthread_mutex_lock (&lock);
+ ACQUIRE_LOCK_FOR_CUR...
2019 Aug 15
0
Re: [nbdkit PATCH] data, memory: Optimize .zero > PAGE_SIZE
On Wed, Aug 14, 2019 at 09:10:15PM -0500, Eric Blake wrote:
> When sparse_array_zero() is used for a range larger than a page,
> there's no need to waste time in memset() or is_zero() - we already
> know the page will be free()d.
>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
>
> Here's a fun one :)
>
> common/sparse/sparse.c |...
2019 Mar 20
0
[PATCH nbdkit 6/8] data, memory: Implement extents.
...44
--- a/common/sparse/sparse.h
+++ b/common/sparse/sparse.h
@@ -1,5 +1,5 @@
/* nbdkit
- * Copyright (C) 2017-2018 Red Hat Inc.
+ * Copyright (C) 2017-2019 Red Hat Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -87,4 +87,9 @@ extern void sparse_array_zero (struct sparse_array *sa,
uint32_t count, uint64_t offset)
__attribute__((__nonnull__ (1)));
+/* Return information about allocated pages and holes. */
+extern int sparse_array_extents (struct sparse_array *sa,
+ uint32_t count, u...
2019 Mar 28
0
[PATCH nbdkit v5 FINAL 14/19] data, memory: Implement extents.
...44
--- a/common/sparse/sparse.h
+++ b/common/sparse/sparse.h
@@ -1,5 +1,5 @@
/* nbdkit
- * Copyright (C) 2017-2018 Red Hat Inc.
+ * Copyright (C) 2017-2019 Red Hat Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -87,4 +87,9 @@ extern void sparse_array_zero (struct sparse_array *sa,
uint32_t count, uint64_t offset)
__attribute__((__nonnull__ (1)));
+/* Return information about allocated pages and holes. */
+extern int sparse_array_extents (struct sparse_array *sa,
+ uint32_t count, u...
2019 Aug 23
2
[nbdkit PATCH 3/3] plugins: Add .can_fast_zero hook
...unt, uint64_t offset,
static int
data_zero (void *handle, uint32_t count, uint64_t offset, uint32_t flags)
{
- /* Flushing, and thus FUA flag, is a no-op */
- assert ((flags & ~(NBDKIT_FLAG_FUA | NBDKIT_FLAG_MAY_TRIM)) == 0);
+ /* Flushing, and thus FUA flag, is a no-op. Assume that
+ * sparse_array_zero generally beats writes, so FAST_ZERO is a no-op. */
+ assert ((flags & ~(NBDKIT_FLAG_FUA | NBDKIT_FLAG_MAY_TRIM |
+ NBDKIT_FLAG_FAST_ZERO)) == 0);
ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock);
sparse_array_zero (sa, count, offset);
return 0;
@@ -423,6 +432,7 @@ stati...
2019 Apr 23
8
[nbdkit PATCH 0/4] Start using cleanup macros in filters/plugins
There's more that can be done (in particular, use of CLEANUP_FREE),
but this is enough to at least see if I'm on the right track.
I couldn't figure out an obvious difference between common/include and
common/utils, but it looks like the former is for things that are
inlineable via .h only, while the latter is when you need to link in
a convenience library, so this landed in the
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 Jan 01
3
[PATCH nbdkit] include: Annotate function parameters with attribute((nonnull)).
Should we use attribute((nonnull)) at all? There's a very interesting
history of this in libvirt -- try looking at commit eefb881 plus the
commits referencing eefb881 -- but it does seem to work for me using
recent GCC and Clang.
I only did a few functions because annotating them gets old quickly...
Rich.
2019 Jan 02
0
[PATCH nbdkit v2 1/2] Annotate internal function parameters with attribute((nonnull)).
...uint32_t count, uint64_t offset)
+ __attribute__((__nonnull__ (1, 2)));
/* Zero byte range in the sparse array.
*
@@ -79,6 +83,8 @@ extern int sparse_array_write (struct sparse_array *sa, const void *buf, uint32_
*
* This may free memory, but never returns an error.
*/
-extern void sparse_array_zero (struct sparse_array *sa, uint32_t count, uint64_t offset);
+extern void sparse_array_zero (struct sparse_array *sa,
+ uint32_t count, uint64_t offset)
+ __attribute__((__nonnull__ (1)));
#endif /* NBDKIT_SPARSE_H */
diff --git a/filters/cache/blk.h b/filters/cache...
2019 Jan 02
4
[PATCH nbdkit v2 0/2] Use of attribute(()).
v1 was here:
https://www.redhat.com/archives/libguestfs/2019-January/msg00008.html
In v2 I have provided two patches:
The first patch extends attribute((nonnull)) to most internal
functions, but not to the external API.
The second patch uses a macro so that attribute((format)) is only used
in the public API on GCC or Clang. At least in theory these headers
could be used by a C compiler which
2020 Feb 10
2
[nbdkit PATCH 04/10] plugins: Wire up in-memory plugin support for NBD_INFO_INIT_STATE
...0;
+ sa->max_pages = 0;
sa->debug = debug;
return sa;
}
@@ -254,6 +261,7 @@ lookup (struct sparse_array *sa, uint64_t offset, bool create,
return NULL;
}
l2_dir[o] = page;
+ sa->used_pages++;
}
if (!page)
return NULL;
@@ -355,6 +363,7 @@ sparse_array_zero (struct sparse_array *sa, uint32_t count, uint64_t offset)
__func__, offset);
free (*l2_page);
*l2_page = NULL;
+ sa->used_pages--;
}
}
@@ -398,3 +407,22 @@ sparse_array_extents (struct sparse_array *sa,
return 0;
}
+
+void
+spa...
2019 Aug 23
22
cross-project patches: Add NBD Fast Zero support
This is a cover letter to a series of patches being proposed in tandem
to four different projects:
- nbd: Document a new NBD_CMD_FLAG_FAST_ZERO command flag
- qemu: Implement the flag for both clients and server
- libnbd: Implement the flag for clients
- nbdkit: Implement the flag for servers, including the nbd passthrough
client
If you want to test the patches together, I've pushed a
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
2019 Mar 28
32
[PATCH nbdkit v5 FINAL 00/19] Implement extents.
This has already been pushed upstream. I am simply posting these here
so we have a reference in the mailing list in case we find bugs later
(as I'm sure we will - it's a complex patch series).
Great thanks to Eric Blake for tireless review on this one. It also
seems to have identified a few minor bugs in qemu along the way.
Rich.
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