Changeset 4516:b927410d9638 in nginx


Ignore:
Timestamp:
03/05/12 13:20:40 (8 years ago)
Author:
Maxim Dounin <mdounin@…>
Branch:
stable-1.0
Phase:
public
Convert:
svn:c3fe7df1-7212-e011-8a91-001109144009/branches/stable-1.0@4517
Message:

Merge of r4499: 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

    r4412 r4516  
    160160#define ngx_file_access(sb)      ((sb)->st_mode & 0777)
    161161#define ngx_file_size(sb)        (sb)->st_size
    162 #define ngx_file_fs_size(sb)     ((sb)->st_blocks * 512)
     162#define ngx_file_fs_size(sb)     ngx_max((sb)->st_size, (sb)->st_blocks * 512)
    163163#define ngx_file_mtime(sb)       (sb)->st_mtime
    164164#define ngx_file_uniq(sb)        (sb)->st_ino
     
    256256#define ngx_de_access(dir)       (((dir)->info.st_mode) & 0777)
    257257#define ngx_de_size(dir)         (dir)->info.st_size
    258 #define ngx_de_fs_size(dir)      ((dir)->info.st_blocks * 512)
     258#define ngx_de_fs_size(dir)                                                  \
     259    ngx_max((dir)->info.st_size, (dir)->info.st_blocks * 512)
    259260#define ngx_de_mtime(dir)        (dir)->info.st_mtime
    260261
Note: See TracChangeset for help on using the changeset viewer.