| To: | xfs@xxxxxxxxxxx, moosh009@xxxxxxxxx |
|---|---|
| Subject: | [PATCH] xfs_io: fix extent array reallocation |
| From: | Christoph Hellwig <hch@xxxxxxxxxxxxx> |
| Date: | Fri, 20 Mar 2009 03:26:18 -0400 |
| User-agent: | Mutt/1.5.18 (2008-05-17) |
From: Tomasz Majkowski <moosh009@xxxxxxxxx>
The XFS_IOC_FSGETXATTRA ioctl only returns the number of allocated
extents, so when we reallocate the extent array in the bmap command
we have to account for the worst case where there is a whole between
each two allocated extents. Also add some slack to that case to
allow for a file growing while we are racing with it.
Index: xfsprogs-dev/io/bmap.c
===================================================================
--- xfsprogs-dev.orig/io/bmap.c 2009-03-20 06:28:33.000000000 +0000
+++ xfsprogs-dev/io/bmap.c 2009-03-20 06:29:52.000000000 +0000
@@ -217,8 +217,8 @@
exitcode = 1;
return 0;
}
- if (fsx.fsx_nextents >= map_size-1) {
- map_size = 2*(fsx.fsx_nextents+1);
+ if (2 * fsx.fsx_nextents > map_size) {
+ map_size = 2 * fsx.fsx_nextents + 1;
map = realloc(map, map_size*sizeof(*map));
if (map == NULL) {
fprintf(stderr,
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [PATCH 1/5] [XFS] Use xfs_sync_inodes() for device flushing, Dave Chinner |
|---|---|
| Next by Date: | [PATCH] xfstests: add test 203, xfs_io bmap reallocation, Christoph Hellwig |
| Previous by Thread: | Important: Email Account Verification Update ! ! !, Web Help Desk. |
| Next by Thread: | Re: [PATCH] xfs_io: fix extent array reallocation, Felix Blyakher |
| Indexes: | [Date] [Thread] [Top] [All Lists] |