Skip to contentSkip to conversation

fix xfs_fsr insufficient space check

PATCH In review Chris Wedgwood 2 participants 2 messages Jan 2, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix xfs_fsr insufficient space check

The xfs_fsr insufficient check should consider the blocks used not the file length. Without this change it is not possible to reorganize sparse files when file size exceeds the free space.

xfs_fsr.c renamed from xfs_fsr.c.orig +2 -2
@@ -912,9 +912,9 @@
 	}
 	bsize = vfss.f_frsize ? vfss.f_frsize : vfss.f_bsize;
 
-	if (statp->bs_size > ((vfss.f_bfree * bsize) - minimumfree)) {
+	if ((statp->bs_blksize * statp->bs_blocks) > ((vfss.f_bfree * bsize) - minimumfree)) {
 		fsrprintf(_("insufficient freespace for: %s: "
-			"size=%lld: ignoring\n"), fname, statp->bs_size);
+			"size=%lld: ignoring\n"), fname, statp->bs_blksize * statp->bs_blocks);
 		return 1;
 	}
 

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw
Quoted 10 lines · Chris Wedgwood

The xfs_fsr insufficient check should consider the blocks used not the file length. Without this change it is not possible to reorganize sparse files when file size exceeds the free space.

xfs_fsr.c line 915

Quoted 5 lines
xfs_fsr.c renamed from xfs_fsr.c.orig +1 -1
@@ -912,9 +912,9 @@
 	}
 	bsize = vfss.f_frsize ? vfss.f_frsize : vfss.f_bsize;
 
-	if (statp->bs_size > ((vfss.f_bfree * bsize) - minimumfree)) {
+	if ((statp->bs_blksize * statp->bs_blocks) > ((vfss.f_bfree * bsize) - minimumfree)) {

I'll put this after fixing the line length and removing all the superflous braces. Also we probably want a comment that bs_blksize in xfs_bstat_t actually is the blocksize, unlike st_blksize in struct stat.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs