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