Skip to content

Commit

Permalink
Allocating sparse files on windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
clemahieu committed Mar 16, 2015
1 parent 2a69f07 commit c2520da
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions liblmdb/mdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -4682,6 +4682,10 @@ mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode
mode = FILE_ATTRIBUTE_NORMAL;
env->me_fd = CreateFile(dpath, oflags, FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, len, mode, NULL);
DWORD actual;
if (!DeviceIoControl(env->me_fd, FSCTL_SET_SPARSE, NULL, 0,
NULL, 0, &actual, NULL))
; // If the file is not sparsed, it will allocate the full environment
#else
if (F_ISSET(flags, MDB_RDONLY))
oflags = O_RDONLY;
Expand Down

0 comments on commit c2520da

Please sign in to comment.