pread() failed для модуля раздачи flv

Igor Sysoev is at rambler-co.ru
Wed Nov 19 15:53:53 MSK 2008


On Wed, Nov 19, 2008 at 04:15:45PM +0530, Александр Кутузов wrote:

> 12936 recvfrom(25, "GET /4c8d31e51bec417fa23c9c7ac2f"..., 8192, 0,  
> NULL, NULL) = 263
> 12936 open("/mnt/flv/4c8d31e51bec417fa23c9c7ac2fc10e5.flv", O_RDONLY)  
> = 27
> 12936 fstat(27, {st_mode=S_IFREG|0664, st_size=22504138, ...}) = 0
> 12936 fcntl(27, F_GETFL)                = 0x8000 (flags O_RDONLY| 
> O_LARGEFILE)
> 12936 fcntl(27, F_SETFL, O_RDONLY|O_DIRECT|O_LARGEFILE) = 0
> 12936 fcntl(27, F_GETFL)                = 0xc000 (flags O_RDONLY| 
> O_DIRECT|O_LARGEFILE)
> 12936 fcntl(27, F_SETFL, O_RDONLY|O_LARGEFILE) = 0
> 12936 pread(27, "\t\0\27\250\2UX\0\0\0\0\27\1\0\0\0\0\0\27\237e 
> \210\200\2\200\0\326-\21\313\374/"..., 283, 9986277) = 283
> 12936 fcntl(27, F_GETFL)                = 0x8000 (flags O_RDONLY| 
> O_LARGEFILE)
> 12936 fcntl(27, F_SETFL, O_RDONLY|O_DIRECT|O_LARGEFILE) = 0
> 12936 pread(27, 0x6146c00, 32768, 9986560) = -1 EINVAL (Invalid  
> argument)

Странно, все параметры выравнены на 512 байт.
Возможно, для xfs размер блока больше.
Можно попробовать прилагаемый патч, который выравнивает на 4096 ? 


-- 
Игорь Сысоев
http://sysoev.ru
-------------- next part --------------
Index: src/core/ngx_output_chain.c
===================================================================
--- src/core/ngx_output_chain.c	(revision 1635)
+++ src/core/ngx_output_chain.c	(working copy)
@@ -13,7 +13,9 @@
 #define NGX_SENDFILE_LIMIT  4096
 #endif
 
+#define NGX_DIRECTIO_BLOCK  4096
 
+
 #define NGX_NONE            1
 
 
@@ -327,7 +329,7 @@
 
     ctx->directio = 1;
 
-    size = (size_t) (in->file_pos - (in->file_pos & ~511));
+    size = (size_t) (in->file_pos - (in->file_pos & ~(NGX_DIRECTIO_BLOCK - 1)));
 
     if (size == 0) {
 
@@ -338,7 +340,7 @@
         size = (size_t) bsize;
 
     } else {
-        size = 512 - size;
+        size = NGX_DIRECTIO_BLOCK - size;
 
         if ((off_t) size > bsize) {
             size = (size_t) bsize;
@@ -413,7 +415,7 @@
          * userland buffer direct usage conjunctly with directio
          */
 
-        b->start = ngx_pmemalign(ctx->pool, size, 512);
+        b->start = ngx_pmemalign(ctx->pool, size, NGX_DIRECTIO_BLOCK);
         if (b->start == NULL) {
             return NGX_ERROR;
         }


More information about the nginx-ru mailing list