xfs
[Top] [All Lists]

[PATCH 1/9] xfs: don't try to use the filestream allocator for metadata

To: xfs@xxxxxxxxxxx
Subject: [PATCH 1/9] xfs: don't try to use the filestream allocator for metadata allocations
From: Christoph Hellwig <hch@xxxxxx>
Date: Sat, 12 Apr 2014 10:01:55 +0200
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1397289723-26243-1-git-send-email-hch@xxxxxx>
References: <1397289723-26243-1-git-send-email-hch@xxxxxx>
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@xxxxxx>
---
 fs/xfs/xfs_bmap.c |   42 ++++++++++++++++++++----------------------
 1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index f0efc7e..3340f0e 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -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;
-- 
1.7.10.4

<Prev in Thread] Current Thread [Next in Thread>