ReactOS  0.4.14-dev-49-gfb4591c
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 }
_In_ PIRP Irp
Definition: csq.h:116
#define PAGED_CODE()
Definition: video.h:57
#define ASSERT_IRP_CONTEXT(IC)
Definition: cddata.h:249
#define STATUS_PENDING
Definition: ntstatus.h:82
#define ASSERT_IRP(I)
Definition: cddata.h:251
VOID CdAddToWorkque(_Inout_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp)
Definition: workque.c:325

◆ 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:2050
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
Definition: work.c:717
_In_ PIRP Irp
Definition: csq.h:116
#define InsertTailList(ListHead, Entry)
ULONG OverflowQueueCount
Definition: cdstruc.h:752
UCHAR KIRQL
Definition: env_spec_w32.h:591
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define ExInitializeWorkItem(Item, Routine, Context)
Definition: exfuncs.h:265
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2867
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
__volatile LONG PostedRequestCount
Definition: cdstruc.h:745
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
KSPIN_LOCK OverflowQueueSpinLock
Definition: cdstruc.h:766
LIST_ENTRY OverflowQueue
Definition: cdstruc.h:760
#define FSP_PER_DEVICE_THRESHOLD
Definition: workque.c:30

Referenced by _Requires_lock_held_().