nbdkit-readahead-filter(1)

πŸ’– nbdkit-readahead-filter β€” prefetch data ahead of sequential reads πŸ’–

okay bestie, so this is a page from the NBDKIT manual set, and honestly? it's a whole vibe. it's called nbdkit-readahead-filter, it's a filter, and it does exactly one iconic thing: it reads ahead so your sequential reads go brrrr. let's get into it πŸ¦‹


✨ NAME ✨

nbdkit-readahead-filter β€” prefetch data ahead of sequential reads

✨ SYNOPSIS ✨

nbdkit --filter=readahead PLUGIN

nbdkit --filter=readahead --filter=cache PLUGIN

nbdkit --filter=readahead --filter=cow PLUGIN cow-on-cache=true

✨ DESCRIPTION ✨

so nbdkit-readahead-filter is a filter that prefetches data when the client is reading. that's the whole personality. πŸ’…

when the client issues a read, this filter issues a parallel prefetch (.cache) for the data that's coming up next. plugins that support this command will go grab that data early, which makes sequential reads faster. and for plugins that don't support this command? no worries bestie, you can inject nbdkit-cache-filter(1) below (after) this filter and you get approximately the same effect. and nbdkit-cow-filter(1) can be used instead of nbdkit-cache-filter, if you add the cow-on-cache=true option. options on options, we love to see it πŸŽ€

the filter uses a simple adaptive algorithm that accelerates sequential reads and β€” this is the best part β€” requires no further configuration. it just knows. main character energy fr fr ✨

a similar filter is nbdkit-scan-filter(1), which reads ahead over the whole disk. that one's useful if you already know the client will be reading sequentially across most or all of the disk. different filter, different vibe, iykyk.

😭 Limitations 😭

ngl, in a number of significant cases this filter will do nothing. and the filter will print a warning message if that happens, so at least it tells you. it's giving "i tried πŸ’€".

  • Thread model must be parallel β€” use nbdkit PLUGIN --dump-plugin to find the thread model of the underlying plugin. if it doesn't support the parallel thread model, this filter cannot perform prefetches in parallel with the read requests. we may be able to lift this restriction in future (manifesting πŸ™).
  • Underlying filters or plugin must support .cache (prefetch) β€” very many plugins do not have the concept of prefetching and/or do not implement the .cache callback, and so there is no way for this filter to issue prefetches. you can usually get around this by adding --filter=cache after this filter as explained above. it may be necessary to limit the total size of the cache (see "CACHE MAXIMUM SIZE" in nbdkit-cache-filter(1)).
  • Clients and kernels may do readahead already β€” it may be the case that NBD clients are already issuing NBD_CMD_CACHE (NBD prefetch) commands. it may also be the case that your plugin is using local file functions where the kernel is doing readahead. in such cases this filter is not necessary and may be pessimal. like, actively worse. the audacity of the kernel, honestly 😀

🌸 PARAMETERS 🌸

there are no parameters specific to nbdkit-readahead-filter. any parameters are passed through to and processed by the underlying plugin in the normal way. so you don't have to learn anything new, periodt 🫢


πŸŽ€ FILES πŸŽ€

  • $filterdir/nbdkit-readahead-filter.so β€” the filter. that's it, that's the file.

use nbdkit --dump-config to find the location of $filterdir. so helpful, so iconic ✨


⭐ VERSION ⭐

nbdkit-readahead-filter first appeared in nbdkit 1.12. a classic, honestly.


🌈 SEE ALSO 🌈

the whole friend group, okay:

nbdkit(1), nbdkit-cache-filter(1), nbdkit-cow-filter(1), nbdkit-file-plugin(1), nbdkit-retry-filter(1), nbdkit-scan-filter(1), nbdkit-torrent-plugin(1), nbdkit-vddk-plugin(1), nbdkit-filter(3), qemu-img(1).


πŸ‘‘ AUTHORS πŸ‘‘

Richard W.M. Jones


Copyright Red Hat


🧚 LICENSE 🧚

redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of Red Hat nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
okay so that's the whole page and yes, all the legal stuff is still there, i didn't skip it, i would never do that to you πŸ’–

this was nbdkit-1.48.1 and it's dated 2026-08-29 β€” that's the version and the date, mwah πŸ’… stay hydrated, read ahead, and remember: sequential reads deserve a little pre-game too πŸ¦‹βœ¨πŸŽ€

πŸ“¦ where this page comes from