From: Christoph Hellwig <hch@infradead.org>
To: xfs@oss.sgi.com, moosh009@gmail.com
Subject: [PATCH] xfs_io: fix extent array reallocation
Date: Fri, 20 Mar 2009 03:26:18 -0400 [thread overview]
Message-ID: <20090320072618.GA26571@infradead.org> (raw)
From: Tomasz Majkowski <moosh009@gmail.com>
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,
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next reply other threads:[~2009-03-20 7:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-20 7:26 Christoph Hellwig [this message]
2009-03-20 14:33 ` [PATCH] xfs_io: fix extent array reallocation Felix Blyakher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090320072618.GA26571@infradead.org \
--to=hch@infradead.org \
--cc=moosh009@gmail.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox