glusterfs/extras/file_size_contri.sh
Raghavendra G 2f07f751bf extras: Add quota-related debugging scripts.
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>

BUG: 2697 (Quota: add-brick creates the size go awkward, though it was perfect earlier)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2697
2011-06-19 20:41:21 -07:00

18 lines
537 B
Bash
Executable File

#!/bin/bash
# This script checks whether the contribution and disk-usage of a file is same.
CONTRIBUTION_HEX=`getfattr -h -e hex -d -m trusted.glusterfs.quota.*.contri $1 2>&1 | sed -e '/^#/d' | sed -e '/^getfattr/d' | sed -e '/^$/d' | cut -d'=' -f 2`
BLOCKS=`stat -c %b $1`
SIZE=$(($BLOCKS * 512))
CONTRIBUTION=`printf "%d" $CONTRIBUTION_HEX`
if [ $CONTRIBUTION -ne $SIZE ]; then
printf "contribution of %s:%d\n" $1 $CONTRIBUTION
echo "size of $1: $SIZE"
echo "==================================================="
fi