---------------------
PatchSet 8057 
Date: 2006/05/27 19:11:08
Author: serassio
Branch: nt
Tag: (none) 
Log:
Synced awin32 with latest aufs changes

Members: 
	src/fs/Makefile.am:1.3.30.4->1.3.30.5 
	src/fs/aufs/store_dir_aufs.c:1.35.8.3->1.35.8.4 
	src/fs/awin32/aiops.c:1.1.88.1->1.1.88.2 
	src/fs/awin32/async_io.c:1.1.88.1->1.1.88.2 
	src/fs/awin32/async_io.h:1.1->1.1.2.1 
	src/fs/awin32/store_asyncufs.h:1.1.88.1->1.1.88.2 
	src/fs/awin32/store_dir_aufs.c:1.1.88.2->1.1.88.3 
	src/fs/awin32/store_io_aufs.c:1.1.88.1->1.1.88.2 

Index: squid/src/fs/Makefile.am
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/fs/Makefile.am,v
retrieving revision 1.3.30.4
retrieving revision 1.3.30.5
diff -u -r1.3.30.4 -r1.3.30.5
--- squid/src/fs/Makefile.am	26 May 2006 20:27:15 -0000	1.3.30.4
+++ squid/src/fs/Makefile.am	27 May 2006 19:11:08 -0000	1.3.30.5
@@ -14,7 +14,7 @@
 libaufs_a_SOURCES = aufs/aiops.c aufs/async_io.c aufs/store_asyncufs.h \
 	aufs/store_dir_aufs.c aufs/store_io_aufs.c aufs/async_io.h
 libawin32_a_SOURCES = awin32/aiops.c awin32/async_io.c awin32/store_asyncufs.h \
-	awin32/store_dir_aufs.c awin32/store_io_aufs.c
+	awin32/store_dir_aufs.c awin32/store_io_aufs.c awin32/async_io.h
 libcoss_a_SOURCES = coss/store_coss.h   coss/store_io_coss.c coss/store_dir_coss.c \
 	coss/async_io.c coss/async_io.h
 libdiskd_a_SOURCES = diskd/diskd.c diskd/store_dir_diskd.c diskd/store_diskd.h \
Index: squid/src/fs/aufs/store_dir_aufs.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/fs/aufs/store_dir_aufs.c,v
retrieving revision 1.35.8.3
retrieving revision 1.35.8.4
diff -u -r1.35.8.3 -r1.35.8.4
--- squid/src/fs/aufs/store_dir_aufs.c	27 May 2006 18:29:15 -0000	1.35.8.3
+++ squid/src/fs/aufs/store_dir_aufs.c	27 May 2006 19:11:09 -0000	1.35.8.4
@@ -1892,9 +1892,9 @@
     sd->statfs = storeAufsDirStats;
     sd->maintainfs = storeAufsDirMaintain;
     sd->checkobj = storeAufsDirCheckObj;
-    sd->checkload = storeAufsDirCheckLoadAv;
     sd->refobj = storeAufsDirRefObj;
     sd->unrefobj = storeAufsDirUnrefObj;
+    sd->checkload = storeAufsDirCheckLoadAv;
     sd->callback = aioCheckCallbacks;
     sd->sync = aioSync;
     sd->obj.create = storeAufsCreate;
