* [PATCH 2/2] xfstests 225: add additional fiemap-tester run without sync
@ 2011-02-24 22:04 Eric Sandeen
2011-02-24 22:17 ` [PATCH 2/2 V2] " Eric Sandeen
0 siblings, 1 reply; 4+ messages in thread
From: Eric Sandeen @ 2011-02-24 22:04 UTC (permalink / raw)
To: xfs mailing list, Josef Bacik
Chris Mason pointed out that some filesystems were not doing
the right thing on fiemap, in the face of delalloc extents.
Because test 225 ran with FIEMAP_FLAG_SYNC only, this didn't
get caught. Add a runtime option, and run it both ways.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/225 b/225
index 6e879a4..6b203e6 100755
--- a/225
+++ b/225
@@ -60,7 +60,10 @@ _cleanup()
}
trap "_cleanup; exit \$status" 0 1 2 3 15
-echo "fiemap run without preallocation"
+echo "fiemap run without preallocation, with sync"
+$here/src/fiemap-tester -q -p 0 -r 200 $fiemapfile 2>&1 | tee $fiemaplog
+
+echo "fiemap run without preallocation or sync"
$here/src/fiemap-tester -q -p 0 -r 200 $fiemapfile 2>&1 | tee $fiemaplog
if grep -q "Operation not supported" $fiemaplog; then
diff --git a/225.out b/225.out
index 7bc9312..b4f6477 100644
--- a/225.out
+++ b/225.out
@@ -1,2 +1,3 @@
QA output created by 225
-fiemap run without preallocation
+fiemap run without preallocation, with sync
+fiemap run without preallocation or sync
diff --git a/src/fiemap-tester.c b/src/fiemap-tester.c
index 53d7a64..6320580 100644
--- a/src/fiemap-tester.c
+++ b/src/fiemap-tester.c
@@ -418,7 +418,7 @@ static int query_fiemap_count(int fd, int blocks, int blocksize)
}
static int
-compare_fiemap_and_map(int fd, char *map, int blocks, int blocksize)
+compare_fiemap_and_map(int fd, char *map, int blocks, int blocksize, int syncfile)
{
struct fiemap *fiemap;
char *fiebuf;
@@ -446,7 +446,7 @@ compare_fiemap_and_map(int fd, char *map, int blocks, int blocksize)
last_data = i;
}
- fiemap->fm_flags = FIEMAP_FLAG_SYNC;
+ fiemap->fm_flags = syncfile ? FIEMAP_FLAG_SYNC : 0;
fiemap->fm_extent_count = blocks_to_map;
fiemap->fm_mapped_extents = 0;
@@ -519,9 +519,10 @@ main(int argc, char **argv)
int blocks = 0; /* the number of blocks to generate */
int maxblocks = 0; /* max # of blocks to create */
int prealloc = 1; /* whether or not to do preallocation */
+ int syncfile = 0; /* whether fiemap should sync file first */
int seed = 1;
- while ((opt = getopt(argc, argv, "m:r:s:p:q")) != -1) {
+ while ((opt = getopt(argc, argv, "m:r:s:p:qS")) != -1) {
switch(opt) {
case 'm':
map = strdup(optarg);
@@ -538,13 +539,16 @@ main(int argc, char **argv)
case 'q':
quiet = 1;
break;
- /* sync file before mapping */
case 'r':
runs = atoi(optarg);
break;
case 's':
seed = atoi(optarg);
break;
+ /* sync file before mapping */
+ case 'S':
+ syncfile = 1;
+ break;
default:
usage();
}
@@ -623,7 +627,7 @@ main(int argc, char **argv)
exit(1);
}
- rc = compare_fiemap_and_map(fd, map, blocks, blocksize);
+ rc = compare_fiemap_and_map(fd, map, blocks, blocksize, syncfile);
if (rc) {
printf("Problem comparing fiemap and map\n");
free(map);
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2 V2] xfstests 225: add additional fiemap-tester run without sync
2011-02-24 22:04 [PATCH 2/2] xfstests 225: add additional fiemap-tester run without sync Eric Sandeen
@ 2011-02-24 22:17 ` Eric Sandeen
2011-02-25 14:49 ` Josef Bacik
2011-02-25 20:47 ` Alex Elder
0 siblings, 2 replies; 4+ messages in thread
From: Eric Sandeen @ 2011-02-24 22:17 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Josef Bacik, xfs mailing list
Chris Mason pointed out that some filesystems were not doing
the right thing on fiemap, in the face of delalloc extents.
Because test 225 ran with FIEMAP_FLAG_SYNC only, this didn't
get caught. Add a runtime option, and run it both ways.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
Whoops, V2: actually call w/ the sync flag.
diff --git a/225 b/225
index 6e879a4..6b203e6 100755
--- a/225
+++ b/225
@@ -60,7 +60,10 @@ _cleanup()
}
trap "_cleanup; exit \$status" 0 1 2 3 15
-echo "fiemap run without preallocation"
+echo "fiemap run without preallocation, with sync"
+$here/src/fiemap-tester -q -S -p 0 -r 200 $fiemapfile 2>&1 | tee $fiemaplog
+
+echo "fiemap run without preallocation or sync"
$here/src/fiemap-tester -q -p 0 -r 200 $fiemapfile 2>&1 | tee $fiemaplog
if grep -q "Operation not supported" $fiemaplog; then
diff --git a/225.out b/225.out
index 7bc9312..b4f6477 100644
--- a/225.out
+++ b/225.out
@@ -1,2 +1,3 @@
QA output created by 225
-fiemap run without preallocation
+fiemap run without preallocation, with sync
+fiemap run without preallocation or sync
diff --git a/src/fiemap-tester.c b/src/fiemap-tester.c
index 53d7a64..6320580 100644
--- a/src/fiemap-tester.c
+++ b/src/fiemap-tester.c
@@ -418,7 +418,7 @@ static int query_fiemap_count(int fd, int blocks, int blocksize)
}
static int
-compare_fiemap_and_map(int fd, char *map, int blocks, int blocksize)
+compare_fiemap_and_map(int fd, char *map, int blocks, int blocksize, int syncfile)
{
struct fiemap *fiemap;
char *fiebuf;
@@ -446,7 +446,7 @@ compare_fiemap_and_map(int fd, char *map, int blocks, int blocksize)
last_data = i;
}
- fiemap->fm_flags = FIEMAP_FLAG_SYNC;
+ fiemap->fm_flags = syncfile ? FIEMAP_FLAG_SYNC : 0;
fiemap->fm_extent_count = blocks_to_map;
fiemap->fm_mapped_extents = 0;
@@ -519,9 +519,10 @@ main(int argc, char **argv)
int blocks = 0; /* the number of blocks to generate */
int maxblocks = 0; /* max # of blocks to create */
int prealloc = 1; /* whether or not to do preallocation */
+ int syncfile = 0; /* whether fiemap should sync file first */
int seed = 1;
- while ((opt = getopt(argc, argv, "m:r:s:p:q")) != -1) {
+ while ((opt = getopt(argc, argv, "m:r:s:p:qS")) != -1) {
switch(opt) {
case 'm':
map = strdup(optarg);
@@ -538,13 +539,16 @@ main(int argc, char **argv)
case 'q':
quiet = 1;
break;
- /* sync file before mapping */
case 'r':
runs = atoi(optarg);
break;
case 's':
seed = atoi(optarg);
break;
+ /* sync file before mapping */
+ case 'S':
+ syncfile = 1;
+ break;
default:
usage();
}
@@ -623,7 +627,7 @@ main(int argc, char **argv)
exit(1);
}
- rc = compare_fiemap_and_map(fd, map, blocks, blocksize);
+ rc = compare_fiemap_and_map(fd, map, blocks, blocksize, syncfile);
if (rc) {
printf("Problem comparing fiemap and map\n");
free(map);
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2 V2] xfstests 225: add additional fiemap-tester run without sync
2011-02-24 22:17 ` [PATCH 2/2 V2] " Eric Sandeen
@ 2011-02-25 14:49 ` Josef Bacik
2011-02-25 20:47 ` Alex Elder
1 sibling, 0 replies; 4+ messages in thread
From: Josef Bacik @ 2011-02-25 14:49 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Eric Sandeen, Josef Bacik, xfs mailing list
On Thu, Feb 24, 2011 at 04:17:22PM -0600, Eric Sandeen wrote:
> Chris Mason pointed out that some filesystems were not doing
> the right thing on fiemap, in the face of delalloc extents.
>
> Because test 225 ran with FIEMAP_FLAG_SYNC only, this didn't
> get caught. Add a runtime option, and run it both ways.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> Whoops, V2: actually call w/ the sync flag.
>
> diff --git a/225 b/225
> index 6e879a4..6b203e6 100755
> --- a/225
> +++ b/225
> @@ -60,7 +60,10 @@ _cleanup()
> }
> trap "_cleanup; exit \$status" 0 1 2 3 15
>
> -echo "fiemap run without preallocation"
> +echo "fiemap run without preallocation, with sync"
> +$here/src/fiemap-tester -q -S -p 0 -r 200 $fiemapfile 2>&1 | tee $fiemaplog
> +
> +echo "fiemap run without preallocation or sync"
> $here/src/fiemap-tester -q -p 0 -r 200 $fiemapfile 2>&1 | tee $fiemaplog
>
> if grep -q "Operation not supported" $fiemaplog; then
> diff --git a/225.out b/225.out
> index 7bc9312..b4f6477 100644
> --- a/225.out
> +++ b/225.out
> @@ -1,2 +1,3 @@
> QA output created by 225
> -fiemap run without preallocation
> +fiemap run without preallocation, with sync
> +fiemap run without preallocation or sync
> diff --git a/src/fiemap-tester.c b/src/fiemap-tester.c
> index 53d7a64..6320580 100644
> --- a/src/fiemap-tester.c
> +++ b/src/fiemap-tester.c
> @@ -418,7 +418,7 @@ static int query_fiemap_count(int fd, int blocks, int blocksize)
> }
>
> static int
> -compare_fiemap_and_map(int fd, char *map, int blocks, int blocksize)
> +compare_fiemap_and_map(int fd, char *map, int blocks, int blocksize, int syncfile)
> {
> struct fiemap *fiemap;
> char *fiebuf;
> @@ -446,7 +446,7 @@ compare_fiemap_and_map(int fd, char *map, int blocks, int blocksize)
> last_data = i;
> }
>
> - fiemap->fm_flags = FIEMAP_FLAG_SYNC;
> + fiemap->fm_flags = syncfile ? FIEMAP_FLAG_SYNC : 0;
> fiemap->fm_extent_count = blocks_to_map;
> fiemap->fm_mapped_extents = 0;
>
> @@ -519,9 +519,10 @@ main(int argc, char **argv)
> int blocks = 0; /* the number of blocks to generate */
> int maxblocks = 0; /* max # of blocks to create */
> int prealloc = 1; /* whether or not to do preallocation */
> + int syncfile = 0; /* whether fiemap should sync file first */
> int seed = 1;
>
> - while ((opt = getopt(argc, argv, "m:r:s:p:q")) != -1) {
> + while ((opt = getopt(argc, argv, "m:r:s:p:qS")) != -1) {
> switch(opt) {
> case 'm':
> map = strdup(optarg);
> @@ -538,13 +539,16 @@ main(int argc, char **argv)
> case 'q':
> quiet = 1;
> break;
> - /* sync file before mapping */
> case 'r':
> runs = atoi(optarg);
> break;
> case 's':
> seed = atoi(optarg);
> break;
> + /* sync file before mapping */
> + case 'S':
> + syncfile = 1;
> + break;
> default:
> usage();
> }
> @@ -623,7 +627,7 @@ main(int argc, char **argv)
> exit(1);
> }
>
> - rc = compare_fiemap_and_map(fd, map, blocks, blocksize);
> + rc = compare_fiemap_and_map(fd, map, blocks, blocksize, syncfile);
> if (rc) {
> printf("Problem comparing fiemap and map\n");
> free(map);
>
>
How about something in the usage() function to show we have this handy option
:). Thanks,
Josef
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2 V2] xfstests 225: add additional fiemap-tester run without sync
2011-02-24 22:17 ` [PATCH 2/2 V2] " Eric Sandeen
2011-02-25 14:49 ` Josef Bacik
@ 2011-02-25 20:47 ` Alex Elder
1 sibling, 0 replies; 4+ messages in thread
From: Alex Elder @ 2011-02-25 20:47 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Eric Sandeen, xfs, Josef Bacik
On Thu, 2011-02-24 at 16:17 -0600, Eric Sandeen wrote:
> Chris Mason pointed out that some filesystems were not doing
> the right thing on fiemap, in the face of delalloc extents.
>
> Because test 225 ran with FIEMAP_FLAG_SYNC only, this didn't
> get caught. Add a runtime option, and run it both ways.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Looks good. Please add a line to document the option
in the usage() function as suggested by Josef before
committing.
Reviewed-by: Alex Elder <aelder@sgi.com>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-02-25 20:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-24 22:04 [PATCH 2/2] xfstests 225: add additional fiemap-tester run without sync Eric Sandeen
2011-02-24 22:17 ` [PATCH 2/2 V2] " Eric Sandeen
2011-02-25 14:49 ` Josef Bacik
2011-02-25 20:47 ` Alex Elder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox