btrfs: move error handling code together in ctree.h