search for: file_can_extents

Displaying 20 results from an estimated 22 matches for "file_can_extents".

2019 Mar 20
0
[PATCH nbdkit 8/8] file: Implement extents.
...size = block_device_size (h->fd); + pthread_mutex_unlock (&lseek_lock); return size; } else { /* Regular file. */ @@ -501,6 +519,103 @@ file_trim (void *handle, uint32_t count, uint64_t offset, uint32_t flags) return 0; } +#ifdef SEEK_HOLE +/* Extents. */ + +static int +file_can_extents (void *handle) +{ + struct handle *h = handle; + off_t r; + + /* A simple test to see whether SEEK_HOLE etc is likely to work on + * the current filesystem. + */ + pthread_mutex_lock (&lseek_lock); + r = lseek (h->fd, 0, SEEK_HOLE); + pthread_mutex_unlock (&lseek_lock); + if (...
2019 Apr 24
2
Re: [PATCH nbdkit v5 FINAL 15/19] file: Implement extents.
.../file/file.c | 141 ++++++++++++++++++++++++++++++++++--- > tests/Makefile.am | 5 ++ > tests/test-file-extents.sh | 57 +++++++++++++++ > 3 files changed, 193 insertions(+), 10 deletions(-) > > +#ifdef SEEK_HOLE > +/* Extents. */ > + > +static int > +file_can_extents (void *handle) > +{ > + struct handle *h = handle; > + off_t r; > + > + /* A simple test to see whether SEEK_HOLE etc is likely to work on > + * the current filesystem. > + */ > + pthread_mutex_lock (&lseek_lock); > + r = lseek (h->fd, 0, SEEK_HOLE); >...
2019 Mar 23
1
Re: [PATCH nbdkit 8/8] file: Implement extents.
...f you can guarantee that .size won't be called in parallel with some other .extents. /me reads ahead Oh, the caller has the lock. I might add a comment to this function that it expects the caller to grab the lock. > > +#ifdef SEEK_HOLE > +/* Extents. */ > + > +static int > +file_can_extents (void *handle) > +{ > + struct handle *h = handle; > + off_t r; > + > + /* A simple test to see whether SEEK_HOLE etc is likely to work on > + * the current filesystem. > + */ > + pthread_mutex_lock (&lseek_lock); > + r = lseek (h->fd, 0, SEEK_HOLE); >...
2019 Mar 28
0
[PATCH nbdkit v5 FINAL 15/19] file: Implement extents.
...size = block_device_size (h->fd); + pthread_mutex_unlock (&lseek_lock); return size; } else { /* Regular file. */ @@ -501,6 +521,103 @@ file_trim (void *handle, uint32_t count, uint64_t offset, uint32_t flags) return 0; } +#ifdef SEEK_HOLE +/* Extents. */ + +static int +file_can_extents (void *handle) +{ + struct handle *h = handle; + off_t r; + + /* A simple test to see whether SEEK_HOLE etc is likely to work on + * the current filesystem. + */ + pthread_mutex_lock (&lseek_lock); + r = lseek (h->fd, 0, SEEK_HOLE); + pthread_mutex_unlock (&lseek_lock); + if (...
2019 Apr 25
0
Re: [PATCH nbdkit v5 FINAL 15/19] file: Implement extents.
...++++++++++--- > > tests/Makefile.am | 5 ++ > > tests/test-file-extents.sh | 57 +++++++++++++++ > > 3 files changed, 193 insertions(+), 10 deletions(-) > > > > > +#ifdef SEEK_HOLE > > +/* Extents. */ > > + > > +static int > > +file_can_extents (void *handle) > > +{ > > + struct handle *h = handle; > > + off_t r; > > + > > + /* A simple test to see whether SEEK_HOLE etc is likely to work on > > + * the current filesystem. > > + */ > > + pthread_mutex_lock (&lseek_lock); > >...
2020 Feb 10
2
[nbdkit PATCH 05/10] plugins: Wire up file-based plugin support for NBD_INFO_INIT_STATE
..."extents enabled, image currently all data"); + } + else { + nbdkit_debug ("extents enabled, image includes data before hole"); + h->init_sparse = true; + } + } + } + } +#endif + return h; } @@ -540,18 +589,8 @@ static int file_can_extents (void *handle) { struct handle *h = handle; - off_t r; - /* A simple test to see whether SEEK_HOLE etc is likely to work on - * the current filesystem. - */ - ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lseek_lock); - r = lseek (h->fd, 0, SEEK_HOLE); - if (r == -1) { - nbdkit_debug (&q...
2020 Aug 06
2
[PATCH nbdkit] Experiment with parallel python plugin
...ile.c index dc99f992..27316b9f 100644 --- a/plugins/file/file.c +++ b/plugins/file/file.c @@ -170,7 +170,7 @@ file_open (int readonly) return NULL; } - flags = O_CLOEXEC|O_NOCTTY; + flags = O_CLOEXEC|O_NOCTTY|O_DIRECT; if (readonly) flags |= O_RDONLY; else @@ -551,7 +551,7 @@ file_can_extents (void *handle) nbdkit_debug ("extents disabled: lseek: SEEK_HOLE: %m"); return 0; } - return 1; + return 0; } static int diff --git a/plugins/python/examples/file.py b/plugins/python/examples/file.py index 866b8244..3652eb52 100644 --- a/plugins/python/examples/file.py...
2020 Aug 06
0
[PATCH nbdkit] Experiment with parallel python plugin
...ile.c index dc99f992..27316b9f 100644 --- a/plugins/file/file.c +++ b/plugins/file/file.c @@ -170,7 +170,7 @@ file_open (int readonly) return NULL; } - flags = O_CLOEXEC|O_NOCTTY; + flags = O_CLOEXEC|O_NOCTTY|O_DIRECT; if (readonly) flags |= O_RDONLY; else @@ -551,7 +551,7 @@ file_can_extents (void *handle) nbdkit_debug ("extents disabled: lseek: SEEK_HOLE: %m"); return 0; } - return 1; + return 0; } static int diff --git a/plugins/python/examples/file.py b/plugins/python/examples/file.py index 866b8244..3652eb52 100644 --- a/plugins/python/examples/file.py...
2020 Aug 06
0
Re: [PATCH nbdkit] Experiment with parallel python plugin
...e/file.c > +++ b/plugins/file/file.c > @@ -170,7 +170,7 @@ file_open (int readonly) > return NULL; > } > > - flags = O_CLOEXEC|O_NOCTTY; > + flags = O_CLOEXEC|O_NOCTTY|O_DIRECT; > if (readonly) > flags |= O_RDONLY; > else > @@ -551,7 +551,7 @@ file_can_extents (void *handle) > nbdkit_debug ("extents disabled: lseek: SEEK_HOLE: %m"); > return 0; > } > - return 1; > + return 0; > } > > static int > diff --git a/plugins/python/examples/file.py b/plugins/python/examples/file.py > index 866b8244..3652...
2020 Apr 09
0
[PATCH nbdkit v2 1/3] file: Move file operators to a new common/fileops mini-library.
...h->can_punch_hole = false; - - nbdkit_debug ("ignoring failed fallocate during trim: %m"); - } - } -#endif - - if ((flags & NBDKIT_FLAG_FUA) && file_flush (handle, 0) == -1) - return -1; - - return 0; -} - -#ifdef SEEK_HOLE -/* Extents. */ - -static int -file_can_extents (void *handle) -{ - struct handle *h = handle; - off_t r; - - /* A simple test to see whether SEEK_HOLE etc is likely to work on - * the current filesystem. - */ - ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lseek_lock); - r = lseek (h->fd, 0, SEEK_HOLE); - if (r == -1) { - nbdkit_debug (&...
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; /*
2020 Aug 07
0
[nbdkit PATCH 2/4] file: Add .list_exports support
...7 @@ file_get_size (void *handle) struct handle *h = handle; if (h->is_block_device) { - ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lseek_lock); + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); return block_device_size (h->fd); } else { /* Regular file. */ @@ -554,7 +638,7 @@ file_can_extents (void *handle) /* A simple test to see whether SEEK_HOLE etc is likely to work on * the current filesystem. */ - ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lseek_lock); + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); r = lseek (h->fd, 0, SEEK_HOLE); if (r == -1) { nbdkit_debug (&...
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 Apr 24
7
[nbdkit PATCH 0/4] More mutex sanity checking
I do have a question about whether patch 2 is right, or whether I've exposed a bigger problem in the truncate (and possibly other) filter, but the rest seem fairly straightforward. Eric Blake (4): server: Check for pthread lock failures truncate: Factor out reading real_size under mutex plugins: Check for mutex failures filters: Check for mutex failures filters/cache/cache.c
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 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.
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
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
2019 May 10
11
[nbdkit PATCH 0/9] RFC: implement NBD_CMD_CACHE
I'm still working my way through the filters before this series will be complete, but this is enough of a start to at least get some feedback on the idea of implementing another NBD protocol extension. Eric Blake (9): server: Internal hooks for implementing NBD_CMD_CACHE plugins: Add .cache callback file, split: Implement .cache with posix_fadvise nbd: Implement NBD_CMD_CACHE