Displaying 20 results from an estimated 21 matches for "nbd_read_on".
Did you mean:
nbd_read_only
2019 Aug 06
0
[PATCH libnbd 1/3] api: Change nbd_read_only -> nbd_is_read_only.
...bnbd.pod b/docs/libnbd.pod
index 74227fd..6a329d6 100644
--- a/docs/libnbd.pod
+++ b/docs/libnbd.pod
@@ -383,7 +383,7 @@ the export, such as whether it is writable and if it can support flush
to permanent storage. These flags can be accessed from libnbd using
APIs such as:
- int is_read_only = nbd_read_only (nbd);
+ int is_read_only = nbd_is_read_only (nbd);
int can_flush = nbd_can_flush (nbd);
(and several more, see L<libnbd-api(3)>).
diff --git a/examples/batched-read-write.c b/examples/batched-read-write.c
index 9d2c02b..d39a1e5 100644
--- a/examples/batched-read-write.c
+++ b/examples...
2019 Aug 06
1
Re: [PATCH libnbd 1/3] api: Change nbd_read_only -> nbd_is_read_only.
...ck to support both versions.
diff --git i/plugins/nbd/nbd.c w/plugins/nbd/nbd.c
index f11e54d5..a83ded5e 100644
--- i/plugins/nbd/nbd.c
+++ w/plugins/nbd/nbd.c
@@ -566,11 +566,15 @@ nbdplug_get_size (void *handle)
return size;
}
+#ifndef LIBNBD_HAVE_NBD_IS_READ_ONLY
+# define nbd_is_read_only nbd_read_only
+#endif
+
static int
nbdplug_can_write (void *handle)
{
struct handle *h = handle;
- int i = nbd_read_only (h->nbd);
+ int i = nbd_is_read_only (h->nbd);
if (i == -1) {
nbdkit_error ("failure to check readonly flag: %s", nbd_get_error ());
--
Eric Blake, Princi...
2019 Aug 06
5
[PATCH libnbd 0/3] One API and small documentation changes.
One API change, some small documentation changes.
2019 Aug 15
3
[nbdkit PATCH] nbd: Another libnbd version bump
The 0.9.8 release breaks API, requiring a number of changes:
- Use symbolic constants instead of magic numbers/open-coded strings
(well, the string for "base:allocation" was present before this
libnbd bump)
- Change callbacks to drop the valid_flag parameter
- Add _is to nbd_read_only call
- Drop the _callback suffix on nbd_aio_FOO calls
- Add a struct for managing callback/user_data at once
Signed-off-by: Eric Blake <eblake@redhat.com>
---
Pushing, since we're releasing libnbd 0.9.8 today
configure.ac | 4 +--
plugins/nbd/nbd.c | 85 +++++++++++++++++++++--...
2019 Jun 29
0
[libnbd PATCH 1/6] api: Add nbd_aio_in_flight
...9,7 +189,6 @@ start_thread (void *arg)
size_t i;
uint64_t offset, handle;
uint64_t handles[MAX_IN_FLIGHT];
- size_t in_flight; /* counts number of requests in flight */
int dir, r, cmd;
time_t t;
bool expired = false;
@@ -231,8 +230,8 @@ start_thread (void *arg)
assert (nbd_read_only (nbd) == 0);
/* Issue commands. */
- in_flight = 0;
- while (!expired || in_flight > 0) {
+ assert (nbd_aio_in_flight (nbd) == 0);
+ while (!expired || nbd_aio_in_flight (nbd) > 0) {
if (nbd_aio_is_dead (nbd) || nbd_aio_is_closed (nbd)) {
fprintf (stderr, "thread %z...
2019 Aug 15
0
Re: [nbdkit PATCH] nbd: Another libnbd version bump
...elease breaks API, requiring a number of changes:
> - Use symbolic constants instead of magic numbers/open-coded strings
> (well, the string for "base:allocation" was present before this
> libnbd bump)
> - Change callbacks to drop the valid_flag parameter
> - Add _is to nbd_read_only call
> - Drop the _callback suffix on nbd_aio_FOO calls
> - Add a struct for managing callback/user_data at once
Seems reasonable.
> @@ -160,11 +160,12 @@ nbdplug_config (const char *key, const char *value)
> if (strcasecmp (value, "require") == 0 ||
> str...
2019 May 21
0
[libnbd] tmp patch adding deadlock test
...d, argv[1]) == -1) {
+ fprintf (stderr, "%s\n", nbd_get_error ());
+ exit (EXIT_FAILURE);
+ }
+ }
+ else {
+ if (nbd_connect_tcp (nbd, argv[1], argv[2]) == -1) {
+ fprintf (stderr, "%s\n", nbd_get_error ());
+ exit (EXIT_FAILURE);
+ }
+ }
+
+ if (nbd_read_only (nbd) == 1) {
+ fprintf (stderr, "%s: error: this NBD export is read-only\n", argv[0]);
+ exit (EXIT_FAILURE);
+ }
+
+ exportsize = nbd_get_size (nbd);
+ if (exportsize == -1) {
+ fprintf (stderr, "%s\n", nbd_get_error ());
+ exit (EXIT_FAILURE);
+ }
+ packets...
2019 May 22
0
[libnbd PATCH v3 7/7] examples: Add example to demonstrate just-fixed deadlock scenario
...d, argv[1]) == -1) {
+ fprintf (stderr, "%s\n", nbd_get_error ());
+ exit (EXIT_FAILURE);
+ }
+ }
+ else {
+ if (nbd_connect_tcp (nbd, argv[1], argv[2]) == -1) {
+ fprintf (stderr, "%s\n", nbd_get_error ());
+ exit (EXIT_FAILURE);
+ }
+ }
+
+ if (nbd_read_only (nbd) == 1) {
+ fprintf (stderr, "%s: error: this NBD export is read-only\n", argv[0]);
+ exit (EXIT_FAILURE);
+ }
+
+ exportsize = nbd_get_size (nbd);
+ if (exportsize == -1) {
+ fprintf (stderr, "%s\n", nbd_get_error ());
+ exit (EXIT_FAILURE);
+ }
+ packets...
2019 Jun 04
0
[PATCH libnbd v2 4/4] examples: Add concurrent writer example.
...p (nbd, argv[1], argv[2]) == -1) {
+ fprintf (stderr, "%s\n", nbd_get_error ());
+ exit (EXIT_FAILURE);
+ }
+ }
+
+ exportsize = nbd_get_size (nbd);
+ if (exportsize == -1) {
+ fprintf (stderr, "%s\n", nbd_get_error ());
+ exit (EXIT_FAILURE);
+ }
+
+ if (nbd_read_only (nbd) == 1) {
+ fprintf (stderr, "%s: error: this NBD export is read-only\n", argv[0]);
+ exit (EXIT_FAILURE);
+ }
+
+#if NR_MULTI_CONN > 1
+ if (nbd_can_multi_conn (nbd) == 0) {
+ fprintf (stderr, "%s: error: "
+ "this NBD export does not suppor...
2019 Jun 03
0
[PATCH libnbd discussion only 5/5] examples: Add concurrent writer example.
...p (nbd, argv[1], argv[2]) == -1) {
+ fprintf (stderr, "%s\n", nbd_get_error ());
+ exit (EXIT_FAILURE);
+ }
+ }
+
+ exportsize = nbd_get_size (nbd);
+ if (exportsize == -1) {
+ fprintf (stderr, "%s\n", nbd_get_error ());
+ exit (EXIT_FAILURE);
+ }
+
+ if (nbd_read_only (nbd) == 1) {
+ fprintf (stderr, "%s: error: this NBD export is read-only\n", argv[0]);
+ exit (EXIT_FAILURE);
+ }
+
+ if (nbd_can_multi_conn (nbd) == 0) {
+ fprintf (stderr, "%s: error: "
+ "this NBD export does not support multi-conn\n", argv...
2019 May 21
9
[libnbd PATCH 0/3] Avoid deadlock with in-flight commands
This might not be the final solution, but it certainly seems to solve
a deadlock for me that I could trigger by using 'nbdkit
--filter=noparallel memory 512k' and calling nbd_aio_pread for a
request larger than 256k (enough for the Linux kernel to block the
server until libnbd read()s), immediately followed by nbd_aio_pwrite
for a request larger than 256k (enough to block libnbd until the
2019 May 22
10
[libnbd PATCH v2 0/5] Avoid deadlock with in-flight commands
On v1, we discussed whether cmds_to_issue needed to be a list, since
it never had more than one element. I played with the idea of making
it a list, and allowing the client to queue up new commands regardless
of whether the state machine is currently in READY. I also polished up
the tmp demo into a bit more full-fledged example file, worth
including since it also let me discover a hard-to-hit race
2019 May 22
12
[libnbd PATCH v3 0/7] Avoid deadlock with in-flight commands
Since v2:
- rebase to Rich's new API calls
- more refactoring in patch 1 (retitled)
- new patches 3 and 4
- fix data corruption in patch 6 (was 4)
- more tweaks to the reproducer example (including using new API from 3)
Eric Blake (7):
lib: Refactor command_common() to do more common work
commands: Allow for a command queue
commands: Expose FIFO ordering of server completions
2019 May 30
0
[nbdkit PATCH 3/4] nbd: Use libnbd 0.1
...ndle;
+ int64_t size = nbd_get_size (h->nbd);
- return h->size;
+ if (size == -1) {
+ nbdkit_error ("failure to get size: %s", nbd_get_error ());
+ return -1;
+ }
+ return size;
}
static int
nbdplug_can_write (void *handle)
{
struct handle *h = handle;
+ int i = nbd_read_only (h->nbd);
- return !(h->flags & NBD_FLAG_READ_ONLY);
+ if (i == -1) {
+ nbdkit_error ("failure to check readonly flag: %s", nbd_get_error ());
+ return -1;
+ }
+ return !(i || h->readonly);
}
static int
nbdplug_can_flush (void *handle)
{
struct handle *h...
2019 Jun 12
0
[nbdkit PATCH v3 3/5] nbd: Use libnbd 0.1.3+
...ndle;
+ int64_t size = nbd_get_size (h->nbd);
- return h->size;
+ if (size == -1) {
+ nbdkit_error ("failure to get size: %s", nbd_get_error ());
+ return -1;
+ }
+ return size;
}
static int
nbdplug_can_write (void *handle)
{
struct handle *h = handle;
+ int i = nbd_read_only (h->nbd);
- return !(h->flags & NBD_FLAG_READ_ONLY);
+ if (i == -1) {
+ nbdkit_error ("failure to check readonly flag: %s", nbd_get_error ());
+ return -1;
+ }
+ return !(i || h->readonly);
}
static int
nbdplug_can_flush (void *handle)
{
struct handle *h...
2019 Jun 29
19
[libnbd PATCH 0/6] new APIs: aio_in_flight, aio_FOO_notify
I still need to wire in the use of *_notify functions into nbdkit to
prove whether it makes the code any faster or easier to maintain, but
at least the added example shows one good use case for the new API.
Eric Blake (6):
api: Add nbd_aio_in_flight
generator: Allow DEAD state actions to run
generator: Allow Int64 in callbacks
states: Prepare for aio notify callback
api: Add new
2019 Jun 03
10
[PATCH libnbd discussion only 0/5] api: Implement concurrent writer.
This works, but there's no time saving and I'm still investigating
whether it does what I think it does. Nevertheless I thought I would
post it because it (probably) implements the idea I had last night
outlined in:
https://www.redhat.com/archives/libguestfs/2019-June/msg00010.html
The meat of the change is patch 4. Patch 5 is an example which I
would probably fold into patch 4 for
2019 Jun 04
9
[PATCH libnbd v2 0/4] api: Implement concurrent writer.
v1:
https://www.redhat.com/archives/libguestfs/2019-June/msg00014.html
I pushed a few bits which are uncontroversial. The main
changes since v1 are:
An extra patch removes the want_to_send / check for nbd_aio_is_ready
in examples/threaded-reads-and-writes.c. This logic was wrong since
commit 6af72b87 as was pointed out by Eric in his review. Comments
and structure of
2019 May 30
5
[nbdkit PATCH 0/4] Play with libnbd for nbdkit-add
Patch 1 played with an early draft of Rich's Fedora 30 libnbd package:
https://bugzilla.redhat.com/show_bug.cgi?id=1713767#c17
Note that comment 21 provides a newer package 0.1.1-1 with a different
API; and that libnbd has more unreleased API changes in the pipeline
(whether that will be called 0.2 or 0.1.2); so we'll have to tweak
things based on what is actually available in distros.
2019 Jun 02
5
[nbdkit PATCH v2 0/5] Play with libnbd for nbdkit-nbd
libnbd-0.1.2-1 is now available in Fedora 29/30 updates-testing,
although it was not compiled against libxml2 so it lacks uri support
(I ended up testing patch 4 with a self-built libnbd).
Diffs since v1 - rebase to master, bump from libnbd 0.1 to 0.1.2, add
URI support, better timing results
Still not done - patch 5 needs associated tests
Eric Blake (5):
nbd: Check for libnbd
nbd: