Changeset 4498:569ea17767bf in nginx


Ignore:
Timestamp:
02/28/12 11:09:02 (8 years ago)
Author:
Maxim Dounin <mdounin@…>
Branch:
default
Phase:
public
Convert:
svn:c3fe7df1-7212-e011-8a91-001109144009/trunk@4499
Message:

Workaround for fs_size on ZFS (ticket #46).

ZFS reports incorrect st_blocks until file settles on disk, and this
may take a while (i.e. just after creation of a file the st_blocks value
is incorrect). As a workaround we now use st_blocks only if
st_blocks * 512 > st_size, this should fix ZFS problems while still
preserving accuracy for other filesystems.

The problem had appeared in r3900 (1.0.1).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/os/unix/ngx_files.h

    r4488 r4498  
    181181#define ngx_file_access(sb)      ((sb)->st_mode & 0777)
    182182#define ngx_file_size(sb)        (sb)->st_size
    183 #define ngx_file_fs_size(sb)     ((sb)->st_blocks * 512)
     183#define ngx_file_fs_size(sb)     ngx_max((sb)->st_size, (sb)->st_blocks * 512)
    184184#define ngx_file_mtime(sb)       (sb)->st_mtime
    185185#define ngx_file_uniq(sb)        (sb)->st_ino
     
    277277#define ngx_de_access(dir)       (((dir)->info.st_mode) & 0777)
    278278#define ngx_de_size(dir)         (dir)->info.st_size
    279 #define ngx_de_fs_size(dir)      ((dir)->info.st_blocks * 512)
     279#define ngx_de_fs_size(dir)                                                  \
     280    ngx_max((dir)->info.st_size, (dir)->info.st_blocks * 512)
    280281#define ngx_de_mtime(dir)        (dir)->info.st_mtime
    281282
Note: See TracChangeset for help on using the changeset viewer.