Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nocache
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Danil Mikhailov
nocache
Commits
afedd144
Commit
afedd144
authored
Jul 12, 2012
by
Julius Plenz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add DOUBLEFADVISE compile time option
parent
241eade9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
5 deletions
+16
-5
Makefile
Makefile
+6
-5
README
README
+7
-0
fcntl_helpers.c
fcntl_helpers.c
+3
-0
No files found.
Makefile
View file @
afedd144
default
:
all
all
:
cachestats cachedel nocache.so
GCC
=
gcc
$(CFLAGS)
%.c
:
Makefile
cachestats
:
cachestats.c
gcc
-Wall
-o
cachestats cachestats.c
$(GCC)
-Wall
-o
cachestats cachestats.c
cachedel
:
cachedel.c
gcc
-Wall
-o
cachedel cachedel.c
$(GCC)
-Wall
-o
cachedel cachedel.c
nocache.o
:
nocache.c
gcc
-Wall
-fPIC
-c
-o
nocache.o nocache.c
$(GCC)
-Wall
-fPIC
-c
-o
nocache.o nocache.c
fcntl_helpers.o
:
fcntl_helpers.c
gcc
-Wall
-fPIC
-c
-o
fcntl_helpers.o fcntl_helpers.c
$(GCC)
-Wall
-fPIC
-c
-o
fcntl_helpers.o fcntl_helpers.c
nocache.so
:
nocache.o fcntl_helpers.o
gcc
-Wall
-pthread
-shared
-Wl
,-soname,nocache.so
-o
nocache.so nocache.o fcntl_helpers.o
-ldl
$(GCC)
-Wall
-pthread
-shared
-Wl
,-soname,nocache.so
-o
nocache.so nocache.o fcntl_helpers.o
-ldl
install
:
all
install
-m
0644 nocache.so /usr/local/lib
...
...
README
View file @
afedd144
...
...
@@ -90,6 +90,13 @@ the file descriptor is closed, this may not happen if they are left
open when the application exits, although the destructor tries to do
that.
There are timing issues to consider, as well. If you consider `nocache
cat <file>`, in most (all?) cases the cache will not be restored. For
discussion and possible solutions see <http://lwn.net/Articles/480930/>.
My experience showed that in many cases you could "fix" this by doing
the `posix_fadvise` call *twice*. If you want this behaviour, compile
the library using `make CFLAGS=-DDOUBLEFADVISE`.
Acknowledgements
----------------
...
...
fcntl_helpers.c
View file @
afedd144
...
...
@@ -7,6 +7,9 @@
int
fadv_dontneed
(
int
fd
,
off_t
offset
,
off_t
len
)
{
#ifdef DOUBLEFADVISE
posix_fadvise
(
fd
,
offset
,
len
,
POSIX_FADV_DONTNEED
);
#endif
return
posix_fadvise
(
fd
,
offset
,
len
,
POSIX_FADV_DONTNEED
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment