FS-Cache and FUSE for Media Playback QoS
Listing 8. Running simpleread against the FUSE Shim
# rm -rf /var/fscache/* # /etc/init.d/cachefilesd restart # mount fileserver:/HomeMovies /HomeMovies -o fsc # nfs-fuse-readahead-shim --fuse-forground \ -u /HomeMovies /Cached-HomeMovies \ >|/tmp/nfs-fuse-out 2>&1 \ & # simpleread /Cached-HomeMovies/venice-2001.dv 1000 using delay of usec:1000 offset:262144 offset:524288 ^C # fg ^C #
The simpleread was stopped after reading only a little more than half a megabyte. However, the FUSE module has an asynchronous IO call at the start, requesting 8MB of data be sent to it. Poking around in /var/fscache for a file with the same size as venice-2001.dv should reveal the cache file. Comparing the first 8MB of this cache file to the version on the NFS share should show that the first 8MB is identical. Note that the local cached file is read first to make sure that the subsequent use of the NFS share does not populate the cache file before it is read. This is shown in Listing 9.
Listing 9. Checking That the Cache Has Read the First 8MB
# cd /var/fscache # ll -R ... ---------- 1 root root 800M Jun 10 02:19 Ek0...000000 # dd if=./path/to/Ek0...000000 \ of=/tmp/8mb bs=1024 count=8192 # dd if=/HomeMovies/venice-2001.dv \ of=/tmp/8mb.real bs=1024 count=8192 # diff /tmp/8mb.real /tmp/8mb #
One restriction on FS-Cache is that it will not cache files opened with O_DIRECT or for writing.
By taking advantage of the kernel FS-Cache code, the FUSE module to handle read-ahead can be very simple to create. The Delegatefs C++ FUSE base class allows one to implement additional features very easily when applications perform IO.
The FUSE nfs-fuse-readahead-shim module is started just as shown in Listing 8 and when the --fuse-forground option is not passed, nfs-fuse-readahead-shim runs silently as a dæmon.
Filesystem in USErspace (FUSE): fuse.sourceforge.net
fuselagefs and Delegatefs: sourceforge.net/project/showfiles.php?group_id=16036&package_id=225200
NFS and fscache Kernel Patches: people.redhat.com/~dhowells/cachefs/patches
Ben Martin has been working on filesystems for more than ten years. He is currently working toward a PhD combining Semantic Filesystems with Formal Concept Analysis to improve human-filesystem interaction.
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
- Devuan Beta Release
- May 2016 Issue of Linux Journal
- EnterpriseDB's EDB Postgres Advanced Server and EDB Postgres Enterprise Manager
- The US Government and Open-Source Software
- The Humble Hacker?
- BitTorrent Inc.'s Sync
- Open-Source Project Secretly Funded by CIA
- The Death of RoboVM
- New Container Image Standard Promises More Portable Apps
- Tech Tip: Really Simple HTTP Server with Python
In modern computer systems, privacy and security are mandatory. However, connections from the outside over public networks automatically imply risks. One easily available solution to avoid eavesdroppers’ attempts is SSH. But, its wide adoption during the past 21 years has made it a target for attackers, so hardening your system properly is a must.
Additionally, in highly regulated markets, you must comply with specific operational requirements, proving that you conform to standards and even that you have included new mandatory authentication methods, such as two-factor authentication. In this ebook, I discuss SSH and how to configure and manage it to guarantee that your network is safe, your data is secure and that you comply with relevant regulations.Get the Guide