Feeling like a failure

i really dont want to but i have to stop breastfeeding. It makes my little one so upset and gassy that he cant sleep and constantly wants to be held etc. Hes been so bad these past few days that it takes like ten minutes to actually get him latched and eating, and even after that he shows like no interest in it even though i know hes hungry, and i get frustrated and he notices that and gets more frustrated, its a vicious circle. Its my last resort to stop bf and go to formula. And lately ive been growing more and more irritated with bf because i have to plan everything around it, my shirts, what bra i wear, when i go to leave the house, and if i have enough milk if i leave the house without him. Ive made it just over 7 weeks. Props to the women who can make it work, because ive tried everything and i just cant. So on that note what can i do to prevent mastitis and to dry up?