search for: init_sparse

Displaying 9 results from an estimated 9 matches for "init_sparse".

2020 Feb 10
2
[nbdkit PATCH 05/10] plugins: Wire up file-based plugin support for NBD_INFO_INIT_STATE
...(SEEK_HOLE) to learn if extents are supported; a slight tweak to remember if that result is EOF tells us if we are sparse, and a similar lseek(SEEK_DATA) returning ENXIO tells us if the entire file is a hole, with at most two lseek calls during open (rather than one lseek for each of .can_extents, .init_sparse, and .init_zero). The split plugin is similar to file. For partitioning and linuxdisk, we know we are exposing a sparse image. For other file-based plugins, like ext2, we do not yet expose .extents so it is not worth trying to expose .init_sparse or .init_zero. A successful test depends on wheth...
2020 Feb 10
17
Cross-project NBD extension proposal: NBD_INFO_INIT_STATE
...hanges, such as using 32 bits; but hopefully by having all four series posted in tandem it becomes easier to see whether any such tweaks are warranted, and can keep such tweaks interoperable before any of the projects land the series upstream]. For now, only 2 of those 16 bits are defined: NBD_INIT_SPARSE (the image has at least one hole) and NBD_INIT_ZERO (the image reads completely as zero); the two bits are orthogonal and can be set independently, although it is easy enough to see completely sparse files with both bits set. Also, advertising the bits is orthogonal to whether the base:allocat...
2020 Feb 10
2
[nbdkit PATCH 03/10] filters: Wire up filter support for NBD_INFO_INIT_STATE
...+++++++++++++--- 10 files changed, 123 insertions(+), 19 deletions(-) diff --git a/docs/nbdkit-filter.pod b/docs/nbdkit-filter.pod index 55dfab1..0f81684 100644 --- a/docs/nbdkit-filter.pod +++ b/docs/nbdkit-filter.pod @@ -413,6 +413,10 @@ cached value. =head2 C<.can_cache> +=head2 C<.init_sparse> + +=head2 C<.init_zero> + int (*can_write) (struct nbdkit_next_ops *next_ops, void *nxdata, void *handle); int (*can_flush) (struct nbdkit_next_ops *next_ops, void *nxdata, @@ -434,6 +438,10 @@ cached value. void *handle); int (*can_cache...
2020 Feb 10
2
[nbdkit PATCH 04/10] plugins: Wire up in-memory plugin support for NBD_INFO_INIT_STATE
...41bffb7..d55aafd 100644 --- a/docs/nbdkit-plugin.pod +++ b/docs/nbdkit-plugin.pod @@ -712,6 +712,29 @@ This callback is not required. If omitted, then we return C<NBDKIT_CACHE_NONE> if the C<.cache> callback is missing, or C<NBDKIT_CACHE_NATIVE> if it is defined. +=head2 C<.init_sparse> + + int init_sparse (void *handle); + +This is called during the option negotiation phase to find out if the +plugin knows whether the image starts out as sparse (that is, at least +one unallocated hole, regardless of what might be read from that hole). + +This callback is not required. If omi...
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 work on > + * the current filesystem, and to see if the image is sparse or zero. > +...
2020 Feb 10
3
Re: Cross-project NBD extension proposal: NBD_INFO_INIT_STATE
On 2/10/20 4:12 PM, Richard W.M. Jones wrote: > On Mon, Feb 10, 2020 at 03:37:20PM -0600, Eric Blake wrote: >> For now, only 2 of those 16 bits are defined: NBD_INIT_SPARSE (the >> image has at least one hole) and NBD_INIT_ZERO (the image reads >> completely as zero); the two bits are orthogonal and can be set >> independently, although it is easy enough to see completely sparse >> files with both bits set. > > I think I'm confused a...
2020 Feb 10
0
Re: Cross-project NBD extension proposal: NBD_INFO_INIT_STATE
On Mon, Feb 10, 2020 at 04:29:53PM -0600, Eric Blake wrote: > On 2/10/20 4:12 PM, Richard W.M. Jones wrote: > >On Mon, Feb 10, 2020 at 03:37:20PM -0600, Eric Blake wrote: > >>For now, only 2 of those 16 bits are defined: NBD_INIT_SPARSE (the > >>image has at least one hole) and NBD_INIT_ZERO (the image reads > >>completely as zero); the two bits are orthogonal and can be set > >>independently, although it is easy enough to see completely sparse > >>files with both bits set. > > > >I...
2020 Feb 10
1
[nbdkit PATCH 10/10] plugins: Wire up nbd plugin support for NBD_INFO_INIT_STATE
...9 Red Hat Inc. + * Copyright (C) 2017-2020 Red Hat Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -702,6 +702,42 @@ nbdplug_can_extents (void *handle) return i; } +static int +nbdplug_init_sparse (void *handle) +{ + struct handle *h = handle; + int i = 0; + +#if LIBNBD_HAVE_NBD_GET_INIT_FLAGS + i = nbd_get_init_flags (h->nbd); + + if (i == -1) { + nbdkit_error ("failure to check init flags: %s", nbd_get_error ()); + return -1; + } + i = !!(i & LIBNBD_INIT_SPARSE...
2020 Feb 10
0
[libnbd PATCH 1/1] generator: Add support for NBD_INFO_INIT_STATE extension
...ith + args = []; ret = RInt; + permitted_states = [ Connected; Closed ]; + shortdesc = "return any init state flags advertised by the server"; + longdesc = "\ +Return the bitwise-OR of any initial state flags advertised by the +server. These flags may include C<LIBNBD_INIT_SPARSE> if the export +is not fully allocated, or C<LIBNBD_INIT_ZERO> if the export is known +to start with all contents reading as zeroes. Other flags might be +added in the future. + +Note that the flags advertised by the server refer only to the point +in time when the connection was establis...