summaryrefslogtreecommitdiffstats
path: root/extras/file_size_contri.sh
diff options
context:
space:
mode:
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 000000000..4f52a9a89
--- /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
+