These passages are conversations between Job and his friends. In Chapter 21 Job responds to his friend Zophar. Previously Zophar thought that the happiness of wicked people would not last. Job disagrees with Zophar as he knew that many wicked people were successful live full lives.
Even though Job had been successful early on he was glad to serve God. God mattered more than his wealth.
In Chapter 22 Job's friend Eliphaz describes the evil deeds he believes Job has committed and believes that is why he is suffering.