Kouhei Sutou
null+****@clear*****
Thu Aug 6 16:54:28 JST 2015
Kouhei Sutou 2015-08-06 16:54:28 +0900 (Thu, 06 Aug 2015) New Revision: eac4667308a7c63c9d3bedcd8185ff19d024278c https://github.com/groonga/groonga/commit/eac4667308a7c63c9d3bedcd8185ff19d024278c Message: windows: try to make file sparse It may reduce file size. It should not break backward compatibility. Modified files: lib/io.c Modified: lib/io.c (+22 -0) =================================================================== --- lib/io.c 2015-07-30 12:18:53 +0900 (f5b0785) +++ lib/io.c 2015-08-06 16:54:28 +0900 (3d8383d) @@ -1586,8 +1586,30 @@ grn_fileinfo_open_common(grn_ctx *ctx, fileinfo *fi, const char *path, int flags path, flags_description); goto exit; } + + { + FILE_SET_SPARSE_BUFFER buffer; + buffer.SetSparse = TRUE; + DWORD returned_bytes; + if (!DeviceIoControl(fi->fh, + FSCTL_SET_SPARSE, + &buffer, + sizeof(FILE_SET_SPARSE_BUFFER), + NULL, + 0, + &returned_bytes, + NULL)) { + GRN_LOG(ctx, GRN_LOG_INFO, + "Tried to make file sparse but failed: " + "DeviceIoControl(FSCTL_SET_SPARSE): " + "<%s>: <%s>", + path, grn_current_error_message()); + } + } + goto exit; } + if ((flags & O_TRUNC)) { CloseHandle(fi->fh); /* unable to assign OPEN_ALWAYS and TRUNCATE_EXISTING at once */ -------------- next part -------------- HTML����������������������������...Download