search for: file_can_trim

Displaying 14 results from an estimated 14 matches for "file_can_trim".

2018 Jan 31
1
[nbdkit PATCH] file: Add trim support
...c @@ -1,5 +1,5 @@ /* nbdkit - * Copyright (C) 2013 Red Hat Inc. + * Copyright (C) 2013-2018 Red Hat Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -175,6 +175,18 @@ file_get_size (void *handle) return statbuf.st_size; } +static int +file_can_trim (void *handle) +{ + /* Trim is advisory, but we prefer to advertise it only when we can + * actually (attempt to) punch holes. */ +#ifdef FALLOC_FL_PUNCH_HOLE + return 1; +#else + return 0; +#endif +} + /* Read data from the file. */ static int file_pread (void *handle, void *buf, uint32_t...
2018 Aug 02
2
Re: [PATCH 1/3] file: Avoid unsupported fallocate() calls
...s defined before we did the first call. Once we tried > + * to punch a hole, report the actual cappability of the underlying file. */ s/cappability/capability/ If you use a tri-state, then report true if the variable is indeterminate or works, false if known to fail. > static int > file_can_trim (void *handle) > { > - /* Trim is advisory, but we prefer to advertise it only when we can > - * actually (attempt to) punch holes. Since not all filesystems > - * support all fallocate modes, it would be nice if we had a way > - * from fpathconf() to definitively learn wha...
2019 Jan 05
0
[PATCH nbdkit v2 08/11] file: Return NBD_FLAG_CAN_MULTI_CONN for the file plugin.
...ile/file.c index dcff0ee..628f8fb 100644 --- a/plugins/file/file.c +++ b/plugins/file/file.c @@ -250,6 +250,13 @@ file_get_size (void *handle) } } +/* Allow multiple parallel connections from a single client. */ +static int +file_can_multi_conn (void *handle) +{ + return 1; +} + static int file_can_trim (void *handle) { @@ -507,6 +514,7 @@ static struct nbdkit_plugin plugin = { .open = file_open, .close = file_close, .get_size = file_get_size, + .can_multi_conn = file_can_multi_conn, .can_trim = file_can_trim, .can_fua = file...
2019 Jan 05
0
[PATCH nbdkit v2 07/11] file: Implement NBDKIT_API_VERSION 2.
...ile/file.c index 2a8c9b5..dcff0ee 100644 --- a/plugins/file/file.c +++ b/plugins/file/file.c @@ -52,6 +52,8 @@ #include <linux/fs.h> /* For BLKZEROOUT */ #endif +#define NBDKIT_API_VERSION 2 + #include <nbdkit-plugin.h> #include "isaligned.h" @@ -263,9 +265,30 @@ file_can_trim (void *handle) #endif } +static int +file_can_fua (void *handle) +{ + return NBDKIT_FUA_NATIVE; +} + +/* Flush the file to disk. */ +static int +file_flush (void *handle, uint32_t flags) +{ + struct handle *h = handle; + + if (fdatasync (h->fd) == -1) { + nbdkit_error ("fdatasync:...
2018 Aug 02
0
Re: [PATCH 1/3] file: Avoid unsupported fallocate() calls
...> assumes it works). So the best you can do is make subsequent > connections more efficient after the initial connection has learned state. > Sure disabling trim does not help the client. The only advantage is not calling trim when it does nothing. Do you think it is better to leave the file_can_trim as is, to avoid confusion? > > > - zero changed to: > > 1. If we can punch hole and may trim, try PUNCH_HOLE > > 2. If we can zero range, try ZERO_RANGE > > 3. Fall back to manual writing > > > > - trim changed to: > > 1. If we can punch hol...
2018 Aug 03
10
[PATCH v2 0/4] file: Zero for block devices and older file systems
This is the third version to support efficient zero for block devices on older kernels (e.g. RHEL 7.5), and file systems that do not support yet FALLOC_FS_ZERO_RANGE (e.g. NFS 4.2). Changes since v2: - Revert file_can_trim change, since it is too late to change the value after negotiation. Changing the capability dinamically may be useful internally, but it should be done via other means. - Do not depend on FALLOC_FL_* when including <linux/fs.h>. - Add common/includes/isaligned.h for is_aligned helper, imp...
2019 Jan 04
10
[PATCH nbdkit 0/7] server: Implement NBD_FLAG_CAN_MULTI_CONN.
First thing to say is that I need to do a *lot* more testing on this, so this is just an early peek. In particular, although it passed ‘make check && make check-valgrind’ I have *not* tested it against a multi-conn-aware client such as the Linux kernel >= 4.9. This implements NBD_FLAG_CAN_MULTI_CONN, described in the protocol doc as: "NBD_FLAG_CAN_MULTI_CONN: Indicates that
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]
2018 Aug 02
0
[PATCH 1/3] file: Avoid unsupported fallocate() calls
...e prefer to advertise it only when we can actually + * (attempt to) punch holes. Before we tried to punch a hole, report true if + * FALLOC_FL_PUNCH_HOLE is defined before we did the first call. Once we tried + * to punch a hole, report the actual cappability of the underlying file. */ static int file_can_trim (void *handle) { - /* Trim is advisory, but we prefer to advertise it only when we can - * actually (attempt to) punch holes. Since not all filesystems - * support all fallocate modes, it would be nice if we had a way - * from fpathconf() to definitively learn what will work on a given -...
2018 Aug 02
10
[PATCH 0/3] file: Zero for block devices and older file systems
This is the second version to support efficient zero for block devices on older kernels (e.g. RHEL 7.5), and file systems that do not support yet FALLOC_FS_ZERO_RANGE (e.g. NFS 4.2). Changes since v1: - Split to smaller patches - Skip linux only includes on other systems - Skip code using BLKZEROOUT if the macro is not defined - Try BLKZEROOUT only if the offset and count are aligned to device
2020 Apr 09
0
[PATCH nbdkit v2 1/3] file: Move file operators to a new common/fileops mini-library.
...t_error ("fstat: %m"); - return -1; - } - - return statbuf.st_size; - } -} - /* Allow multiple parallel connections from a single client. */ static int file_can_multi_conn (void *handle) @@ -275,374 +154,6 @@ file_can_multi_conn (void *handle) return 1; } -static int -file_can_trim (void *handle) -{ - /* Trim is advisory, but we prefer to advertise it only when we can - * actually (attempt to) punch holes. Since not all filesystems - * support all fallocate modes, it would be nice if we had a way - * from fpathconf() to definitively learn what will work on a given -...
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 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 May 16
27
[nbdkit PATCH v2 00/24] implement NBD_CMD_CACHE
Since v1: - rework .can_cache to be tri-state, with default of no advertisement (ripple effect through other patches) - add a lot more patches in order to round out filter support And in the meantime, Rich pushed NBD_CMD_CACHE support into libnbd, so in theory we now have a way to test cache commands through the entire stack. Eric Blake (24): server: Internal hooks for implementing