--- xfs_fsr.c 2007-06-28 13:23:58.745778214 +0100 +++ xfs_fsr.c.orig 2007-06-28 07:40:42.572069164 +0100 @@ -904,6 +904,20 @@ } } + /* Check if there is room to copy the file */ + if ( statvfs64( (fsname == NULL ? fname : fsname), &vfss) < 0) { + fsrprintf(_("unable to get fs stat on %s: %s\n"), + fname, strerror(errno)); + return (-1); + } + bsize = vfss.f_frsize ? vfss.f_frsize : vfss.f_bsize; + + if (statp->bs_size > ((vfss.f_bfree * bsize) - minimumfree)) { + fsrprintf(_("insufficient freespace for: %s: " + "size=%lld: ignoring\n"), fname, statp->bs_size); + return 1; + } + if ((ioctl(fd, XFS_IOC_FSGETXATTR, &fsx)) < 0) { fsrprintf(_("failed to get inode attrs: %s\n"), fname); return(-1); @@ -937,20 +951,6 @@ return -1; } - /* Check if there is room to copy the file */ - if ( statvfs64( (fsname == NULL ? fname : fsname), &vfss) < 0) { - fsrprintf(_("unable to get fs stat on %s: %s\n"), - fname, strerror(errno)); - return (-1); - } - bsize = vfss.f_frsize ? vfss.f_frsize : vfss.f_bsize; - - if (statp->bs_size > ((vfss.f_bfree * bsize) - minimumfree)) { - fsrprintf(_("insufficient freespace for: %s: " - "size=%lld: ignoring\n"), fname, statp->bs_size); - return 1; - } - /* * Previously the code forked here, & the child changed it's uid to * that of the file's owner and then called packfile(), to keep