Index: squid/src/fs/awin32/aiops.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/fs/awin32/Attic/aiops.c,v
retrieving revision 1.1.88.1
retrieving revision 1.1.88.2
diff -u -r1.1.88.1 -r1.1.88.2
--- squid/src/fs/awin32/aiops.c	16 May 2006 21:06:06 -0000	1.1.88.1
+++ squid/src/fs/awin32/aiops.c	27 May 2006 19:11:09 -0000	1.1.88.2
@@ -1,5 +1,5 @@
 /*
- * $Id: aiops.c,v 1.1.88.1 2006/05/16 21:06:06 serassio Exp $
+ * $Id: aiops.c,v 1.1.88.2 2006/05/27 19:11:09 serassio Exp $
  *
  * DEBUG: section 43    AIOPS
  * AUTHOR: Stewart Forster <slf@connect.com.au>
@@ -34,7 +34,7 @@
 
 #include "squid.h"
 #include <windows.h>
-#include "store_asyncufs.h"
+#include "async_io.h"
 
 #include	<stdio.h>
 #include	<sys/types.h>
@@ -742,15 +742,15 @@
 static void
 squidaio_do_read(squidaio_request_t * requestp)
 {
-    lseek(requestp->fd, requestp->offset, requestp->whence);
 #ifdef _SQUID_MSWIN_
+    lseek(requestp->fd, requestp->offset, requestp->whence);
     if (!ReadFile((HANDLE)_get_osfhandle(requestp->fd), requestp->bufferp, 
 	requestp->buflen, (LPDWORD)&requestp->ret, NULL)) {
 	WIN32_maperror(GetLastError());
 	requestp->ret = -1;
     }
 #else
-    requestp->ret = read(requestp->fd, requestp->bufferp, requestp->buflen);
+    requestp->ret = pread(requestp->fd, requestp->bufferp, requestp->buflen, requestp->offset);
 #endif
     requestp->err = errno;
 }
@@ -786,7 +786,7 @@
 	requestp->ret = -1;
     }
 #else
-    requestp->ret = write(requestp->fd, requestp->bufferp, requestp->buflen);
+    requestp->ret = pwrite(requestp->fd, requestp->bufferp, requestp->buflen, requestp->offset);
 #endif
     requestp->err = errno;
 }
@@ -1050,7 +1050,7 @@
 {
     squidaio_thread_t *threadp;
     int i;
-    
+
     if (!squidaio_initialised)
 	return;
 
Index: squid/src/fs/awin32/async_io.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/fs/awin32/Attic/async_io.c,v
retrieving revision 1.1.88.1
retrieving revision 1.1.88.2
diff -u -r1.1.88.1 -r1.1.88.2
--- squid/src/fs/awin32/async_io.c	16 May 2006 21:06:06 -0000	1.1.88.1
+++ squid/src/fs/awin32/async_io.c	27 May 2006 19:11:09 -0000	1.1.88.2
@@ -1,6 +1,6 @@
 
 /*
- * $Id: async_io.c,v 1.1.88.1 2006/05/16 21:06:06 serassio Exp $
+ * $Id: async_io.c,v 1.1.88.2 2006/05/27 19:11:09 serassio Exp $
  *
  * DEBUG: section 32    Asynchronous Disk I/O
  * AUTHOR: Pete Bentley <pete@demon.net>
@@ -35,7 +35,7 @@
  */
 
 #include "squid.h"
-#include "store_asyncufs.h"
+#include "async_io.h"
 
 #define _AIO_OPEN	0
 #define _AIO_READ	1
