Skip to content

Commit

Permalink
fadvise sequential on ifile
Browse files Browse the repository at this point in the history
  • Loading branch information
ryancdotorg committed Oct 17, 2015
1 parent af5aa0a commit 570520d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions brainflayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,12 @@ int main(int argc, char **argv) {
bloom = bloom_mmapf.mem;
}

if (iopt && (ifile = fopen(iopt, "r")) == NULL) {
bail(1, "failed to open '%s' for reading: %s\n", iopt, strerror(errno));
if (iopt) {
if ((ifile = fopen(iopt, "r")) == NULL) {
bail(1, "failed to open '%s' for reading: %s\n", iopt, strerror(errno));
}
// increases readahead window, don't really care if it fails
posix_fadvise(fileno(ifile), 0, 0, POSIX_FADV_SEQUENTIAL);
}

if (oopt && (ofile = fopen(oopt, (aopt ? "a" : "w"))) == NULL) {
Expand Down

0 comments on commit 570520d

Please sign in to comment.