Merge tag 'wireless-drivers-for-davem-2018-04-26' of git://git.kernel.org/pub/scm...
[linux-2.6-block.git] / fs / xfs / xfs_discard.c
index b2cde54261822a514e5bbabb6d10ab3d4a1f9806..7b68e6c9a474ba367cbebe3ebe550f8e3c22450b 100644 (file)
@@ -50,19 +50,19 @@ xfs_trim_extents(
 
        pag = xfs_perag_get(mp, agno);
 
-       error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp);
-       if (error || !agbp)
-               goto out_put_perag;
-
-       cur = xfs_allocbt_init_cursor(mp, NULL, agbp, agno, XFS_BTNUM_CNT);
-
        /*
         * Force out the log.  This means any transactions that might have freed
-        * space before we took the AGF buffer lock are now on disk, and the
+        * space before we take the AGF buffer lock are now on disk, and the
         * volatile disk cache is flushed.
         */
        xfs_log_force(mp, XFS_LOG_SYNC);
 
+       error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp);
+       if (error || !agbp)
+               goto out_put_perag;
+
+       cur = xfs_allocbt_init_cursor(mp, NULL, agbp, agno, XFS_BTNUM_CNT);
+
        /*
         * Look up the longest btree in the AGF and start with it.
         */