xfs
[Top] [All Lists]

[PATCH 2/3] xfs: fix xfs_get_extsz_hint for a zero extent size hint

To: xfs@xxxxxxxxxxx
Subject: [PATCH 2/3] xfs: fix xfs_get_extsz_hint for a zero extent size hint
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Tue, 25 Jan 2011 04:06:20 -0500
References: <20110125090618.432370964@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: quilt/0.48-1
We can easily set the extsize flag without setting an extent size
hint, or one that evaluates to zero.  Historically the di_extsize
field was only used when it was non-zero, but the commit

        "Cleanup inode extent size hint extraction"

broke this.  Restore the old behaviour, thus fixing xfsqa 090 with
a debug kernel.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Index: xfs/fs/xfs/xfs_rw.c
===================================================================
--- xfs.orig/fs/xfs/xfs_rw.c    2011-01-24 14:42:50.432004339 +0100
+++ xfs/fs/xfs/xfs_rw.c 2011-01-24 15:03:17.211016282 +0100
@@ -173,17 +173,9 @@ xfs_extlen_t
 xfs_get_extsz_hint(
        struct xfs_inode        *ip)
 {
-       xfs_extlen_t            extsz;
-
-       if (unlikely(XFS_IS_REALTIME_INODE(ip))) {
-               extsz = (ip->i_d.di_flags & XFS_DIFLAG_EXTSIZE)
-                               ? ip->i_d.di_extsize
-                               : ip->i_mount->m_sb.sb_rextsize;
-               ASSERT(extsz);
-       } else {
-               extsz = (ip->i_d.di_flags & XFS_DIFLAG_EXTSIZE)
-                               ? ip->i_d.di_extsize : 0;
-       }
-
-       return extsz;
+       if ((ip->i_d.di_flags & XFS_DIFLAG_EXTSIZE) && ip->i_d.di_extsize)
+               return ip->i_d.di_extsize;
+       if (XFS_IS_REALTIME_INODE(ip))
+               return ip->i_mount->m_sb.sb_rextsize;
+       return 0;
 }

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