"
exit 1
}
TARGET_DIR=$1
EXT_ATTR_NAME="trusted.glusterfs-quota-du"
#output of du in number of bytes
get_disk_usage ()
{
if [ ! -d $TARGET_DIR ]; then
echo >&2 "Error: $TARGET_DIR does not exist."
exit 1
fi
DISK_USAGE=`du -bc $TARGET_DIR | grep 'total' | cut -f1`
if [ "${?}" -gt 0 ]; then
exit 1
fi
}
#set the extended attribute of the root directory with du size in bytes
set_disk_usage ()
{
` setfattr -n $EXT_ATTR_NAME -v $DISK_USAGE $TARGET_DIR`
if [ "${?}" -gt 0 ]; then
exit 1
fi
}
main ()
{
[ $# -lt 1 ] && usage
check_for_attr
get_disk_usage
set_disk_usage
printf "Disk Usage information has been sync'd successfully.\n"
}
main "$@"
='/cgit/glusterfs.git/?h=v3.2.2qa3'>summaryrefslogtreecommitdiffstats|
|