1nbdkit-fua-filter(1) NBDKIT nbdkit-fua-filter(1)
2
3
4
6 nbdkit-fua-filter - modify nbdkit flush and Forced Unit Access (FUA)
7
9 nbdkit --filter=fua plugin [fuamode=MODE] [plugin-args...]
10
12 "nbdkit-fua-filter" is a filter that intentionally modifies handling of
13 the “Forced Unit Access” (FUA) flag across the NBD protocol.
14
15 This filter can be used to disable FUA and flush requests for speed
16 (although this is unsafe). Also it can be used to test client or
17 server fallbacks, and for evaluating timing differences between proper
18 use of FUA compared to a full flush.
19
20 Note that by default, the NBD protocol does not guarantee that the use
21 of FUA from one connection will be visible from another connection
22 unless the server advertised NBD_FLAG_MULTI_CONN. You may wish to
23 combine this filter with nbdkit-multi-conn-filter(1) if you plan on
24 making multiple connections to the plugin.
25
27 The "fuamode" parameter is optional and controls which mode the filter
28 will use.
29
30 fuamode=discard
31 (nbdkit ≥ 1.22)
32
33 The filter will discard FUA and flush requests.
34
35 This mode is unsafe: If the NBD disk contains a filesystem then you
36 will likely lose data in the event of a crash. It should only be
37 used for ephemeral data which you can easily recreate, such as
38 caches, builds, test data, etc.
39
40 fuamode=pass
41 (nbdkit ≥ 1.22)
42
43 Pass through FUA and flush requests unchanged. Turns the filter
44 into a no-op.
45
46 fuamode=none
47 FUA support is not advertised to the client. Clients will not be
48 able to issue FUA write requests, but can send flush commands if
49 the plugin supports it.
50
51 This is the default if the "fuamode" parameter is not specified.
52
53 fuamode=emulate
54 The filter will emulate FUA support using the plugin’s ".flush"
55 callback, regardless of whether the plugin itself supports more
56 efficient FUA. It refuses to load if the plugin does not support
57 flush.
58
59 fuamode=native
60 The filter will advertise native FUA support to the client and
61 earlier filters in the chain. This is useful for comparing
62 optimizations of FUA handling when splitting large requests into
63 sub-requests. It refuses to load if the plugin’s ".can_fua"
64 callback returns "NBDKIT_FUA_NONE".
65
66 fuamode=force
67 The filter will request FUA on all write transactions, even when
68 the client did not request it (“write-through” mode). In turn
69 client flush requests become no-ops. It refuses to load if the
70 plugin’s ".can_fua" callback returns "NBDKIT_FUA_NONE".
71
73 • Serve the file disk.img discarding all FUA and flush requests.
74 This can greatly improve performance, but you will likely lose data
75 if there is a crash, so it is not safe.
76
77 nbdkit --filter=discard file disk.img fuamode=discard
78
79 • Serve the file disk.img, but force the client to submit explicit
80 flush requests instead of using "NBD_CMD_FLAG_FUA":
81
82 nbdkit --filter=fua file disk.img
83
84 • Observe that the blocksize filter optimizes its handling of the FUA
85 flag based on whether it knows nbdkit will be emulating FUA with a
86 flush, by comparing the log filter output on top of different fua
87 filter modes:
88
89 nbdkit --filter=blocksize --filter=log --filter=fua file disk.img \
90 maxlen=4k logfile=fua_emulated fuamode=emulate
91 nbdkit --filter=blocksize --filter=log --filter=fua file disk.img \
92 maxlen=4k logfile=fua_native fuamode=native
93
94 • Serve the file disk.img in write-through mode, where all writes
95 from the client are immediately flushed to disk as if the client
96 had always requested FUA:
97
98 nbdkit --filter=fua file disk.img fuamode=force
99
101 $filterdir/nbdkit-fua-filter.so
102 The filter.
103
104 Use "nbdkit --dump-config" to find the location of $filterdir.
105
107 "nbdkit-fua-filter" first appeared in nbdkit 1.4.
108
110 nbdkit(1), nbdkit-file-plugin(1), nbdkit-filter(3),
111 nbdkit-blocksize-filter(1), nbdkit-log-filter(1),
112 nbdkit-multi-conn-filter(1), nbdkit-nocache-filter(1),
113 nbdkit-noextents-filter(1), nbdkit-noparallel-filter(1),
114 nbdkit-nozero-filter(1).
115
117 Eric Blake
118
120 Copyright (C) 2018 Red Hat Inc.
121
123 Redistribution and use in source and binary forms, with or without
124 modification, are permitted provided that the following conditions are
125 met:
126
127 • Redistributions of source code must retain the above copyright
128 notice, this list of conditions and the following disclaimer.
129
130 • Redistributions in binary form must reproduce the above copyright
131 notice, this list of conditions and the following disclaimer in the
132 documentation and/or other materials provided with the
133 distribution.
134
135 • Neither the name of Red Hat nor the names of its contributors may
136 be used to endorse or promote products derived from this software
137 without specific prior written permission.
138
139 THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY
140 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
141 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
142 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE
143 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
144 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
145 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
146 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
147 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
148 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
149 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
150
151
152
153nbdkit-1.30.7 2022-07-10 nbdkit-fua-filter(1)