Add proper per-file copyright notices/licenses and top-level license.
[bluesky.git] / TBBT / trace_play / fragment_collect
1 # Usage: fragment_collect dev mount_dir test_path output_file
2 #
3 # On linux system, this script collects the fragmentation status of a 
4 # particular directory. The objects under this directory SHOULD NOT be 
5 # used as mount point. If they do, please umount them first, but there
6 # is no danger even if you forget. The "output_file" is the one that I
7 # need, please gzip it and send it back to nzhu@cs.sunysb.edu
8 #
9 # The program needs to be run as ROOT, but it is SAFE and KEEPS PRIVACY.
10 # The pathname information on your system is completely filtered out 
11 # from the final output. This program ONLY READ and DOES NOT WRITE any
12 # files EXCEPT "output_file*" 
13 #
14 # Parameters:
15 #                dev                    :the device of the directory to be measured
16 #                mount_dir              :the the mount point of the device
17 #                test_path              :the relative path of the directory under mount_dir
18 #                output_file    :where the result is stored.
19 #
20 # Example: fragment_collect /dev/hda7 /home ningning /tmp/home-ningning.frag
21 #
22 #       This gives the fragmentation information (saved in "/tmp/home-ningning.frag")
23 #   of the file system objects under the directory of "/home/ningning" on the 
24 #   disk partition of "/dev/hda7" mounted to "/home".
25 #
26 #nfs stop
27 #umount $2
28 #mount $2
29 #nfs start
30 cd $2
31 echo "find $3 -print >$4.1"
32 find $3 -print > $4.1
33 echo "sed -d s/^/show_inode_info / $4.1"
34 sed -e "s/^/show_inode_info /" $4.1 >$4.2
35 echo "open $1" >$4.3
36 cat $4.2 >> $4.3
37 echo "debugfs -f $4.3"
38 debugfs -f $4.3 > $4.4
39 grep -v debugfs $4.4 > $4
40 #rm $4.1
41 #rm $4.2 
42 #rm $4.3
43 #rm $4.4