mirror of
https://github.com/psankar/simplefs.git
synced 2025-07-26 23:44:08 +02:00
simple-test: mount fs with journal
This commit is contained in:
parent
33f5f117df
commit
e21bfc88e3
@ -21,6 +21,11 @@ root_pwd="$PWD"
|
|||||||
test_dir="test-dir-$RANDOM"
|
test_dir="test-dir-$RANDOM"
|
||||||
test_mount_point="test-mount-point-$RANDOM"
|
test_mount_point="test-mount-point-$RANDOM"
|
||||||
|
|
||||||
|
function create_journal()
|
||||||
|
{
|
||||||
|
dd bs=1M count=10 if=/dev/zero of="$1"
|
||||||
|
mke2fs -O journal_dev "$1"
|
||||||
|
}
|
||||||
function create_test_image()
|
function create_test_image()
|
||||||
{
|
{
|
||||||
dd bs=4096 count=100 if=/dev/zero of="$1"
|
dd bs=4096 count=100 if=/dev/zero of="$1"
|
||||||
@ -29,7 +34,7 @@ function create_test_image()
|
|||||||
function mount_fs_image()
|
function mount_fs_image()
|
||||||
{
|
{
|
||||||
insmod simplefs.ko
|
insmod simplefs.ko
|
||||||
mount -o loop,owner,group,users -t simplefs "$1" "$2"
|
mount -o loop,owner,group,users,journal_path="$1" -t simplefs "$2" "$3"
|
||||||
dmesg | tail -n20
|
dmesg | tail -n20
|
||||||
}
|
}
|
||||||
function unmount_fs()
|
function unmount_fs()
|
||||||
@ -108,15 +113,16 @@ cleanup
|
|||||||
trap cleanup SIGINT EXIT
|
trap cleanup SIGINT EXIT
|
||||||
mkdir "$test_dir" "$test_mount_point"
|
mkdir "$test_dir" "$test_mount_point"
|
||||||
create_test_image "$test_dir/image"
|
create_test_image "$test_dir/image"
|
||||||
|
create_journal "$test_dir/journal"
|
||||||
|
|
||||||
# 1
|
# 1
|
||||||
mount_fs_image "$test_dir/image" "$test_mount_point"
|
mount_fs_image "$test_dir/journal" "$test_dir/image" "$test_mount_point"
|
||||||
do_some_operations "$test_mount_point"
|
do_some_operations "$test_mount_point"
|
||||||
cd "$root_pwd"
|
cd "$root_pwd"
|
||||||
unmount_fs "$test_mount_point"
|
unmount_fs "$test_mount_point"
|
||||||
|
|
||||||
# 2
|
# 2
|
||||||
mount_fs_image "$test_dir/image" "$test_mount_point"
|
mount_fs_image "$test_dir/journal" "$test_dir/image" "$test_mount_point"
|
||||||
do_read_operations "$test_mount_point"
|
do_read_operations "$test_mount_point"
|
||||||
cd "$root_pwd"
|
cd "$root_pwd"
|
||||||
unmount_fs "$test_mount_point"
|
unmount_fs "$test_mount_point"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user