win: change st_blksize from 2048 to 4096

`fs__stat_handle()` used to set st_blksize to `2048` regardless of the
underlying physical sector size of the disk.

`4096` is a better constant to avoid read-modify-write behavior on
advanced format drives.

Fixes: https://github.com/libuv/libuv/issues/1563
PR-URL: https://github.com/libuv/libuv/pull/1566
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
This commit is contained in:
Joran Dirk Greef 2017-09-27 11:09:28 +02:00 committed by Bartosz Sosnowski
parent 94f507535c
commit 5a2b5e84d0

View File

@ -1178,8 +1178,12 @@ INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf) {
*
* Therefore we'll just report a sensible value that's quite commonly okay
* on modern hardware.
*
* 4096 is the minimum required to be compatible with newer Advanced Format
* drives (which have 4096 bytes per physical sector), and to be backwards
* compatible with older drives (which have 512 bytes per physical sector).
*/
statbuf->st_blksize = 2048;
statbuf->st_blksize = 4096;
/* Todo: set st_flags to something meaningful. Also provide a wrapper for
* chattr(2).