You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+52-36Lines changed: 52 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
-
# Script_Optfs #
2
-
### What is Script_Optfs? ###
3
-
Script_Optfs is a conversion tool, capable of converting libraries that use `fsync` pessimistically to be compatible with the Optimistic File System ([OptFS](https://github.com/utsaslab/optfs)).
1
+
# AutoOsync #
2
+
### What is AutoOsync? ###
3
+
AutoOsync is a conversion tool, capable of converting libraries that use `fsync` pessimistically to be compatible with the Optimistic File System ([OptFS](https://github.com/utsaslab/optfs)).
4
4
OptFS is a linux-ext4 variant that implements [Optimistic Crash Consistency](http://research.cs.wisc.edu/adsl/Publications/optfs-sosp13.pdf) which essentially makes the same level of guarantee as Pessimistic Crash Consistency (`fsync()` after every write) with sometimes the same speed as Probabilistic Crash Consistency (never calling `fsync()`).
5
5
6
-
This means that you can easily speed up the writes in your program by switching to OptFS and running Script_Optfs on the libraries that are in charge of persistence.
6
+
This means that you can easily speed up the writes in your program by switching to OptFS and running AutoOsync on the libraries that are in charge of persistence.
7
7
8
8
### Getting Setup ###
9
9
#### Script Dependencies ####
@@ -12,7 +12,7 @@ The only dependency for this script besides `Python2.7` is `LLVM` with clang bin
12
12
1. Run the following script after fixing the path, if necessary, to [Install Ninja](https://github.com/JDevlieghere/dotfiles/blob/master/installers/ninja.sh)
13
13
1. Then, run this script to actually get the `LLVM` source code. [LLVM](https://github.com/JDevlieghere/dotfiles/blob/master/installers/llvm.sh)
14
14
15
-
#### Running the Script_Optfs ####
15
+
#### Running the AutoOsync ####
16
16
1. Go to the script source, `script.py`, and then modify the `set_library_path` variable to your path to LLVM's `/build/lib`.
17
17
Once that is done, you might need to set an environmental variable, if the compiler throws you an error, otherwise, you are done and the script can be run.
18
18
1. To run the script, you just type `python script.py /path/to/library` and the script should run and modify everything in a new directory `<library_name>_`.
@@ -61,43 +61,59 @@ void dsync_foo() {
61
61
62
62
```
63
63
3. Special case of `fsync`: Since `fsync` is an `fsync_wrapper` too, it must get its own version of osync definition and dsync definition. And it does! The osync definition of `fsync` is called `osync` and it's a system call that guarantees order and eventual durability. The dsync definition of `fsync` is called `dsync` and it's a system call that guaratess immediate durability (blocks). For more details, check the Optimistic Crash Cosnsistency paper linked above.
64
-
### Safety of the Script_Optfs ###
65
-
Optfs needs some improvements in cases of conditionals, as it is possible to compromise program correctness if an `fsync_wrapper` is called inside a conditional. Consider the following case:
64
+
### Safety of the AutoOsync ###
65
+
The script is safe in most cases, but there certainly are cases we don't account for.
66
+
This script can deal with scope, so you can have functions with the same name in multiple files, as long as more than one of those functions doesn't have external linkage, our script will take care it. We went through great lengths to ensure that.
67
+
However, cases where a switch statement is used, like the following:
66
68
```C
67
-
voidfoo(x) {
68
-
bar1();
69
-
if (x == 0) {
70
-
bar1();
69
+
function foo(fd1, fd2, expression) {
70
+
switch (expression) {
71
+
case 1:
72
+
fsync(fd1);
73
+
break;
74
+
case 2:
75
+
fsync(fd2);
76
+
break;
77
+
default:
78
+
fsync(fd1);
79
+
fsync(fd2);
71
80
}
72
-
else {
73
-
bar1();
74
-
}
75
-
}
81
+
}
76
82
```
77
-
This would get converted to:
83
+
would get converted to the following:
78
84
```C
79
-
void osync_foo(x) { /* this osync definition is correct */
80
-
osync_bar1();
81
-
if (x == 0) {
82
-
osync_bar1();
83
-
}
84
-
else {
85
-
osync_bar1();
86
-
}
87
-
}
88
-
89
-
void dsync_foo(x) { /* this dsync definition is not correct */
90
-
osync_bar1();
91
-
if (x == 0) {
92
-
osync_bar1();
85
+
function osync_foo(fd1, fd2, expression) { /* this definition is correct */
86
+
switch (expression) {
87
+
case 1:
88
+
osync(fd1);
89
+
break;
90
+
case 2:
91
+
osync(fd2);
92
+
break;
93
+
default:
94
+
osync(fd1);
95
+
osync(fd2);
93
96
}
94
-
else {
95
-
dsync_bar1();
97
+
}
98
+
99
+
function dsync_foo(fd1, fd2, expression) { /* this definition isn't corrrect */
100
+
switch (expression) {
101
+
case 1:
102
+
osync(fd1);
103
+
break; /* this function is a dsync definition, yet it doesn't ever call dsync if case 1 is called */
104
+
105
+
case 2:
106
+
osync(fd2);
107
+
break; /* same in this case, dsync definitions should call dsync before they return */
108
+
109
+
default:
110
+
osync(fd1);
111
+
dsync(fd2); /* only in this case will dsync actually be invoked before the function returns */
96
112
}
97
-
}
113
+
}
98
114
```
99
-
In this case, our code doesn't work for the case where `x = 0`.
100
-
We have noticed that in most cases libraries tend not to use this kind of code, so it should work well in most cases.
115
+
So in this case, the dsync definition doesn't actually invariably call dsync, although that is the expected behavior.
101
116
### Authors ###
102
117
Tom Gong (tom.gong@utexas.edu) and Subrat Mainali (mainali.subrat@utexas.edu)
103
-
Under [Dr. Vijay Chidambram](http://www.cs.utexas.edu/~vijay/), UT Austin.
118
+
119
+
Under [Dr. Vijay Chidambaram](http://www.cs.utexas.edu/~vijay/), UT Austin.
0 commit comments