ChangeLog, hold_inode.c, random_exercise.c:

random_exercise.c: New file which feeds a lot of file creations and
  	deletions (while leaving the file descriptor open, and then closing
  	the file descriptor later).  This generates lots of fodder for the
  	orphan list code, as well as for the ext3 journal.
  hold_inode.c: New file which holds an inode or a directory open (for
  	testing orphan list code).
ChangeLog, run_e2fsck, expect.1, expect.2, image.gz, name, expect:
  run_e2fsck: Filter out JFS DEBUG messages when comparing e2fsck output.
  f_journal: New test case which checks out running the ext3 journal.
  f_orphan: New test case which checks clearing the list of orphan
  	inodes (files and directories).
  f_swapfs/expect: Update to reflect new debugfs format for dumping the
  	blocks of an inode.
bitmap-optimize
Theodore Ts'o 2000-08-20 21:48:45 +00:00
parent 556ccbd6f9
commit da1a022670
14 changed files with 277 additions and 4 deletions

View File

@ -1,3 +1,17 @@
2000-08-20 <tytso@valinux.com>
* run_e2fsck: Filter out JFS DEBUG messages when comparing e2fsck
output.
* f_journal: New test case which checks out running the ext3
journal.
* f_orphan: New test case which checks clearing the list of orphan
inodes (files and directories).
* f_swapfs/expect: Update to reflect new debugfs format for
dumping the blocks of an inode.
2000-07-13 <tytso@valinux.com>
* Release of E2fsprogs 1.19

61
tests/f_journal/expect.1 Normal file
View File

@ -0,0 +1,61 @@
Clearing orphaned inode 60 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 38 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 55 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 40 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 49 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 28 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 84 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 83 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 110 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 54 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 36 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 72 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 106 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 70 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 81 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 29 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 103 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 107 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 53 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 50 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 85 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 20 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 102 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 74 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 32 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 77 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 46 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 25 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 93 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 89 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 14 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 52 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 42 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 44 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 58 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 17 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 31 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 13 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 48 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 33 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 59 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 30 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 67 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 90 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 23 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 34 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 24 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 80 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 26 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 63 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 87 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 69 (uid=0, gid=0, mode=0100600, size=0)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 53/2048 files (1.9% non-contiguous), 1304/8192 blocks
Exit status is 1

7
tests/f_journal/expect.2 Normal file
View File

@ -0,0 +1,7 @@
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 53/2048 files (1.9% non-contiguous), 1304/8192 blocks
Exit status is 0

BIN
tests/f_journal/image.gz Normal file

Binary file not shown.

1
tests/f_journal/name Normal file
View File

@ -0,0 +1 @@
recover journal

14
tests/f_orphan/expect.1 Normal file
View File

@ -0,0 +1,14 @@
Clearing orphaned inode 15 (uid=0, gid=0, mode=040755, size=1024)
Clearing orphaned inode 17 (uid=0, gid=0, mode=0100644, size=0)
Clearing orphaned inode 16 (uid=0, gid=0, mode=040755, size=1024)
Clearing orphaned inode 14 (uid=0, gid=0, mode=0100644, size=69)
Clearing orphaned inode 13 (uid=0, gid=0, mode=040755, size=1024)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 12/2048 files (0.0% non-contiguous), 1303/8192 blocks
Exit status is 1

7
tests/f_orphan/expect.2 Normal file
View File

@ -0,0 +1,7 @@
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 12/2048 files (0.0% non-contiguous), 1303/8192 blocks
Exit status is 0

BIN
tests/f_orphan/image.gz Normal file

Binary file not shown.

1
tests/f_orphan/name Normal file
View File

@ -0,0 +1 @@
clearing orphan inodes

View File

@ -41,7 +41,7 @@ ctime: 0x322488cf -- Wed Aug 28 17:58:39 1996
atime: 0x322488cf -- Wed Aug 28 17:58:39 1996
mtime: 0x322488cf -- Wed Aug 28 17:58:39 1996
BLOCKS:
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413
(0-11):70-81, (IND):82, (12-267):83-338, (DIND):339, (IND):340, (268-340):341-413
TOTAL: 344
debugfs: cat fluff
@ -103,7 +103,7 @@ ctime: 0x322488cf -- Wed Aug 28 17:58:39 1996
atime: 0x322488cf -- Wed Aug 28 17:58:39 1996
mtime: 0x322488cf -- Wed Aug 28 17:58:39 1996
BLOCKS:
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413
(0-11):70-81, (IND):82, (12-267):83-338, (DIND):339, (IND):340, (268-340):341-413
TOTAL: 344
debugfs: cat fluff

