search for: nbd_flag_read_only

Displaying 20 results from an estimated 34 matches for "nbd_flag_read_only".

2017 Nov 15
1
[nbdkit PATCH] connections: Extract common export flag computation code
...-237,13 +237,57 @@ free_connection (struct connection *conn) } static int +compute_eflags (struct connection *conn, uint16_t *flags) +{ + uint16_t eflags = NBD_FLAG_HAS_FLAGS; + int fl; + + fl = plugin_can_write (conn); + if (fl == -1) + return -1; + if (readonly || !fl) { + eflags |= NBD_FLAG_READ_ONLY; + conn->readonly = 1; + } + if (!conn->readonly) { + eflags |= NBD_FLAG_SEND_WRITE_ZEROES; + } + + fl = plugin_can_flush (conn); + if (fl == -1) + return -1; + if (fl) { + eflags |= NBD_FLAG_SEND_FLUSH | NBD_FLAG_SEND_FUA; + conn->can_flush = 1; + } + + fl = plugin_...
2016 Sep 26
1
[PATCH] nbdkit: flags are 32 bits for oldstyle connections
...ugin_get_size (conn); @@ -169,14 +169,13 @@ exportsize = (uint64_t) r; conn->exportsize = exportsize; - gflags = 0; - eflags = NBD_FLAG_HAS_FLAGS; + flags = NBD_FLAG_HAS_FLAGS; fl = plugin_can_write (conn); if (fl == -1) return -1; if (readonly || !fl) { - eflags |= NBD_FLAG_READ_ONLY; + flags |= NBD_FLAG_READ_ONLY; conn->readonly = 1; } @@ -184,7 +183,7 @@ if (fl == -1) return -1; if (fl) { - eflags |= NBD_FLAG_SEND_FLUSH | NBD_FLAG_SEND_FUA; + flags |= NBD_FLAG_SEND_FLUSH | NBD_FLAG_SEND_FUA; conn->can_flush = 1; } @@ -192,7 +191,7...
2017 Jan 20
7
[nbdkit PATCH 0/5] Add WRITE_ZEROES support
The upstream protocol recently promoted NBD_CMD_WRITE_ZEROES from experimental to a documented extension. Exposing support for this allows plugin writers to create sparse files when driven by a client that knows how to use the extension; meanwhile, even if a plugin does not support this extension, the server benefits from less network traffic from the client. Eric Blake (5): protocol: Support
2020 Aug 03
1
Re: [nbdkit PATCH 3/4] server: Implement list_exports.
On 7/31/20 5:22 PM, Eric Blake wrote: > From: "Richard W.M. Jones" <rjones@redhat.com> > > See also: > https://www.redhat.com/archives/libguestfs/2020-July/msg00090.html > Message-Id: <20200722124201.1823468-2-rjones@redhat.com> > > For now, this implementation is only for plugins; adding filter > support will come later (and probably requires
2018 Dec 06
0
[PATCH nbdkit 3/5] protocol: Generate map functions from NBD protocol flags to printable strings.
...INT64_C(0x3e889045565a9) /* Global flags. */ +extern const char *name_of_nbd_global_flag (int); #define NBD_FLAG_FIXED_NEWSTYLE 1 #define NBD_FLAG_NO_ZEROES 2 /* Per-export flags. */ +extern const char *name_of_nbd_flag (int); #define NBD_FLAG_HAS_FLAGS (1 << 0) #define NBD_FLAG_READ_ONLY (1 << 1) #define NBD_FLAG_SEND_FLUSH (1 << 2) @@ -94,6 +96,7 @@ struct fixed_new_option_reply { #define NBD_FLAG_SEND_WRITE_ZEROES (1 << 6) /* NBD options (new style handshake only). */ +extern const char *name_of_nbd_opt (int); #define NBD_OPT_EXPORT_NAME 1...
2019 Aug 06
0
[PATCH libnbd 1/3] api: Change nbd_read_only -> nbd_is_read_only.
...f --git a/lib/flags.c b/lib/flags.c index cdbc28f..2bcacb8 100644 --- a/lib/flags.c +++ b/lib/flags.c @@ -65,7 +65,7 @@ get_flag (struct nbd_handle *h, uint16_t flag) } int -nbd_unlocked_read_only (struct nbd_handle *h) +nbd_unlocked_is_read_only (struct nbd_handle *h) { return get_flag (h, NBD_FLAG_READ_ONLY); } diff --git a/lib/rw.c b/lib/rw.c index bba62be..50ba23d 100644 --- a/lib/rw.c +++ b/lib/rw.c @@ -341,7 +341,7 @@ nbd_unlocked_aio_pwrite_callback (struct nbd_handle *h, const void *buf, { struct command_cb cb = { .completion = completion, .user_data = user_data, }; - if (nbd_unlocked_re...
2017 Nov 22
3
[nbdkit PATCH 0/2] more nbd tweaks
I tried reproducing the testsuite failure on test-parallel-*.sh using the same machine Rich posted a log from, but did not quickly hit it on a loop of make -j20 check TESTS=test-parallel-{file,nbd}.sh But I still think this series can't hurt. Eric Blake (2): nbd: Don't advertise writes if nbdkit is readonly tests: Make parallel tests more robust plugins/nbd/nbd.c | 2 ++
2019 Sep 24
0
[PATCH nbdkit 2/4] common/protocol: Remove protostrings.sed, use bash+sed instead.
...INT64_C(0x3e889045565a9) /* Global flags. */ -extern const char *name_of_nbd_global_flag (int); #define NBD_FLAG_FIXED_NEWSTYLE 1 #define NBD_FLAG_NO_ZEROES 2 /* Per-export flags. */ -extern const char *name_of_nbd_flag (int); #define NBD_FLAG_HAS_FLAGS (1 << 0) #define NBD_FLAG_READ_ONLY (1 << 1) #define NBD_FLAG_SEND_FLUSH (1 << 2) @@ -99,7 +97,6 @@ extern const char *name_of_nbd_flag (int); #define NBD_FLAG_SEND_FAST_ZERO (1 << 11) /* NBD options (new style handshake only). */ -extern const char *name_of_nbd_opt (int); #define NBD_OPT_EXP...
2019 May 23
5
[PATCH libnbd 0/3] Prevent some misuse of multi-conn.
Per recent discussion here: https://www.redhat.com/archives/libguestfs/2019-May/thread.html#00175
2019 Jan 01
2
[PATCH nbdkit] server: Use bool for types which are really booleans.
...an_flush; + bool is_rotational; + bool can_trim; + bool can_zero; + bool can_fua; + bool using_tls; int sockin, sockout; connection_recv_function recv; @@ -419,7 +419,7 @@ compute_eflags (struct connection *conn, uint16_t *flags) return -1; if (readonly || !fl) { eflags |= NBD_FLAG_READ_ONLY; - conn->readonly = 1; + conn->readonly = true; } if (!conn->readonly) { fl = backend->can_zero (backend, conn); @@ -427,7 +427,7 @@ compute_eflags (struct connection *conn, uint16_t *flags) return -1; if (fl) { eflags |= NBD_FLAG_SEND_WRITE_ZEROES; -...
2019 Aug 06
5
[PATCH libnbd 0/3] One API and small documentation changes.
One API change, some small documentation changes.
2019 May 30
0
[nbdkit PATCH 3/4] nbd: Use libnbd 0.1
...new handshake: %m"); - goto err; - } - h->size = be64toh (finish.exportsize); - h->flags = be16toh (finish.eflags); - } - } - else { - nbdkit_error ("unexpected version %#" PRIx64, version); - goto err; - } if (readonly) - h->flags |= NBD_FLAG_READ_ONLY; + h->readonly = true; /* Spawn a dedicated reader thread */ - if ((errno = pthread_mutex_init (&h->write_lock, NULL))) { - nbdkit_error ("failed to initialize write mutex: %m"); - goto err; - } if ((errno = pthread_mutex_init (&h->trans_lock, NULL))) {...
2019 Jun 12
0
[nbdkit PATCH v3 3/5] nbd: Use libnbd 0.1.3+
...new handshake: %m"); - goto err; - } - h->size = be64toh (finish.exportsize); - h->flags = be16toh (finish.eflags); - } - } - else { - nbdkit_error ("unexpected version %#" PRIx64, version); - goto err; - } if (readonly) - h->flags |= NBD_FLAG_READ_ONLY; + h->readonly = true; /* Spawn a dedicated reader thread */ - if ((errno = pthread_mutex_init (&h->write_lock, NULL))) { - nbdkit_error ("failed to initialize write mutex: %m"); - goto err; - } if ((errno = pthread_mutex_init (&h->trans_lock, NULL))) {...
2020 Mar 19
1
[nbdkit PATCH] nbd: Drop nbd-standalone fallback
...new handshake: %m"); - goto err; - } - h->size = be64toh (finish.exportsize); - h->flags = be16toh (finish.eflags); - } - } - else { - nbdkit_error ("unexpected version %#" PRIx64, version); - goto err; - } - if (readonly) - h->flags |= NBD_FLAG_READ_ONLY; - - /* Spawn a dedicated reader thread */ - if ((errno = pthread_mutex_init (&h->write_lock, NULL))) { - nbdkit_error ("failed to initialize write mutex: %m"); - goto err; - } - if ((errno = pthread_mutex_init (&h->trans_lock, NULL))) { - nbdkit_error ("fa...
2016 Jan 11
1
[PATCH] Add support for newstyle NBD protocol (RHBZ#1297100).
Experimental and only very lightly tested so far. Rich.
2019 Aug 30
0
[nbdkit PATCH 6/9] server: Cache per-connection can_FOO flags
...l-handshake.c @@ -51,87 +51,72 @@ protocol_compute_eflags (struct connection *conn, uint16_t *flags) { uint16_t eflags = NBD_FLAG_HAS_FLAGS; int fl; + bool can_write = true; fl = backend_can_write (backend, conn); if (fl == -1) return -1; if (readonly || !fl) { eflags |= NBD_FLAG_READ_ONLY; - conn->readonly = true; + can_write = false; } - if (!conn->readonly) { - fl = backend_can_zero (backend, conn); - if (fl == -1) - return -1; - if (fl) { - eflags |= NBD_FLAG_SEND_WRITE_ZEROES; - conn->can_zero = true; - } - fl = backend_can_trim...
2018 Dec 06
10
[PATCH nbdkit 0/5] protocol: Generate map functions from NBD protocol flags to printable strings.
With some crufty sed scripts we can generate functions that map from NBD protocol flags (eg. NBD_CMD_READ) to strings ("NBD_CMD_READ"). This works on GNU sed and with FreeBSD, also with GNU sed's --posix option, so I guess the sed code is POSIX-compatible. Rich.
2017 Nov 14
0
[nbdkit PATCH v2 1/2] nbd: Add new nbd forwarding plugin
..._CMD_DISC, 0, 0, 0); + close (h->fd); + free (h); +} + +/* Get the file size. */ +static int64_t +nbd_get_size (void *handle) +{ + struct handle *h = handle; + + return h->size; +} + +static int +nbd_can_write (void *handle) +{ + struct handle *h = handle; + + return !(h->flags & NBD_FLAG_READ_ONLY); +} + +static int +nbd_can_flush (void *handle) +{ + struct handle *h = handle; + + return h->flags & NBD_FLAG_SEND_FLUSH; +} + +static int +nbd_is_rotational (void *handle) +{ + struct handle *h = handle; + + return h->flags & NBD_FLAG_ROTATIONAL; +} + +static int +nbd_can_trim...
2019 Aug 30
3
[nbdkit PATCH v2 0/2] caching .can_write
This is a subset of the last half of the larger 9-patch series. The uncontroversial first half of that series is pushed, but here, I tried to reduce the size of the patches by splitting out some of the more complex changes, so that the rest of the changes remaining in the series are more mechanical. In turn, it forced me to write timing tests, which let me spot another spot where we are wasting
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