From: Ilya Dryomov Date: Thu, 5 Jun 2014 06:08:42 +0000 (+0400) Subject: XfsFileStoreBackend: call ioctl(XFS_IOC_FSSETXATTR) less often X-Git-Tag: v0.80.2~19 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d1afeb38b522baae1b15a7a3548002c830bb7567;p=ceph.git XfsFileStoreBackend: call ioctl(XFS_IOC_FSSETXATTR) less often No need to call ioctl(XFS_IOC_FSSETXATTR) if extsize is already set to the value we want or if any extents are allocated - XFS will refuse to change extsize in that's the case. Fixes: #8241 Signed-off-by: Ilya Dryomov (cherry picked from commit bc3b30ed09b8f3eb86b61e3a05ccacfd928faa95) --- diff --git a/src/os/XfsFileStoreBackend.cc b/src/os/XfsFileStoreBackend.cc index 7b632d8a622e..ba51e6b36a73 100644 --- a/src/os/XfsFileStoreBackend.cc +++ b/src/os/XfsFileStoreBackend.cc @@ -61,6 +61,14 @@ int XfsFileStoreBackend::set_extsize(int fd, unsigned int val) goto out; } + // already set? + if ((fsx.fsx_xflags & XFS_XFLAG_EXTSIZE) && fsx.fsx_extsize == val) + return 0; + + // xfs won't change extent size if any extents are allocated + if (fsx.fsx_nextents != 0) + return 0; + fsx.fsx_xflags |= XFS_XFLAG_EXTSIZE; fsx.fsx_extsize = val;