View File

@ -1,3 +1,14 @@
2000-08-20 <tytso@valinux.com>
* random_exercise.c: New file which feeds a lot of file creations
and deletions (while leaving the file descriptor open, and
then closing the file descriptor later). This generates
lots of fodder for the orphan list code, as well as for
the ext3 journal.
* hold_inode.c: New file which holds an inode or a directory open
(for testing orphan list code).
2000-07-13 <tytso@valinux.com>
* Release of E2fsprogs 1.19

47
tests/progs/hold_inode.c Normal file
View File

@ -0,0 +1,47 @@
/*
* hold_inode.c --- test program which holds an inode or directory
* open.
*
* Copyright (C) 2000 Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
*/
#include <unistd.h>
#include <stdio.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
main(int argc, char **argv)
{
struct stat statbuf;
char *filename;
if (argc != 2) {
fprintf(stderr, "Usage: %s dir\n", argv[0]);
exit(1);
}
filename = argv[1];
if (stat(filename, &statbuf) < 0) {
perror(filename);
exit(1);
}
if (S_ISDIR(statbuf.st_mode)) {
if (!opendir(filename)) {
perror(filename);
exit(1);
}
} else {
if (open(filename, O_RDONLY) < 0) {
perror(filename);
exit(1);
}
}
sleep(30);
}

View File

@ -0,0 +1,110 @@
/*
* random_exercise.c --- Test program which exercises an ext2
* filesystem. It creates a lot of random files in the current
* directory, while holding some files open while they are being
* deleted. This exercises the orphan list code, as well as
* creating lots of fodder for the ext3 journal.
*
* Copyright (C) 2000 Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
*/
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define MAXFDS 128
struct state {
char name[16];
int state;
};
#define STATE_CLEAR 0
#define STATE_CREATED 1
#define STATE_DELETED 2
struct state state_array[MAXFDS];
void clear_state_array()
{
int i;
for (i = 0; i < MAXFDS; i++)
state_array[i].state = STATE_CLEAR;
}
int get_random_fd()
{
int fd;
while (1) {
fd = ((int) random()) % MAXFDS;
if (fd > 2)
return fd;
}
}
void create_random_file()
{
char template[16] = "EX.XXXXXX";
int fd;
mktemp(template);
fd = open(template, O_CREAT|O_RDWR, 0600);
if (fd < 0)
return;
printf("Created temp file %s, fd = %d\n", template, fd);
state_array[fd].state = STATE_CREATED;
strcpy(state_array[fd].name, template);
}
void unlink_file(int fd)
{
char *filename = state_array[fd].name;
printf("Unlinking %s, fd = %d\n", filename, fd);
unlink(filename);
state_array[fd].state = STATE_DELETED;
}
void close_file(int fd)
{
char *filename = state_array[fd].name;
printf("Closing %s, fd = %d\n", filename, fd);
close(fd);
state_array[fd].state = STATE_CLEAR;
}
main(int argc, char **argv)
{
int i, fd;
for (i=0; i < 100000; i++) {
fd = get_random_fd();
switch (state_array[fd].state) {
case STATE_CLEAR:
create_random_file();
break;
case STATE_CREATED:
unlink_file(fd);
break;
case STATE_DELETED:
close_file(fd);
break;
}
}
}

View File

@ -33,14 +33,14 @@ eval $PREP_CMD
$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT1.new 2>&1
status=$?
echo Exit status is $status >> $OUT1.new
sed -e '1d' $OUT1.new > $OUT1
sed -e '1d' -e '/^JFS DEBUG:/d' $OUT1.new > $OUT1
rm -f $OUT1.new
if [ "$ONE_PASS_ONLY" != "true" ]; then
$FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1
status=$?
echo Exit status is $status >> $OUT2.new
sed -e '1d' $OUT2.new > $OUT2
sed -e '1d' $OUT2.new -e '/^JFS DEBUG:/d' > $OUT2
rm -f $OUT2.new
fi