comparison src/os/win32/ngx_files.c @ 7670:ccb5ff87ab3e

Cache: introduced min_free cache clearing. Clearing cache based on free space left on a file system is expected to allow better disk utilization in some cases, notably when disk space might be also used for something other than nginx cache (including nginx own temporary files) and while loading cache (when cache size might be inaccurate for a while, effectively disabling max_size cache clearing). Based on a patch by Adam Bambuch.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 22 Jun 2020 18:03:00 +0300
parents 061ec464813f
children b0a06c50c1b4
comparison
equal deleted inserted replaced
7669:52b34c3f89b4 7670:ccb5ff87ab3e
653 if (GetDiskFreeSpace((const char *) name, &sc, &bs, &nfree, &ncl) == 0) { 653 if (GetDiskFreeSpace((const char *) name, &sc, &bs, &nfree, &ncl) == 0) {
654 return 512; 654 return 512;
655 } 655 }
656 656
657 return sc * bs; 657 return sc * bs;
658 }
659
660
661 off_t
662 ngx_fs_available(u_char *name)
663 {
664 ULARGE_INTEGER navail;
665
666 if (GetDiskFreeSpaceEx((const char *) name, &navail, NULL, NULL) == 0) {
667 return NGX_MAX_OFF_T_VALUE;
668 }
669
670 return (off_t) navail.QuadPart;
658 } 671 }
659 672
660 673
661 static ngx_int_t 674 static ngx_int_t
662 ngx_win32_check_filename(u_char *name, u_short *u, size_t len) 675 ngx_win32_check_filename(u_char *name, u_short *u, size_t len)