/*
- * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
/* DEBUG: section 79 Squid-side Disk I/O functions. */
#include "squid.h"
-
#include "DiskThreadsDiskFile.h"
#include "DiskThreadsIOStrategy.h"
#include "fde.h"
#include "StatCounters.h"
#include "Store.h"
+/* squidaio_ctrl_t uses explicit alloc()/freeOne().
+ * XXX: convert to MEMPROXY_CLASS() API
+ */
+#include "mem/Pool.h"
+
void
DiskThreadsIOStrategy::init(void)
{
if (initialised)
return;
- squidaio_ctrl_pool = memPoolCreate("aio_ctrl", sizeof(squidaio_ctrl_t));
-
initialised = true;
/*
squidaio_shutdown();
- delete squidaio_ctrl_pool;
-
- squidaio_ctrl_pool = NULL;
-
initialised = false;
}
}
if (ctrlp == NULL)
- continue; /* XXX Should not happen */
+ continue; /* XXX Should not happen */
dlinkDelete(&ctrlp->node, &used_list);
ctrlp->done_handler = NULL;
if (cbdataReferenceValidDone(ctrlp->done_handler_data, &cbdata)) {
- retval = 1; /* Return that we've actually done some work */
+ retval = 1; /* Return that we've actually done some work */
done_callback(ctrlp->fd, cbdata, ctrlp->bufp,
ctrlp->result.aio_return, ctrlp->result.aio_errno);
} else {
if (ctrlp->operation == _AIO_READ)
squidaio_xfree(ctrlp->bufp, ctrlp->len);
- squidaio_ctrl_pool->freeOne(ctrlp);
+ delete ctrlp;
}
return retval;
DiskThreadsIOStrategy::sync()
{
if (!initialised)
- return; /* nothing to do then */
+ return; /* nothing to do then */
/* Flush all pending operations */
debugs(32, 2, "aioSync: flushing pending I/O operations");
}
DiskThreadsIOStrategy::DiskThreadsIOStrategy() :
- initialised(false),
- squidaio_ctrl_pool(NULL)
+ initialised(false)
{}
void
return NULL;
}
- return new DiskThreadsDiskFile (path, this);
+ return new DiskThreadsDiskFile(path);
}
bool
++statCounter.syscalls.disk.unlinks;
aioUnlink(path, NULL, NULL);
}
+