xfs: make last AG grow/shrink perag centric
[linux-2.6-microblaze.git] / fs / xfs / xfs_ioctl.c
index 0d67ff8..f21581c 100644 (file)
@@ -955,6 +955,7 @@ xfs_ioc_ag_geometry(
        struct xfs_mount        *mp,
        void                    __user *arg)
 {
+       struct xfs_perag        *pag;
        struct xfs_ag_geometry  ageo;
        int                     error;
 
@@ -965,7 +966,12 @@ xfs_ioc_ag_geometry(
        if (memchr_inv(&ageo.ag_reserved, 0, sizeof(ageo.ag_reserved)))
                return -EINVAL;
 
-       error = xfs_ag_get_geometry(mp, ageo.ag_number, &ageo);
+       pag = xfs_perag_get(mp, ageo.ag_number);
+       if (!pag)
+               return -EINVAL;
+
+       error = xfs_ag_get_geometry(pag, &ageo);
+       xfs_perag_put(pag);
        if (error)
                return error;