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
5e6c065f
Commit
5e6c065f
authored
Feb 04, 2012
by
Julius Plenz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fadvise maximum possible range, not just pages
Also, fadv_dontneed will do the double syscall now.
parent
db0b9fb1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
fcntl_helpers.c
fcntl_helpers.c
+2
-0
nocache.c
nocache.c
+9
-5
No files found.
fcntl_helpers.c
View file @
5e6c065f
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
int
fadv_dontneed
(
int
fd
,
off_t
offset
,
off_t
len
)
int
fadv_dontneed
(
int
fd
,
off_t
offset
,
off_t
len
)
{
{
if
(
posix_fadvise
(
fd
,
offset
,
len
,
POSIX_FADV_DONTNEED
)
==
-
1
)
return
-
1
;
return
posix_fadvise
(
fd
,
offset
,
len
,
POSIX_FADV_DONTNEED
);
return
posix_fadvise
(
fd
,
offset
,
len
,
POSIX_FADV_DONTNEED
);
}
}
...
...
nocache.c
View file @
5e6c065f
...
@@ -154,15 +154,19 @@ static void free_unclaimed_pages(int fd)
...
@@ -154,15 +154,19 @@ static void free_unclaimed_pages(int fd)
sync_if_writable
(
fd
);
sync_if_writable
(
fd
);
for
(
j
=
0
;
j
<
fds
[
i
].
nr_pages
;
j
++
)
{
int
start
;
if
(
!
(
fds
[
i
].
info
[
j
]
&
1
))
{
start
=
j
=
0
;
fadv_dontneed
(
fd
,
j
*
PAGESIZE
,
PAGESIZE
);
while
(
j
<
fds
[
i
].
nr_pages
)
{
fadv_dontneed
(
fd
,
j
*
PAGESIZE
,
PAGESIZE
);
if
(
fds
[
i
].
info
[
j
]
&
1
)
{
if
(
start
<
j
)
fadv_dontneed
(
fd
,
start
*
PAGESIZE
,
(
j
-
start
)
*
PAGESIZE
);
start
=
j
+
1
;
}
}
j
++
;
}
}
/* forget written contents that go beyond previous file size */
/* forget written contents that go beyond previous file size */
fadv_dontneed
(
fd
,
fds
[
i
].
size
,
0
);
fadv_dontneed
(
fd
,
start
<
j
?
start
*
PAGESIZE
:
fds
[
i
].
size
,
0
);
if
(
fds
[
i
].
info
)
if
(
fds
[
i
].
info
)
free
(
fds
[
i
].
info
);
free
(
fds
[
i
].
info
);
...
...
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