--------------------- PatchSet 5856 Date: 2003/08/07 07:56:07 Author: serassio Branch: nt-2_5 Tag: (none) Log: Merged latest aufs changes in awin32 Members: src/fs/awin32/aiops.c:1.1.62.12->1.1.62.13 src/fs/awin32/store_asyncufs.h:1.1.62.6->1.1.62.7 src/fs/awin32/store_dir_aufs.c:1.1.62.14->1.1.62.15 Index: squid/src/fs/awin32/aiops.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/awin32/Attic/aiops.c,v retrieving revision 1.1.62.12 retrieving revision 1.1.62.13 diff -u -r1.1.62.12 -r1.1.62.13 --- squid/src/fs/awin32/aiops.c 9 Feb 2003 19:22:45 -0000 1.1.62.12 +++ squid/src/fs/awin32/aiops.c 7 Aug 2003 07:56:07 -0000 1.1.62.13 @@ -1,5 +1,5 @@ /* - * $Id: aiops.c,v 1.1.62.12 2003/02/09 19:22:45 serassio Exp $ + * $Id: aiops.c,v 1.1.62.13 2003/08/07 07:56:07 serassio Exp $ * * DEBUG: section 43 AIOPS * AUTHOR: Stewart Forster @@ -46,6 +46,14 @@ #define RIDICULOUS_LENGTH 4096 +#ifdef AUFS_IO_THREADS +int squidaio_nthreads = AUFS_IO_THREADS; +#else +int squidaio_nthreads = 0; +#endif +int squidaio_magic1 = 1; /* dummy initializer value */ +int squidaio_magic2 = 1; /* real value set in aiops.c */ + enum _squidaio_thread_status { _THREAD_STARTING = 0, _THREAD_WAITING, @@ -300,8 +308,18 @@ /* Create threads and get them to sit in their wait loop */ squidaio_thread_pool = memPoolCreate("aio_thread", sizeof(squidaio_thread_t)); - assert(NUMTHREADS); - for (i = 0; i < NUMTHREADS; i++) { + if (squidaio_nthreads == 0) { + int j = 16; + for (i = 0; i < n_asyncufs_dirs; i++) { + squidaio_nthreads += j; + j = j * 2 / 3; + if (j < 4) + j = 4; + } + } + squidaio_magic1 = squidaio_nthreads * MAGIC1_FACTOR; + squidaio_magic2 = squidaio_nthreads * MAGIC2_FACTOR; + for (i = 0; i < squidaio_nthreads; i++) { threadp = memPoolAlloc(squidaio_thread_pool); threadp->status = _THREAD_STARTING; threadp->current_req = NULL; Index: squid/src/fs/awin32/store_asyncufs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/awin32/Attic/store_asyncufs.h,v retrieving revision 1.1.62.6 retrieving revision 1.1.62.7 diff -u -r1.1.62.6 -r1.1.62.7 --- squid/src/fs/awin32/store_asyncufs.h 11 Nov 2002 19:47:10 -0000 1.1.62.6 +++ squid/src/fs/awin32/store_asyncufs.h 7 Aug 2003 07:56:07 -0000 1.1.62.7 @@ -7,16 +7,21 @@ #ifndef __STORE_ASYNCUFS_H__ #define __STORE_ASYNCUFS_H__ -#ifdef AUFS_IO_THREADS -#define NUMTHREADS AUFS_IO_THREADS -#else -#define NUMTHREADS (Config.cacheSwap.n_configured*16) -#endif +extern int n_asyncufs_dirs; +extern int squidaio_nthreads; +extern int squidaio_magic1; +extern int squidaio_magic2; + +/* Base number of threads if not specified to configure. + * Weighted by number of directories (see aiops.c) */ +#define THREAD_FACTOR 16 /* Queue limit where swapouts are deferred (load calculation) */ -#define MAGIC1 (NUMTHREADS*Config.cacheSwap.n_configured*5) +#define MAGIC1_FACTOR 10 +#define MAGIC1 squidaio_magic1 /* Queue limit where swapins are deferred (open/create fails) */ -#define MAGIC2 (NUMTHREADS*Config.cacheSwap.n_configured*20) +#define MAGIC2_FACTOR 20 +#define MAGIC2 squidaio_magic2 /* Which operations to run async */ #define ASYNC_OPEN 1 Index: squid/src/fs/awin32/store_dir_aufs.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/awin32/Attic/store_dir_aufs.c,v retrieving revision 1.1.62.14 retrieving revision 1.1.62.15 diff -u -r1.1.62.14 -r1.1.62.15 --- squid/src/fs/awin32/store_dir_aufs.c 3 Aug 2003 15:48:27 -0000 1.1.62.14 +++ squid/src/fs/awin32/store_dir_aufs.c 7 Aug 2003 07:56:07 -0000 1.1.62.15 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_aufs.c,v 1.1.62.14 2003/08/03 15:48:27 serassio Exp $ + * $Id: store_dir_aufs.c,v 1.1.62.15 2003/08/07 07:56:07 serassio Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -64,7 +64,7 @@ struct _store_rebuild_data counts; }; -static int n_asyncufs_dirs = 0; +int n_asyncufs_dirs = 0; static int *asyncufs_dir_index = NULL; MemPool *squidaio_state_pool = NULL; MemPool *aufs_qread_pool = NULL;