intigrate bulkstat_unlink_test into XFS-QA

Merge of master-melb:xfs-cmds:29213a by kenmcd.

  New XFSQA test
This commit is contained in:
Mohamed Barwani
2007-07-24 16:08:02 +00:00
parent 2bf01dc5c4
commit b1d0b1cb9d
5 changed files with 343 additions and 1 deletions
Executable
+55
View File
@@ -0,0 +1,55 @@
#! /bin/sh
# FS QA Test No. 177
#
# Test to reproduce PV#: 964316
# Check sync reclaims and flushes unlinked inodes to their buffers.
#-----------------------------------------------------------------------
# Copyright (c) 2007 Silicon Graphics, Inc. All Rights Reserved.
#-----------------------------------------------------------------------
#
# creator
owner=mohamedb@sgi.com
seq=`basename $0`
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
rm -f $tmp.*
}
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
# real QA test starts here
# Modify as appropriate.
_supported_fs xfs
_supported_os Linux
# Setup Filesystem
_require_scratch
_scratch_mkfs_xfs >/dev/null 2>&1 \
|| _fail "mkfs failed"
_scratch_mount \
|| _fail "mount failed"
# run Mark Goodwin test here
# Usage: ./bulkstat_unlink_test iterations nfiles stride dir
# Create dir with nfiles, unlink each stride'th file, sync, bulkstat
$here/src/bulkstat_unlink_test 50 100 1 $SCRATCH_MNT/bulkstat
$here/src/bulkstat_unlink_test 10 1000 1 $SCRATCH_MNT/bulkstat
$here/src/bulkstat_unlink_test 50 100 6 $SCRATCH_MNT/bulkstat
$here/src/bulkstat_unlink_test 50 1000 3 $SCRATCH_MNT/bulkstat
# success, all done
status=0
exit
+161
View File
@@ -0,0 +1,161 @@
QA output created by 177
Iteration 0 ... passed
Iteration 1 ... passed
Iteration 2 ... passed
Iteration 3 ... passed
Iteration 4 ... passed
Iteration 5 ... passed
Iteration 6 ... passed
Iteration 7 ... passed
Iteration 8 ... passed
Iteration 9 ... passed
Iteration 10 ... passed
Iteration 11 ... passed
Iteration 12 ... passed
Iteration 13 ... passed
Iteration 14 ... passed
Iteration 15 ... passed
Iteration 16 ... passed
Iteration 17 ... passed
Iteration 18 ... passed
Iteration 19 ... passed
Iteration 20 ... passed
Iteration 21 ... passed
Iteration 22 ... passed
Iteration 23 ... passed
Iteration 24 ... passed
Iteration 25 ... passed
Iteration 26 ... passed
Iteration 27 ... passed
Iteration 28 ... passed
Iteration 29 ... passed
Iteration 30 ... passed
Iteration 31 ... passed
Iteration 32 ... passed
Iteration 33 ... passed
Iteration 34 ... passed
Iteration 35 ... passed
Iteration 36 ... passed
Iteration 37 ... passed
Iteration 38 ... passed
Iteration 39 ... passed
Iteration 40 ... passed
Iteration 41 ... passed
Iteration 42 ... passed
Iteration 43 ... passed
Iteration 44 ... passed
Iteration 45 ... passed
Iteration 46 ... passed
Iteration 47 ... passed
Iteration 48 ... passed
Iteration 49 ... passed
Iteration 0 ... passed
Iteration 1 ... passed
Iteration 2 ... passed
Iteration 3 ... passed
Iteration 4 ... passed
Iteration 5 ... passed
Iteration 6 ... passed
Iteration 7 ... passed
Iteration 8 ... passed
Iteration 9 ... passed
Iteration 0 ... passed
Iteration 1 ... passed
Iteration 2 ... passed
Iteration 3 ... passed
Iteration 4 ... passed
Iteration 5 ... passed
Iteration 6 ... passed
Iteration 7 ... passed
Iteration 8 ... passed
Iteration 9 ... passed
Iteration 10 ... passed
Iteration 11 ... passed
Iteration 12 ... passed
Iteration 13 ... passed
Iteration 14 ... passed
Iteration 15 ... passed
Iteration 16 ... passed
Iteration 17 ... passed
Iteration 18 ... passed
Iteration 19 ... passed
Iteration 20 ... passed
Iteration 21 ... passed
Iteration 22 ... passed
Iteration 23 ... passed
Iteration 24 ... passed
Iteration 25 ... passed
Iteration 26 ... passed
Iteration 27 ... passed
Iteration 28 ... passed
Iteration 29 ... passed
Iteration 30 ... passed
Iteration 31 ... passed
Iteration 32 ... passed
Iteration 33 ... passed
Iteration 34 ... passed
Iteration 35 ... passed
Iteration 36 ... passed
Iteration 37 ... passed
Iteration 38 ... passed
Iteration 39 ... passed
Iteration 40 ... passed
Iteration 41 ... passed
Iteration 42 ... passed
Iteration 43 ... passed
Iteration 44 ... passed
Iteration 45 ... passed
Iteration 46 ... passed
Iteration 47 ... passed
Iteration 48 ... passed
Iteration 49 ... passed
Iteration 0 ... passed
Iteration 1 ... passed
Iteration 2 ... passed
Iteration 3 ... passed
Iteration 4 ... passed
Iteration 5 ... passed
Iteration 6 ... passed
Iteration 7 ... passed
Iteration 8 ... passed
Iteration 9 ... passed
Iteration 10 ... passed
Iteration 11 ... passed
Iteration 12 ... passed
Iteration 13 ... passed
Iteration 14 ... passed
Iteration 15 ... passed
Iteration 16 ... passed
Iteration 17 ... passed
Iteration 18 ... passed
Iteration 19 ... passed
Iteration 20 ... passed
Iteration 21 ... passed
Iteration 22 ... passed
Iteration 23 ... passed
Iteration 24 ... passed
Iteration 25 ... passed
Iteration 26 ... passed
Iteration 27 ... passed
Iteration 28 ... passed
Iteration 29 ... passed
Iteration 30 ... passed
Iteration 31 ... passed
Iteration 32 ... passed
Iteration 33 ... passed
Iteration 34 ... passed
Iteration 35 ... passed
Iteration 36 ... passed
Iteration 37 ... passed
Iteration 38 ... passed
Iteration 39 ... passed
Iteration 40 ... passed
Iteration 41 ... passed
Iteration 42 ... passed
Iteration 43 ... passed
Iteration 44 ... passed
Iteration 45 ... passed
Iteration 46 ... passed
Iteration 47 ... passed
Iteration 48 ... passed
Iteration 49 ... passed
+1
View File
@@ -262,3 +262,4 @@ filestreams dgc@sgi.com
172 rw filestreams auto
173 rw filestreams auto
174 rw filestreams auto
177 rw other auto
+2 -1
View File
@@ -14,7 +14,8 @@ TARGETS = dirstress fill fill2 getpagesize holes lstat64 \
LINUX_TARGETS = loggen xfsctl bstat t_mtab getdevicesize \
preallo_rw_pattern_reader preallo_rw_pattern_writer ftrunc trunc \
fs_perms testx looptest locktest unwritten_mmap
fs_perms testx looptest locktest unwritten_mmap \
bulkstat_unlink_test
IRIX_TARGETS = open_unlink
+124
View File
@@ -0,0 +1,124 @@
/*
* $Id: bulkstat_unlink_test.c,v 1.1 2007/07/24 16:08:02 mohamedb.longdrop.melbourne.sgi.com Exp $
* Test bulkstat doesn't returned unlinked inodes.
* Mark Goodwin <markgw@sgi.com> Fri Jul 20 09:13:57 EST 2007
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <xfs/xfs.h>
#include <unistd.h>
int
main(int argc, char *argv[])
{
int e;
int fd;
int i;
int j;
int k;
int nfiles;
int stride;
struct stat sbuf;
ino_t *inodelist;
xfs_fsop_bulkreq_t a;
xfs_bstat_t *ret;
int iterations;
char fname[MAXPATHLEN];
char *dirname;
if (argc != 5) {
fprintf(stderr, "Usage: %s iterations nfiles stride dir\n", argv[0]);
fprintf(stderr, "Create dir with nfiles, unlink each stride'th file, sync, bulkstat\n");
exit(1);
}
iterations = atoi(argv[1]);
nfiles = atoi(argv[2]);
stride = atoi(argv[3]);
dirname = argv[4];
inodelist = (ino_t *)malloc(nfiles * sizeof(ino_t));
ret = (xfs_bstat_t *)malloc(nfiles * sizeof(xfs_bstat_t));
for (k=0; k < iterations; k++) {
xfs_ino_t last_inode = 0;
int count = 0;
printf("Iteration %d ... ", k);
memset(&a, 0, sizeof(xfs_fsop_bulkreq_t));
a.lastip = &last_inode;
a.icount = nfiles;
a.ubuffer = ret;
a.ocount = &count;
if (mkdir(dirname, 0755) < 0) {
perror(dirname);
exit(1);
}
for (i=0; i < nfiles; i++) {
sprintf(fname, "%s/file%06d", dirname, i);
if ((fd = open(fname, O_RDWR | O_CREAT | O_TRUNC, 0644)) < 0) {
perror(fname);
exit(1);
}
write(fd, fname, sizeof(fname));
if (fstat(fd, &sbuf) < 0) {
perror(fname);
exit(1);
}
inodelist[i] = sbuf.st_ino;
close(fd);
}
if ((fd = open(dirname, O_RDONLY)) < 0) {
perror(dirname);
exit(1);
}
/*
* test begins here
*/
for (i=0; i < nfiles; i += stride) {
sprintf(fname, "%s/file%06d", dirname, i);
if (unlink(fname) < 0) {
perror(fname);
exit(1);
}
}
sync();
for (;;) {
if ((e = xfsctl(dirname, fd, XFS_IOC_FSBULKSTAT, &a)) < 0) {
perror("XFS_IOC_FSBULKSTAT:");
exit(1);
}
if (count == 0)
break;
for (i=0; i < count; i++) {
for (j=0; j < nfiles; j += stride) {
if (ret[i].bs_ino == inodelist[j]) {
/* oops ... */
printf("failed. Unlinked inode %ld returned by bulkstat\n", inodelist[j]);
exit(1);
}
}
}
}
close(fd);
sprintf(fname, "rm -rf %s\n", dirname);
system(fname);
sync();
sleep(2);
printf("passed\n");
}
exit(0);
}