Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zfs 194 #22

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ZFSin/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <storport.h>
//#include <wdf.h>

#include <sys/zfs_context.h>
#include <sys/wzvol.h>

#include "Trace.h"
Expand Down Expand Up @@ -95,7 +96,6 @@ NTSTATUS DriverEntry(_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING pRe
}

//extern unsigned long spl_hostid;
extern int random_get_bytes(void *ptr, unsigned long len);

void spl_create_hostid(HANDLE h, PUNICODE_STRING pRegistryPath)
{
Expand Down
1 change: 1 addition & 0 deletions ZFSin/zfs/include/sys/wzvol.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ typedef struct _MP_WorkRtnParms {
PEPROCESS pReqProcess;
MpWkRtnAction Action;
ULONG SecondsToDelay;
taskq_ent_t ent;
CHAR pQueueWorkItem[1]; // IO_WORKITEM structure: keep at the end of this block (dynamically allocated).
} MP_WorkRtnParms, *pMP_WorkRtnParms;

Expand Down
1 change: 1 addition & 0 deletions ZFSin/zfs/module/zfs/zfs_windows_zvol.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <wmistr.h>
#include <hbapiwmi.h>
#include <wdf.h>
#include <sys/zfs_context.h>
#include <sys/wzvol.h>

extern PDRIVER_OBJECT WIN_DriverObject;
Expand Down
19 changes: 18 additions & 1 deletion ZFSin/zfs/module/zfs/zfs_windows_zvol_scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
//#include <wmistr.h>
//#include <wdf.h>
//#include <hbaapi.h>
#include <sys/zfs_context.h>
#include <sys/wzvol.h>
//#include <sys/wzvolwmi.h>

Expand Down Expand Up @@ -93,6 +94,7 @@
* when the refcnt reaches 0 it is safe to free the remove lock cb.
*/
extern wzvolDriverInfo STOR_wzvolDriverInfo;
extern taskq_t *storport_taskq;

inline int resolveArrayIndex(int t, int l, int nbL) { return (t * nbL) + l; }
static inline void wzvol_decref_target(wzvolContext* zvc)
Expand Down Expand Up @@ -669,6 +671,21 @@ ScsiOpWrite(
return status;
} // End ScsiOpWrite.

VOID
wzvol_TaskQueuingWkRtn(
__in PVOID pDummy, // Not used.
__in PVOID pWkParms // Parm list pointer.
)
{
pMP_WorkRtnParms pWkRtnParms = (pMP_WorkRtnParms)pWkParms;

UNREFERENCED_PARAMETER(pDummy);
IoUninitializeWorkItem((PIO_WORKITEM)pWkRtnParms->pQueueWorkItem);

taskq_init_ent(&pWkRtnParms->ent);
taskq_dispatch_ent(storport_taskq, wzvol_WkRtn, pWkRtnParms, 0, &pWkRtnParms->ent);
}

/**************************************************************************************************/
/* */
/* This routine does the setup for reading or writing. The reading/writing could be effected */
Expand Down Expand Up @@ -714,7 +731,7 @@ ScsiReadWriteSetup(

// Queue work item, which will run in the System process.

IoQueueWorkItem((PIO_WORKITEM)pWkRtnParms->pQueueWorkItem, wzvol_GeneralWkRtn, DelayedWorkQueue, pWkRtnParms);
IoQueueWorkItem((PIO_WORKITEM)pWkRtnParms->pQueueWorkItem, wzvol_TaskQueuingWkRtn, DelayedWorkQueue, pWkRtnParms);

*pResult = ResultQueued; // Indicate queuing.

Expand Down
1 change: 1 addition & 0 deletions ZFSin/zfs/module/zfs/zfs_windows_zvol_wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
\***************************************************************************/

#include <sys/zfs_context.h>
#include <ntddk.h>
#include <storport.h>
#include <scsiwmi.h>
Expand Down
9 changes: 9 additions & 0 deletions ZFSin/zfs/module/zfs/zvol.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,11 @@

#include "zfs_namecheck.h"

unsigned int zvol_threads = 32;
uint64_t zvol_inhibit_dev = 0;
dev_info_t zfs_dip_real = { 0 };
dev_info_t *zfs_dip = &zfs_dip_real;
taskq_t *storport_taskq;
extern int zfs_major;
extern int zfs_bmajor;

Expand Down Expand Up @@ -2840,7 +2842,13 @@ zvol_busy(void)
int
zvol_init(void)
{
int threads = MIN(MAX(zvol_threads, 1), 1024);

dprintf("zvol_init\n");
storport_taskq = taskq_create(ZVOL_DRIVER, threads, maxclsyspri,
threads * 2, INT_MAX, 0);
if (storport_taskq == NULL)
return (-ENOMEM);
VERIFY(ddi_soft_state_init(&zfsdev_state, sizeof (zfs_soft_state_t),
1) == 0);
#ifdef illumos
Expand All @@ -2858,4 +2866,5 @@ zvol_fini(void)
mutex_destroy(&zfsdev_state_lock);
#endif
ddi_soft_state_fini(&zfsdev_state);
taskq_destroy(storport_taskq);
}