]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
xfs: only set extent size hint when asked
authorDave Chinner <dchinner@redhat.com>
Wed, 1 Oct 2014 23:20:30 +0000 (09:20 +1000)
committerDave Chinner <david@fromorbit.com>
Wed, 1 Oct 2014 23:20:30 +0000 (09:20 +1000)
Currently the extent size hint is set unconditionally in
xfs_ioctl_setattr() when the FSX_EXTSIZE flag is set. Hence we can
set hints when the inode flags indicating the hint should be used
are not set.  Hence only set the extent size hint from userspace
when the inode has the XFS_DIFLAG_EXTSIZE flag set to indicate that
we should have an extent size hint set on the inode.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_ioctl.c

index 05a19554efbcbf92facc8e4f08a2991f879c7783..d6afc9f144b197e2903a6237f2a8cc4d39fdcdba 100644 (file)
@@ -1231,13 +1231,25 @@ xfs_ioctl_setattr(
 
        }
 
-       if (mask & FSX_EXTSIZE)
-               ip->i_d.di_extsize = fa->fsx_extsize >> mp->m_sb.sb_blocklog;
        if (mask & FSX_XFLAGS) {
                xfs_set_diflags(ip, fa->fsx_xflags);
                xfs_diflags_to_linux(ip);
        }
 
+       /*
+        * Only set the extent size hint if we've already determined that the
+        * extent size hint should be set on the inode. If no extent size flags
+        * are set on the inode then unconditionally clear the extent size hint.
+        */
+       if (mask & FSX_EXTSIZE) {
+               int     extsize = 0;
+
+               if (ip->i_d.di_flags &
+                               (XFS_DIFLAG_EXTSIZE | XFS_DIFLAG_EXTSZINHERIT))
+                       extsize = fa->fsx_extsize >> mp->m_sb.sb_blocklog;
+               ip->i_d.di_extsize = extsize;
+       }
+
        xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG);
        xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);