From: Josef Bacik <jbacik@redhat.com>
To: linux-btrfs@vger.kernel.org
Subject: [TESTCASE] test orphan recovery code
Date: Thu, 24 Jul 2008 15:42:19 -0400 [thread overview]
Message-ID: <20080724194219.GC28414@unused.rdu.redhat.com> (raw)
Hello,
Another one for the qa suite. This will create 1001 files, unlink them, and
then do a sysrq+b which is like hitting the reset button on your box to make
sure that on mount when the box comes back up all the files are cleaned up.
Don't run this unless you expect the box to be reset. Successfull running of
this testcase should result in no file_# files being left over and no orphan
records left. Thanks,
Josef
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
int main(void)
{
int fd, i, proc_fd;
char buf[80];
for (i = 0; i <= 1000; i++) {
snprintf(buf, 80, "file_%d", i);
fd = open(buf, O_RDONLY | O_CREAT, 0666);
unlink(buf);
}
fsync(fd);
printf("rebooting...\n");
proc_fd = open("/proc/sysrq-trigger", O_WRONLY);
if (proc_fd < 0) {
fprintf(stderr, "Error opening sysrq: %d\n", errno);
}
write(proc_fd, "b", 1);
/* should be dead by now so no need to clean anything up */
return 0;
}
reply other threads:[~2008-07-24 19:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20080724194219.GC28414@unused.rdu.redhat.com \
--to=jbacik@redhat.com \
--cc=linux-btrfs@vger.kernel.org \
/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