Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

faulttol.c

Go to the documentation of this file.
00001 /*++ 00002 00003 Copyright (c) 1993 Microsoft Corporation 00004 00005 Module Name: 00006 00007 FaultTol.c 00008 00009 Abstract: 00010 00011 The routines in this module help the file systems perform fault 00012 tolerance operation to the FT device drivers. 00013 00014 Author: 00015 00016 David Goebel [DavidGoe] 30-Mar-1993 00017 00018 Revision History: 00019 00020 --*/ 00021 00022 #include "FsRtlP.h" 00023 00024 #ifdef ALLOC_PRAGMA 00025 #pragma alloc_text(PAGE, FsRtlBalanceReads) 00026 #pragma alloc_text(PAGE, FsRtlSyncVolumes) 00027 #endif 00028 00029 00030 NTSTATUS 00031 FsRtlBalanceReads ( 00032 IN PDEVICE_OBJECT TargetDevice 00033 ) 00034 00035 /*++ 00036 00037 Routine Description: 00038 00039 This routine signals a device driver that it is now OK to start 00040 balancing reads from a mirrored drive. This is typically called 00041 after the file system determines that a volume is clean. 00042 00043 Arguments: 00044 00045 TargetDevice - Supplies the device to start balanced read from. 00046 00047 Return Value: 00048 00049 NTSTATUS - The result of the operation. This will be 00050 STATUS_INVALID_DEVICE_REQUEST is the volume is not a mirror. 00051 00052 --*/ 00053 00054 { 00055 PIRP Irp; 00056 KEVENT Event; 00057 IO_STATUS_BLOCK Iosb; 00058 NTSTATUS Status; 00059 00060 KeInitializeEvent( &Event, NotificationEvent, FALSE ); 00061 00062 Irp = IoBuildDeviceIoControlRequest( FT_BALANCED_READ_MODE, 00063 TargetDevice, 00064 NULL, 00065 0, 00066 NULL, 00067 0, 00068 FALSE, 00069 &Event, 00070 &Iosb ); 00071 00072 if ( Irp == NULL ) { 00073 00074 return STATUS_INSUFFICIENT_RESOURCES; 00075 } 00076 00077 Status = IoCallDriver( TargetDevice, Irp ); 00078 00079 00080 if (Status == STATUS_PENDING) { 00081 Status = KeWaitForSingleObject( &Event, 00082 Executive, 00083 KernelMode, 00084 FALSE, 00085 NULL ); 00086 00087 ASSERT( Status == STATUS_SUCCESS ); 00088 00089 Status = Iosb.Status; 00090 } 00091 00092 return Status; 00093 } 00094 00095 NTSTATUS 00096 FsRtlSyncVolumes ( 00097 IN PDEVICE_OBJECT TargetDevice, 00098 IN PLARGE_INTEGER ByteOffset OPTIONAL, 00099 IN PLARGE_INTEGER ByteCount 00100 ) 00101 00102 /*++ 00103 00104 Routine Description: 00105 00106 This routine signals a device driver that it must sync redundant 00107 members of a mirror from the primary member. This is typically 00108 called after the file system determines that a volume is dirty. 00109 00110 Arguments: 00111 00112 TargetDevice - Supplies the device to sync. 00113 00114 ByteOffset - If specified, gives the location to start syncing 00115 00116 ByteCount - Gives the byte count to sync. Ignored if StartingOffset 00117 not specified. 00118 00119 Return Value: 00120 00121 NTSTATUS - The result of the operation. This will be 00122 STATUS_INVALID_DEVICE_REQUEST is the volume is not a mirror. 00123 00124 --*/ 00125 00126 { 00127 00128 #if 0 // Mike Glass says we no longer need to do this. 3/3/94 00129 00130 PIRP Irp; 00131 KEVENT Event; 00132 IO_STATUS_BLOCK Iosb; 00133 NTSTATUS Status; 00134 BOOLEAN RangeSpecified; 00135 FT_SYNC_INFORMATION SyncInfo; 00136 00137 KeInitializeEvent( &Event, NotificationEvent, FALSE ); 00138 00139 // 00140 // If the user specified a range, capture it. 00141 // 00142 00143 if (ARGUMENT_PRESENT(ByteOffset)) { 00144 00145 SyncInfo.ByteOffset = *ByteOffset; 00146 SyncInfo.ByteCount = *ByteCount; 00147 00148 RangeSpecified = TRUE; 00149 00150 } else { 00151 00152 RangeSpecified = FALSE; 00153 } 00154 00155 Irp = IoBuildDeviceIoControlRequest( FT_SYNC_REDUNDANT_COPY, 00156 TargetDevice, 00157 RangeSpecified ? &SyncInfo : NULL, 00158 RangeSpecified ? 00159 sizeof(FT_SYNC_INFORMATION) : 0, 00160 NULL, 00161 0, 00162 FALSE, 00163 &Event, 00164 &Iosb ); 00165 00166 if ( Irp == NULL ) { 00167 00168 return STATUS_INSUFFICIENT_RESOURCES; 00169 } 00170 00171 Status = IoCallDriver( TargetDevice, Irp ); 00172 00173 00174 if (Status == STATUS_PENDING) { 00175 Status = KeWaitForSingleObject( &Event, 00176 Executive, 00177 KernelMode, 00178 FALSE, 00179 NULL ); 00180 00181 ASSERT( Status == STATUS_SUCCESS ); 00182 00183 Status = Iosb.Status; 00184 } 00185 00186 return Status; 00187 #else 00188 return STATUS_SUCCESS; 00189 00190 #endif //0 00191 } 00192 00193

Generated on Sat May 15 19:39:59 2004 for test by doxygen 1.3.7