ReactOS 0.4.15-dev-7705-g2320c37
workque.c File Reference
#include "cdprocs.h"
Include dependency graph for workque.c:

Go to the source code of this file.

Macros

#define BugCheckFileId   (CDFS_BUG_CHECK_WORKQUE)
 
#define FSP_PER_DEVICE_THRESHOLD   (2)
 

Functions

VOID CdAddToWorkque (_Inout_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp)
 
 _Requires_lock_held_ (_Global_critical_region_)
 

Macro Definition Documentation

◆ BugCheckFileId

#define BugCheckFileId   (CDFS_BUG_CHECK_WORKQUE)

Definition at line 23 of file workque.c.

◆ FSP_PER_DEVICE_THRESHOLD

#define FSP_PER_DEVICE_THRESHOLD   (2)

Definition at line 30 of file workque.c.

Function Documentation

◆ _Requires_lock_held_()

_Requires_lock_held_ ( _Global_critical_region_  )

Definition at line 49 of file workque.c.

76{
77 PAGED_CODE();
78
79 ASSERT_IRP_CONTEXT( IrpContext );
80 ASSERT_IRP( Irp );
81
82 //
83 // Posting is a three step operation. First lock down any buffers
84 // in the Irp. Next cleanup the IrpContext for the post and finally
85 // add this to a workque.
86 //
87
88 CdPrePostIrp( IrpContext, Irp );
89
90 CdAddToWorkque( IrpContext, Irp );
91
92 //
93 // And return to our caller
94 //
95
96 return STATUS_PENDING;
97}
#define PAGED_CODE()
#define ASSERT_IRP(I)
Definition: cddata.h:250
#define ASSERT_IRP_CONTEXT(IC)
Definition: cddata.h:248
VOID CdAddToWorkque(_Inout_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp)
Definition: workque.c:325
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_PENDING
Definition: ntstatus.h:82

◆ CdAddToWorkque()

VOID CdAddToWorkque ( _Inout_ PIRP_CONTEXT  IrpContext,
_Inout_ PIRP  Irp 
)

Definition at line 325 of file workque.c.

349{
351 KIRQL SavedIrql;
353
354 //
355 // Check if this request has an associated file object, and thus volume
356 // device object.
357 //
358
359 if (IrpSp->FileObject != NULL) {
360
361
364 DeviceObject );
365
366 //
367 // Check to see if this request should be sent to the overflow
368 // queue. If not, then send it off to an exworker thread.
369 //
370
371 KeAcquireSpinLock( &Vdo->OverflowQueueSpinLock, &SavedIrql );
372
374
375 //
376 // We cannot currently respond to this IRP so we'll just enqueue it
377 // to the overflow queue on the volume.
378 //
379
381 &IrpContext->WorkQueueItem.List );
382
383 Vdo->OverflowQueueCount += 1;
384
385 KeReleaseSpinLock( &Vdo->OverflowQueueSpinLock, SavedIrql );
386
387 return;
388
389 } else {
390
391 //
392 // We are going to send this Irp to an ex worker thread so up
393 // the count.
394 //
395
396 Vdo->PostedRequestCount += 1;
397
398 KeReleaseSpinLock( &Vdo->OverflowQueueSpinLock, SavedIrql );
399 }
400 }
401
402 //
403 // Send it off.....
404 //
405
406#ifdef _MSC_VER
407#pragma prefast(suppress:28155, "the function prototype is correct")
408#endif
409 ExInitializeWorkItem( &IrpContext->WorkQueueItem,
410 (PVOID)CdFspDispatch,/* ReactOS Change: GCC "assignment from incompatible pointer type" */
411 IrpContext );
412
413#ifdef _MSC_VER
414#pragma prefast(suppress: 28159, "prefast believes this routine is obsolete, but it is ok for CDFS to continue using it")
415#endif
416 ExQueueWorkItem( &IrpContext->WorkQueueItem, CriticalWorkQueue );
417
418 return;
419}
WORKER_THREAD_ROUTINE CdFspDispatch
Definition: cdprocs.h:2040
#define NULL
Definition: types.h:112
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define InsertTailList(ListHead, Entry)
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define FSP_PER_DEVICE_THRESHOLD
Definition: workque.c:24
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:3223
__volatile LONG PostedRequestCount
Definition: cdstruc.h:739
KSPIN_LOCK OverflowQueueSpinLock
Definition: cdstruc.h:760
LIST_ENTRY OverflowQueue
Definition: cdstruc.h:754
ULONG OverflowQueueCount
Definition: cdstruc.h:746
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
Definition: work.c:723
#define ExInitializeWorkItem(Item, Routine, Context)
Definition: exfuncs.h:265
@ CriticalWorkQueue
Definition: extypes.h:189
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793

Referenced by _Requires_lock_held_().