summaryrefslogtreecommitdiffstats
path: root/extras/file_size_contri.sh
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2011-05-11 02:42:21 +0000
committerAnand Avati <avati@gluster.com>2011-06-19 20:41:21 -0700
commit2f07f751bf69a196df85d3e715c0ad1a7a26419c (patch)
tree12f8c641a147fe5f093a8bbdc5d7cf5457d90591 /extras/file_size_contri.sh
parente2685adcb71b30621e34905584910390e0b248e1 (diff)
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
Diffstat (limited to 'extras/file_size_contri.sh')
-rwxr-xr-xextras/file_size_contri.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/extras/file_size_contri.sh b/extras/file_size_contri.sh
new file mode 100755
index 00000000000..4f52a9a89b4
--- /dev/null
+++ b/extras/file_size_contri.sh
@@ -0,0 +1,17 @@
+#!/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
+