Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
3.0 KiB

  1. /*++
  2. Copyright (c) 1993 Microsoft Corporation
  3. Module Name:
  4. FaultTol.c
  5. Abstract:
  6. The routines in this module help the file systems perform fault
  7. tolerance operation to the FT device drivers.
  8. Author:
  9. David Goebel [DavidGoe] 30-Mar-1993
  10. Revision History:
  11. --*/
  12. #include "FsRtlP.h"
  13. #ifdef ALLOC_PRAGMA
  14. #pragma alloc_text(PAGE, FsRtlBalanceReads)
  15. #pragma alloc_text(PAGE, FsRtlSyncVolumes)
  16. #endif
  17. NTSTATUS
  18. FsRtlBalanceReads (
  19. IN PDEVICE_OBJECT TargetDevice
  20. )
  21. /*++
  22. Routine Description:
  23. This routine signals a device driver that it is now OK to start
  24. balancing reads from a mirrored drive. This is typically called
  25. after the file system determines that a volume is clean.
  26. Arguments:
  27. TargetDevice - Supplies the device to start balanced read from.
  28. Return Value:
  29. NTSTATUS - The result of the operation. This will be
  30. STATUS_INVALID_DEVICE_REQUEST if the volume is not a mirror.
  31. --*/
  32. {
  33. PIRP Irp;
  34. KEVENT Event;
  35. IO_STATUS_BLOCK Iosb;
  36. NTSTATUS Status;
  37. KeInitializeEvent( &Event, NotificationEvent, FALSE );
  38. Irp = IoBuildDeviceIoControlRequest( FT_BALANCED_READ_MODE,
  39. TargetDevice,
  40. NULL,
  41. 0,
  42. NULL,
  43. 0,
  44. FALSE,
  45. &Event,
  46. &Iosb );
  47. if ( Irp == NULL ) {
  48. return STATUS_INSUFFICIENT_RESOURCES;
  49. }
  50. Status = IoCallDriver( TargetDevice, Irp );
  51. if (Status == STATUS_PENDING) {
  52. Status = KeWaitForSingleObject( &Event,
  53. Executive,
  54. KernelMode,
  55. FALSE,
  56. NULL );
  57. ASSERT( Status == STATUS_SUCCESS );
  58. Status = Iosb.Status;
  59. }
  60. return Status;
  61. }
  62. NTSTATUS
  63. FsRtlSyncVolumes (
  64. IN PDEVICE_OBJECT TargetDevice,
  65. IN PLARGE_INTEGER ByteOffset OPTIONAL,
  66. IN PLARGE_INTEGER ByteCount
  67. )
  68. /*++
  69. Routine Description:
  70. This routine signals a device driver that it must sync redundant
  71. members of a mirror from the primary member. This is typically
  72. called after the file system determines that a volume is dirty.
  73. Arguments:
  74. TargetDevice - Supplies the device to sync.
  75. ByteOffset - If specified, gives the location to start syncing
  76. ByteCount - Gives the byte count to sync. Ignored if StartingOffset
  77. not specified.
  78. Return Value:
  79. NTSTATUS - The result of the operation. This will be
  80. STATUS_INVALID_DEVICE_REQUEST if the volume is not a mirror.
  81. --*/
  82. {
  83. UNREFERENCED_PARAMETER (TargetDevice);
  84. UNREFERENCED_PARAMETER (ByteOffset);
  85. UNREFERENCED_PARAMETER (ByteCount);
  86. return STATUS_SUCCESS;
  87. }