trigger scripts for trigger scripts for extensible file
play

Trigger Scripts For Trigger Scripts For Extensible File Extensible - PDF document

Trigger Scripts For Trigger Scripts For Extensible File Extensible File Systems Systems Cameron Macdonell Macdonell Cameron Overview Overview The The Scruf Scruf Framework Framework Examples of Extended File Systems


  1. Trigger Scripts For Trigger Scripts For Extensible File Extensible File Systems Systems Cameron Macdonell Macdonell Cameron Overview Overview � The The Scruf Scruf Framework Framework � � Examples of Extended File Systems Examples of Extended File Systems � � Experiments Experiments � � Concluding Remarks Concluding Remarks � Cameron Macdonell

  2. Scruf - - SCR SCRiptable iptable U User-level ser-level F File system ile system Scruf � Scruf Scruf executes a user script as a user-level executes a user script as a user-level � process whenever a file operation occurs in the process whenever a file operation occurs in the directory (CWD) containing the script directory (CWD) containing the script � Scruf Scruf passes the name of the file being accessed as passes the name of the file being accessed as � a parameter ( $1 a parameter ( $1 ) to the script ) to the script � Locates a script based on its name - Locates a script based on its name - .on.open for .on.open for � example example � Allows extension without changing the Allows extension without changing the � applications applications Cameron Macdonell The Scruf Scruf Framework: A Diagram Framework: A Diagram The .on.open .on.read .on.write … User-level Trigger files Unmodifed Application User-Level open() read() write() … Daemon /proc/scruf VFS Scruf-VFS /usr/ntfs /usr/scovil2 Kernel Cameron Macdonell

  3. Example Extended File Example Extended File Systems Systems � We have built five sample extended file systems: We have built five sample extended file systems: � � Scruf Scruf-CVS -CVS � � Backs up files with open-close semantics Backs up files with open-close semantics � � Scruf Scruf-Trace -Trace � � Logs all file operations Logs all file operations � � Scruf Scruf-Crypt -Crypt � � Transparent access to encrypted files Transparent access to encrypted files � � Scruf Scruf-Compress -Compress � � Transparent access to compressed files Transparent access to compressed files � � Scruf Scruf-Trellis -Trellis � � Remote Data Access Remote Data Access � � Average 40 lines of code Average 40 lines of code � Cameron Macdonell Andrew100 Andrew100 400 400 6.2% 350 350 300 300 250 250 ext2 ext2 Time (s) Time (s) 200 200 Scruf-Trace Scruf-Trace 150 150 100 100 0% 13% 50 50 21.7% 0% 0 1 2 3 4 5 Phase Numbers Phase Numbers Cameron Macdonell

  4. Build of the Linux Kernel Build of the Linux Kernel 3.2% 450 450 400 400 350 350 300 300 ext2 ext2 250 250 Time (s) Time (s) 200 200 Scruf-Trace Scruf-Trace 150 150 21.5% 100 100 50 50 0 make dep make dep make make bzImage bzImage Build Build Stage Stage Cameron Macdonell Running Scruf Scruf with No with No Running Scripts Scripts � Measures the overhead of the framework Measures the overhead of the framework � � Applications should not be hindered if no extensions Applications should not be hindered if no extensions � are used are used � Framework is in place,the daemon is running, Framework is in place,the daemon is running, � there are no there are no scripts in the hierarchy scripts in the hierarchy � What operations are involved? What operations are involved? � � IPC to user-level IPC to user-level � � Search for, and attempted inheritance of, Scripts Search for, and attempted inheritance of, Scripts � � Filters are setup in kernel Filters are setup in kernel � � The highest overhead noted is The highest overhead noted is 0.91% 0.91% � � Overheads are a function of the scripts Overheads are a function of the scripts � Cameron Macdonell

  5. Concluding Remarks Concluding Remarks � Scruf Scruf is simple, effective and flexible is simple, effective and flexible � � Useful extensions can be implemented Useful extensions can be implemented � quickly quickly � Trigger scripts average 40 lines of code Trigger scripts average 40 lines of code � � Applications do not need to be modified Applications do not need to be modified � � Performance Performance � � Negligible overhead from the framework Negligible overhead from the framework � � Asynchronous and Persistent Scripts can Asynchronous and Persistent Scripts can � improve performance when they can be used improve performance when they can be used Cameron Macdonell Cameron Macdonell

  6. Making Life Easier Making Life Easier � Inheritance Inheritance � � Simplifies installation and removal of scripts Simplifies installation and removal of scripts � � With inheritance, trigger scripts are inherited With inheritance, trigger scripts are inherited � into lower directories into lower directories /usr alberta bin .on.read .on.write Inherits cam paullu .on.open thesis Cameron Macdonell Making Life Easier Making Life Easier � Filtering Filtering � � Keeps track of which directory contain which Keeps track of which directory contain which � scripts scripts � Eliminates unnecessary IPC Eliminates unnecessary IPC � User-Level / CWD .on.read .on.open Filtered, no IPC read write open Kernel / Scruf-VFS Cameron Macdonell

  7. Making Life Easier Making Life Easier � Inheritance Inheritance � � Simplifies installation and removal of scripts Simplifies installation and removal of scripts � � With inheritance, trigger scripts are inherited With inheritance, trigger scripts are inherited � into lower directories into lower directories /usr .on.read .on.write /usr/home .on.open inherits /usr/home/cam Cameron Macdonell Sync v. Async Async Scripts Scripts Sync v. Time Daemon Script fork() exec() Synchronous Script SCRUF_API_ARGS … waits computes SCRUF_API_NOOP return to kernel Script Time Daemon fork() exec() Asynchronous Script SCRUF_API_ARGS … return to kernel computes Cameron Macdonell

  8. Scruf-Trellis -Trellis Scruf 200 200 0.26% 180 180 � With development With development � 160 160 Scruf-Trellis should -Trellis should Scruf 140 140 120 120 beat its equivalent beat its equivalent Trellis Trellis 0.08% 100 100 scp; bzip2 scp; bzip2 � Overlapped copying Overlapped copying � 80 80 60 60 and compression and compression 40 40 20 20 0 50 MB 50 MB 100 100 MB MB Size of Size of File File Cameron Macdonell Making Life Easier Making Life Easier � Symbolic Links Symbolic Links � [cam@sunset ~/test]$ ls -al [cam@sunset ~/test]$ ls -al total 16 total 16 drwx drwx--S--- 2 cam grad 4096 Aug 15 14:48 . --S--- 2 cam grad 4096 Aug 15 14:48 . drwxr-sr-x 69 cam grad 4096 Aug 15 14:48 .. drwxr -sr-x 69 cam grad 4096 Aug 15 14:48 .. lrwxrwxrwx 1 cam grad 8 Aug 15 14:47 .on. 1 cam grad 8 Aug 15 14:47 .on.lseek lseek -> .on.open -> .on.open lrwxrwxrwx - -rwx rwx------ 1 cam grad 43 Aug 15 14:46 .on.open ------ 1 cam grad 43 Aug 15 14:46 .on.open lrwxrwxrwx 1 cam grad 8 Aug 15 14:47 .on.read -> .on.open 1 cam grad 8 Aug 15 14:47 .on.read -> .on.open lrwxrwxrwx lrwxrwxrwx lrwxrwxrwx 1 cam grad 8 Aug 15 14:47 .on.release -> .on.open 1 cam grad 8 Aug 15 14:47 .on.release -> .on.open lrwxrwxrwx lrwxrwxrwx 1 cam grad 8 Aug 15 14:47 .on.write -> .on.open 1 cam grad 8 Aug 15 14:47 .on.write -> .on.open - -rw rw------- 1 cam grad 951 Aug 15 14:48 ------- 1 cam grad 951 Aug 15 14:48 anyfile anyfile [cam@sunset ~/test]$ cat .on.open [cam@sunset ~/test]$ cat .on.open #!/bin/sh sh #!/bin/ echo $2 >> /usr usr/scovil3/ /scovil3/logfile logfile echo $2 >> / [cam@sunset ~/test]$ [cam@sunset ~/test]$ Cameron Macdonell

  9. The Scruf Scruf Framework: At User-Level Framework: At User-Level The Run when their corresponding file Run when their corresponding file � � operation occurs operation occurs Can perform two actions Can perform two actions � � 1) 1) Interposed Interposed Action Action File operation continues as normal File operation continues as normal � � 2) Redirection Redirection Action Action 2) Redirect Scruf Scruf-VFS to a different file -VFS to a different file Redirect � � Currently, can only come from .on.open Currently, can only come from .on.open � � Cameron Macdonell Back to Our Example Back to Our Example � For our purpose instead of storing editor For our purpose instead of storing editor � preferences, we want to store an executable preferences, we want to store an executable command command � cvs commit cvs commit filename filename � � Important: Important: we don we don’ ’t want to have to re-write t want to have to re-write � every application to run the script every application to run the script � Solution: Solution: Have the file system look for and Have the file system look for and � execute the scripts when certain file operations execute the scripts when certain file operations (i.e., open) occur (i.e., open) occur Cameron Macdonell

Recommend


More recommend