00044 :
00045
00046 This routine puts
the Lfs restart area on
the queue of operations to
00047 write to
the file. We
do this by allocating a second restart area
00048 and attaching
it to
the Lfcb. We also allocate a buffer
control
00049 block to use
for this write. We look at
the WaitForIo
boolean to
00050 determine whether
this thread can perform
the I/O. This also indicates
00051 whether
this thread gives up
the Lfcb.
00052
00053 Arguments:
00054
00055 Lfcb -
A pointer to
the log
file control block
for this operation.
00056
00057 ThisRestartSize - This
is the size to use
for the restart area.
00058
00059 WaitForIo - Indicates
if this thread
is to perform
the work.
00060
00061 Return Value:
00062
00063 None.
00064
00065 --*/
00066
00067 {
00068
PLBCB NewLbcb =
NULL;
00069
PLFS_RESTART_AREA NewRestart =
NULL;
00070
00071
PAGED_CODE();
00072
00073
DebugTrace( +1, Dbg,
"LfsWriteLfsRestart: Entered\n", 0 );
00074
DebugTrace( 0, Dbg,
"Lfcb -> %08lx\n", Lfcb );
00075
DebugTrace( 0, Dbg,
"Write Chkdsk -> %04x\n", WriteChkdsk );
00076
DebugTrace( 0, Dbg,
"Restart Size -> %08lx\n", ThisRestartSize );
00077
DebugTrace( 0, Dbg,
"WaitForIo -> %08lx\n", WaitForIo );
00078
00079
00080
00081
00082
00083
try {
00084
00085
PLBCB ActiveLbcb;
00086
00087
00088
00089
00090
00091
00092
LfsAllocateRestartArea( &NewRestart, ThisRestartSize );
00093
00094
00095
00096
00097
00098
00099
LfsAllocateLbcb( Lfcb, &NewLbcb );
00100
SetFlag( NewLbcb->
LbcbFlags, LBCB_RESTART_LBCB );
00101
00102
00103
00104
00105
00106
if (!Lfcb->InitialRestartArea) {
00107
00108 NewLbcb->
FileOffset = Lfcb->SystemPageSize + NewLbcb->
FileOffset;
00109 }
00110
00111 (ULONG)NewLbcb->
Length = ThisRestartSize;
00112
00113 NewLbcb->
PageHeader = (PVOID) Lfcb->RestartArea;
00114
00115
00116
00117
00118
00119 NewLbcb->
LastEndLsn = NewLbcb->
LastLsn = Lfcb->NextRestartLsn;
00120 Lfcb->NextRestartLsn.QuadPart = 1 + Lfcb->NextRestartLsn.QuadPart;
00121
00122
00123
00124
00125
00126 RtlCopyMemory( NewRestart, Lfcb->RestartArea, ThisRestartSize );
00127 Lfcb->RestartArea = NewRestart;
00128
00129 Lfcb->ClientArray =
Add2Ptr( NewRestart, Lfcb->ClientArrayOffset,
PLFS_CLIENT_RECORD );
00130
00131 NewRestart =
NULL;
00132
00133
00134
00135
00136
00137
00138 Lfcb->InitialRestartArea = !Lfcb->InitialRestartArea;
00139
00140
00141
00142
00143
00144 InsertTailList( &Lfcb->LbcbWorkque, &NewLbcb->
WorkqueLinks );
00145
00146
00147
00148
00149
00150
00151
00152
00153
if (!
FlagOn( Lfcb->Flags, LFCB_PACK_LOG )
00154 && !IsListEmpty( &Lfcb->LbcbActive )) {
00155
00156 ActiveLbcb = CONTAINING_RECORD( Lfcb->LbcbActive.Flink,
00157
LBCB,
00158 ActiveLinks );
00159
00160
if (
FlagOn( ActiveLbcb->
LbcbFlags, LBCB_NOT_EMPTY )) {
00161
00162 RemoveEntryList( &ActiveLbcb->
ActiveLinks );
00163
ClearFlag( ActiveLbcb->
LbcbFlags, LBCB_ON_ACTIVE_QUEUE );
00164 }
00165 }
00166
00167
if (WaitForIo) {
00168
00169
LfsFlushLbcb( Lfcb, NewLbcb );
00170 }
00171
00172 } finally {
00173
00174
DebugUnwind( LfsWriteLfsRestart );
00175
00176
if (NewRestart !=
NULL) {
00177
00178
ExFreePool( NewRestart );
00179 }
00180
00181
DebugTrace( -1, Dbg,
"LfsWriteLfsRestart: Exit\n", 0 );
00182 }
00183
00184
return;
00185 }