xfs: don't try to use the filestream allocator for metadata allocations
authorChristoph Hellwig <hch@lst.de>
Mon, 14 Apr 2014 09:37:42 +0000 (19:37 +1000)
committerDave Chinner <david@fromorbit.com>
Mon, 14 Apr 2014 09:37:42 +0000 (19:37 +1000)
xfs_bmap_btalloc_nullfb has two entirely different control flows when
using the filestream allocator vs the regular one, but it get the
conditionals wrong and ends up mixing the two for metadata allocations.
Fix this by adding a missing userdata check and slight refactoring.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_bmap.c

index 5b6092ef51efa9eb6e02c980980c6aa99e486170..38e88a01b4470b074549e743f16a61978e52758b 100644 (file)
@@ -3566,33 +3566,31 @@ xfs_bmap_btalloc_nullfb(
                } else
                        notinit = 1;
 
-               if (xfs_inode_is_filestream(ap->ip)) {
+               if (xfs_inode_is_filestream(ap->ip) && ap->userdata) {
                        if (*blen >= args->maxlen)
                                break;
 
-                       if (ap->userdata) {
-                               /*
-                                * If startag is an invalid AG, we've
-                                * come here once before and
-                                * xfs_filestream_new_ag picked the
-                                * best currently available.
-                                *
-                                * Don't continue looping, since we
-                                * could loop forever.
-                                */
-                               if (startag == NULLAGNUMBER)
-                                       break;
+                       /*
+                        * If startag is an invalid AG, we've
+                        * come here once before and
+                        * xfs_filestream_new_ag picked the
+                        * best currently available.
+                        *
+                        * Don't continue looping, since we
+                        * could loop forever.
+                        */
+                       if (startag == NULLAGNUMBER)
+                               break;
 
-                               error = xfs_filestream_new_ag(ap, &ag);
-                               xfs_perag_put(pag);
-                               if (error)
-                                       return error;
+                       error = xfs_filestream_new_ag(ap, &ag);
+                       xfs_perag_put(pag);
+                       if (error)
+                               return error;
 
-                               /* loop again to set 'blen'*/
-                               startag = NULLAGNUMBER;
-                               pag = xfs_perag_get(mp, ag);
-                               continue;
-                       }
+                       /* loop again to set 'blen'*/
+                       startag = NULLAGNUMBER;
+                       pag = xfs_perag_get(mp, ag);
+                       continue;
                }
                if (++ag == mp->m_sb.sb_agcount)
                        ag = 0;
This page took 0.03225 seconds and 5 git commands to generate.