--- /dev/null	Wed Feb 14 01:15:53 2007
+++ squid/src/fs/awin32/async_io.h	Wed Feb 14 01:15:54 2007
@@ -0,0 +1,70 @@
+/*
+ * store_aufs.h
+ *
+ * Internal declarations for the aufs routines
+ */
+
+#ifndef __ASYNC_IO_H__
+#define __ASYNC_IO_H__
+
+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_FACTOR 10
+#define MAGIC1 squidaio_magic1
+/* Queue limit where swapins are deferred (open/create fails) */
+#define MAGIC2_FACTOR 20
+#define MAGIC2 squidaio_magic2
+
+struct _squidaio_result_t {
+    int aio_return;
+    int aio_errno;
+    void *_data;		/* Internal housekeeping */
+    void *data;			/* Available to the caller */
+};
+
+typedef struct _squidaio_result_t squidaio_result_t;
+
+typedef void AIOCB(int fd, void *cbdata, const char *buf, int aio_return, int aio_errno);
+
+void squidaio_init(void);
+void squidaio_shutdown(void);
+int squidaio_cancel(squidaio_result_t *);
+int squidaio_open(const char *, int, mode_t, squidaio_result_t *);
+int squidaio_read(int, char *, int, off_t, int, squidaio_result_t *);
+int squidaio_write(int, char *, int, off_t, int, squidaio_result_t *);
+int squidaio_close(int, squidaio_result_t *);
+int squidaio_stat(const char *, struct stat *, squidaio_result_t *);
+int squidaio_unlink(const char *, squidaio_result_t *);
+int squidaio_truncate(const char *, off_t length, squidaio_result_t *);
+int squidaio_opendir(const char *, squidaio_result_t *);
+squidaio_result_t *squidaio_poll_done(void);
+int squidaio_operations_pending(void);
+int squidaio_sync(void);
+int squidaio_get_queue_len(void);
+void *squidaio_xmalloc(int size);
+void squidaio_xfree(void *p, int size);
+void squidaio_stats(StoreEntry *);
+
+void aioInit(void);
+void aioDone(void);
+void aioCancel(int);
+void aioOpen(const char *, int, mode_t, AIOCB *, void *);
+void aioClose(int);
+void aioWrite(int, off_t offset, char *, int size, AIOCB *, void *, FREE *);
+void aioRead(int, off_t offset, int size, AIOCB *, void *);
+void aioStat(char *, struct stat *, AIOCB *, void *);
+void aioUnlink(const char *, AIOCB *, void *);
+void aioTruncate(const char *, off_t length, AIOCB *, void *);
+int aioCheckCallbacks(SwapDir *);
+void aioSync(SwapDir *);
+int aioQueueSize(void);
+
+#endif
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.88.1
retrieving revision 1.1.88.2
diff -u -r1.1.88.1 -r1.1.88.2
--- squid/src/fs/awin32/store_asyncufs.h	16 May 2006 21:06:06 -0000	1.1.88.1
+++ squid/src/fs/awin32/store_asyncufs.h	27 May 2006 19:11:09 -0000	1.1.88.2
@@ -7,22 +7,6 @@
 #ifndef __STORE_ASYNCUFS_H__
 #define __STORE_ASYNCUFS_H__
 
-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_FACTOR 10
-#define MAGIC1 squidaio_magic1
-/* Queue limit where swapins are deferred (open/create fails) */
-#define MAGIC2_FACTOR 20
-#define MAGIC2 squidaio_magic2
-
 /* Which operations to run async */
 #define ASYNC_OPEN 1
 #define ASYNC_CLOSE 0
@@ -30,50 +14,6 @@
 #define ASYNC_WRITE 0
 #define ASYNC_READ 1
 
