Recently it was discovered that twisted superconformal index mathcal{I} can be used to understand the Bekenstein-Hawking entropy of magnetically charged black holes in AdS spacetime. In this paper we apply the so-called mathcal{I} -extremization procedure to three-dimensional gauge field theories and their geometric dual, focusing in particular on the seven-dimensional Sasaki-Einstein manifold M1,1,1. We generalize recent studies on relations among toric geometry, variational principles, and black hole entropy to the case of AdS2× Y9, where Y9 is a fibration of toric Sasaki-Einstein manifold M1,1,1 over a two-dimensional Riemann surface Σg. The nine-dimensional variational problem is given in terms of an entropy functional. In order to illustrate the computations as explicitly as possible, we consider cases where either only mesonic or baryonic fluxes are turned on. By employing the operator counting method, we calculate the S3 free energy and the topologically twisted index mathcal{I} at large-N. The result for mathcal{I} , it turns out, can be also obtained from the variational principle of the entropy functional with mesonic fluxes. We also study asymptotically AdS4 black holes which are magnetically charged with respect to the vector field in the Betti multiplet. By extremizing the entropy functional with baryonic flux, we compute the entropy and find that it agrees with the entropy of an explicit solution in a four-dimensional gauged supergravity which is a consistent truncation of eleven-dimensional supergravity in AdS4× M1,1,1.