Was doing some createrepo ops with about 3k rpms and it created a
cachedir w/~10k LONG entries .. size of the dir was(is) 348k,
did a frag count on it and it had 155 fragments. Ouch.
Tried to make a copy w/links thinking that doing so might create all
the names "quickly enough" (?!) to benefit from some block-allocation
coalescing. Not at all ;-(.
Anyway to pre-alloc a dir or some means get a dir w/fewer frags...
Mostly curiosity -- though I'd fix it if there was an easy fix -- but
it's not a dir that's going to get much access, so it doesn't matter
alot.
Anway, thought I'd throw the Q out in case someone had any ideas...
Tnx,
Linda
----
P.s. -- these may be of no use to anyone, and have no guarantees or warrantees
other than they work for me -- but 2 script to satisfy my idle curiosity...
-----
#!/bin/bash
# frags -- prints out the fragments (la walsh util script;pubdomain)
if (($#<1)); then echo "need filename" >&2 ; exit 1; fi
if [ ! -e "$1" ]; then echo "Name \"$1\" doesn't exist.">&2; exit 2; fi
dev=$(df "$1"|tail -1|cut -d\ -f1)
mountline=$(mount|grep "$dev")
fstype=$( echo $mountline| (perl -ne '/ type (\S+) / && print "$1\n" '; echo
error)| head -1 )
if [[ "$fstype" == "ext2" || "$fstype" == "ext3" ]]; then fstype=ext; fi
if [[ "$fstype" == "ext" ]]; then
exec "filefrags.$fstype" "$@"
elif [[ "$fstype" == "xfs" ]]; then
xfs_bmap "$@"
else
echo "I don't know how to dump frags (or extents) for a file on fstype
\"$fstype\"."
echo "If you do, send me an email: frags (at) tlinx (dot) org. Thanks!"
exit 1
fi
#: vim:ts=4:sw
--------------------------------------------------
#!/bin/bash
# nfrags -- just gives me a number! (la walsh util script;pubdomain)
function nfrags {
{ grep -P '\s*\d:\s*\[\d+\.\.\d+\]\:\s\d+\.\.\d+' |
wc -l ; } < <(frags "${1:?need file or dir}")
}
if (($#==0)); then
echo 'Need file or dir name(s)'
else
for fn in "$@"; do
printf "%4d:%s\n" "$(nfrags "$fn")" "$fn"
done
fi
_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs