xfs
[Top] [All Lists]

Re: [PATCH] xfs_io: fix extent array reallocation

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH] xfs_io: fix extent array reallocation
From: Felix Blyakher <felixb@xxxxxxx>
Date: Fri, 20 Mar 2009 09:33:29 -0500
Cc: xfs@xxxxxxxxxxx, moosh009@xxxxxxxxx
In-reply-to: <20090320072618.GA26571@xxxxxxxxxxxxx>
References: <20090320072618.GA26571@xxxxxxxxxxxxx>

On Mar 20, 2009, at 2:26 AM, Christoph Hellwig wrote:

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.

Reviewed-by: Felix Blyakher <felixb@xxxxxxx>




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,

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs

<Prev in Thread] Current Thread [Next in Thread>