-struct _squidaio_result_t {
-    int aio_return;
-    int aio_errno;
-    void *_data;		/* Internal housekeeping */
-    void *data;			/* Available to the caller */
-};
-
-typedef struct _squidaio_result_t squidaio_result_t;
-
-typedef void AIOCB(int fd, void *cbdata, const char *buf, int aio_return, int aio_errno);
-
-void squidaio_init(void);
-void squidaio_shutdown(void);
-int squidaio_cancel(squidaio_result_t *);
-int squidaio_open(const char *, int, mode_t, squidaio_result_t *);
-int squidaio_read(int, char *, int, off_t, int, squidaio_result_t *);
-int squidaio_write(int, char *, int, off_t, int, squidaio_result_t *);
-int squidaio_close(int, squidaio_result_t *);
-int squidaio_stat(const char *, struct stat *, squidaio_result_t *);
-int squidaio_unlink(const char *, squidaio_result_t *);
-int squidaio_truncate(const char *, off_t length, squidaio_result_t *);
-int squidaio_opendir(const char *, squidaio_result_t *);
-squidaio_result_t *squidaio_poll_done(void);
-int squidaio_operations_pending(void);
-int squidaio_sync(void);
-int squidaio_get_queue_len(void);
-void *squidaio_xmalloc(int size);
-void squidaio_xfree(void *p, int size);
-void squidaio_stats(StoreEntry *);
-
-void aioInit(void);
-void aioDone(void);
-void aioCancel(int);
-void aioOpen(const char *, int, mode_t, AIOCB *, void *);
-void aioClose(int);
-void aioWrite(int, off_t offset, char *, int size, AIOCB *, void *, FREE *);
-void aioRead(int, off_t offset, int size, AIOCB *, void *);
-void aioStat(char *, struct stat *, AIOCB *, void *);
-void aioUnlink(const char *, AIOCB *, void *);
-void aioTruncate(const char *, off_t length, AIOCB *, void *);
-int aioCheckCallbacks(SwapDir *);
-void aioSync(SwapDir *);
-int aioQueueSize(void);
-
 struct _squidaioinfo_t {
     int swaplog_fd;
     int l1;
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.88.2
retrieving revision 1.1.88.3
diff -u -r1.1.88.2 -r1.1.88.3
--- squid/src/fs/awin32/store_dir_aufs.c	22 May 2006 18:31:50 -0000	1.1.88.2
+++ squid/src/fs/awin32/store_dir_aufs.c	27 May 2006 19:11:09 -0000	1.1.88.3
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_aufs.c,v 1.1.88.2 2006/05/22 18:31:50 serassio Exp $
+ * $Id: store_dir_aufs.c,v 1.1.88.3 2006/05/27 19:11:09 serassio Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -35,6 +35,7 @@
 
 #include "squid.h"
 
+#include "async_io.h"
 #include "store_asyncufs.h"
 
 #define DefaultLevelOneDirs     16
@@ -106,6 +107,7 @@
 static STDUMP storeAufsDirDump;
 static STMAINTAINFS storeAufsDirMaintain;
 static STCHECKOBJ storeAufsDirCheckObj;
+static STCHECKLOADAV storeAufsDirCheckLoadAv;
 static STREFOBJ storeAufsDirRefObj;
 static STUNREFOBJ storeAufsDirUnrefObj;
 static QS rev_int_sort;
@@ -1599,22 +1601,19 @@
 int
 storeAufsDirCheckObj(SwapDir * SD, const StoreEntry * e)
 {
-    int loadav;
-    int ql;
+    return 1;
+}
+
+int
+storeAufsDirCheckLoadAv(SwapDir * SD, store_op_t op)
+{
+    int loadav, ql;
 
-#if OLD_UNUSED_CODE
-    if (storeAufsDirExpiredReferenceAge(SD) < 300) {
-	debug(47, 3) ("storeAufsDirCheckObj: NO: LRU Age = %d\n",
-	    storeAufsDirExpiredReferenceAge(SD));
-	/* store_check_cachable_hist.no.lru_age_too_low++; */
-	return -1;
-    }
-#endif
     ql = aioQueueSize();
-    if (ql == 0)
-	loadav = 0;
+    if (ql == 0) {
+	return 1;
+    }
     loadav = ql * 1000 / MAGIC1;
-    debug(47, 9) ("storeAufsDirCheckObj: load=%d\n", loadav);
     return loadav;
 }
 
@@ -1903,6 +1902,7 @@
     sd->checkobj = storeAufsDirCheckObj;
     sd->refobj = storeAufsDirRefObj;
     sd->unrefobj = storeAufsDirUnrefObj;
+    sd->checkload = storeAufsDirCheckLoadAv;
     sd->callback = aioCheckCallbacks;
     sd->sync = aioSync;
     sd->obj.create = storeAufsCreate;
Index: squid/src/fs/awin32/store_io_aufs.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/fs/awin32/Attic/store_io_aufs.c,v
retrieving revision 1.1.88.1
retrieving revision 1.1.88.2
diff -u -r1.1.88.1 -r1.1.88.2
--- squid/src/fs/awin32/store_io_aufs.c	16 May 2006 21:06:06 -0000	1.1.88.1
+++ squid/src/fs/awin32/store_io_aufs.c	27 May 2006 19:11:09 -0000	1.1.88.2
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_io_aufs.c,v 1.1.88.1 2006/05/16 21:06:06 serassio Exp $
+ * $Id: store_io_aufs.c,v 1.1.88.2 2006/05/27 19:11:09 serassio Exp $
  *
  * DEBUG: section 79    Storage Manager awin32 Interface
  * AUTHOR: Robert Collins
@@ -34,6 +34,7 @@
  */
 
 #include "squid.h"
+#include "async_io.h"
 #include "store_asyncufs.h"
 
 #if ASYNC_READ
@@ -475,8 +476,8 @@
 	return;
     debug(79, 9) ("%s:%d\n", __FILE__, __LINE__);
 #if ASYNC_CLOSE
-    aioClose(fd);
     fd_close(fd);
+    aioClose(fd);
 #else
     aioCancel(fd);
     file_close(fd);
