3 nbdkit-fua-filter - modify nbdkit flush and Forced Unit Access (FUA)
7 nbdkit --filter=fua plugin [fuamode=MODE] [plugin-args...]
11 C<nbdkit-fua-filter> is a filter that intentionally modifies handling
12 of the S<“Forced Unit Access”> (FUA) flag across the NBD protocol.
14 This filter can be used to disable FUA and flush requests for speed
15 (although this is unsafe). Also it can be used to test client or
16 server fallbacks, and for evaluating timing differences between proper
17 use of FUA compared to a full flush.
19 Note that by default, the NBD protocol does not guarantee that the use
20 of FUA from one connection will be visible from another connection
21 unless the server advertised NBD_FLAG_MULTI_CONN. You may wish to
22 combine this filter with L<nbdkit-multi-conn-filter(1)> if you plan on
23 making multiple connections to the plugin.
27 The C<fuamode> parameter is optional and controls which mode the
32 =item B<fuamode=discard>
36 The filter will discard FUA and flush requests.
38 B<This mode is unsafe>: If the NBD disk contains a filesystem then you
39 will likely lose data in the event of a crash. It should only be used
40 for ephemeral data which you can easily recreate, such as caches,
41 builds, test data, etc.
47 Pass through FUA and flush requests unchanged. Turns the filter into
52 FUA support is not advertised to the client. Clients will not be able
53 to issue FUA write requests, but can send flush commands if the plugin
56 This is the default if the C<fuamode> parameter is not specified.
58 =item B<fuamode=emulate>
60 The filter will emulate FUA support using the plugin’s C<.flush>
61 callback, regardless of whether the plugin itself supports more
62 efficient FUA. It refuses to load if the plugin does not support
65 =item B<fuamode=native>
67 The filter will advertise native FUA support to the client and earlier
68 filters in the chain. This is useful for comparing optimizations of
69 FUA handling when splitting large requests into sub-requests. It
70 refuses to load if the plugin’s C<.can_fua> callback returns
73 =item B<fuamode=force>
75 The filter will request FUA on all write transactions, even when the
76 client did not request it (“write-through” mode). In turn client
77 flush requests become no-ops. It refuses to load if the plugin’s
78 C<.can_fua> callback returns C<NBDKIT_FUA_NONE>.
88 Serve the file F<disk.img> discarding all FUA and flush requests.
89 This can greatly improve performance, but you will likely lose data if
90 there is a crash, so it is not safe.
92 nbdkit --filter=discard file disk.img fuamode=discard
96 Serve the file F<disk.img>, but force the client to submit explicit
97 flush requests instead of using C<NBD_CMD_FLAG_FUA>:
99 nbdkit --filter=fua file disk.img
103 Observe that the blocksize filter optimizes its handling of the FUA
104 flag based on whether it knows nbdkit will be emulating FUA with a
105 flush, by comparing the log filter output on top of different fua
108 nbdkit --filter=blocksize --filter=log --filter=fua file disk.img \
109 maxlen=4k logfile=fua_emulated fuamode=emulate
110 nbdkit --filter=blocksize --filter=log --filter=fua file disk.img \
111 maxlen=4k logfile=fua_native fuamode=native
115 Serve the file F<disk.img> in write-through mode, where all writes
116 from the client are immediately flushed to disk as if the client had
117 always requested FUA:
119 nbdkit --filter=fua file disk.img fuamode=force
127 =item F<$filterdir/nbdkit-fua-filter.so>
131 Use C<nbdkit --dump-config> to find the location of C<$filterdir>.
137 C<nbdkit-fua-filter> first appeared in nbdkit 1.4.
142 L<nbdkit-file-plugin(1)>,
144 L<nbdkit-blocksize-filter(1)>,
145 L<nbdkit-log-filter(1)>,
146 L<nbdkit-multi-conn-filter(1)>,
147 L<nbdkit-nocache-filter(1)>,
148 L<nbdkit-noextents-filter(1)>,
149 L<nbdkit-noparallel-filter(1)>,
150 L<nbdkit-nozero-filter(1)>.
158 Copyright (C) 2018 Red Hat Inc.