[Top] [All Lists]

is thee anyway to pre-alloc space for a dir that is going to get a bunch

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: is thee anyway to pre-alloc space for a dir that is going to get a bunch of long filenames? (+ frag scripts)
From: Linda Walsh <xfs@xxxxxxxxx>
Date: Tue, 15 Jan 2013 22:03:50 -0800
Delivered-to: xfs@xxxxxxxxxxx
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv: Gecko/20100228 Lightning/0.9 Thunderbird/ Mnenhy/
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

Anway, thought I'd throw the Q out in case someone had any ideas...

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...
# 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 "$@"
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
#: vim:ts=4:sw
# 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)'
        for fn in "$@"; do
                printf "%4d:%s\n" "$(nfrags "$fn")" "$fn"

<Prev in Thread] Current Thread [Next in Thread>