1072 {
1073 uint64_t startoff, endoff, parity_start, parity_end;
1074 uint16_t startoffstripe, endoffstripe, parity, num_data_stripes =
c->chunk_item->num_stripes - 1;
1082
1083 if ((
address +
length -
c->offset) % (num_data_stripes *
c->chunk_item->stripe_length) > 0) {
1085
1089 ERR(
"add_partial_stripe returned %08lx\n",
Status);
1091 }
1092
1094 }
1095
1096 if (
length > 0 && (
address -
c->offset) % (num_data_stripes *
c->chunk_item->stripe_length) > 0) {
1097 uint64_t delta = (num_data_stripes *
c->chunk_item->stripe_length) - ((
address -
c->offset) % (num_data_stripes *
c->chunk_item->stripe_length));
1098
1101 ERR(
"add_partial_stripe returned %08lx\n",
Status);
1103 }
1104
1107 irp_offset += delta;
1109 }
1110
1114 }
1115
1118
1121 parity = (((
address -
c->offset +
pos) / (num_data_stripes *
c->chunk_item->stripe_length)) + num_data_stripes) %
c->chunk_item->num_stripes;
1122
1124 uint16_t stripe = (parity + startoffstripe + 1) %
c->chunk_item->num_stripes;
1126
1129 if (
i == startoffstripe) {
1130 writelen = (
ULONG)
min(
length,
c->chunk_item->stripe_length - (startoff %
c->chunk_item->stripe_length));
1131
1132 stripes[
stripe].start = startoff;
1133 stripes[
stripe].end = startoff + writelen;
1134
1136
1138 break;
1139 } else {
1141
1142 stripes[
stripe].start = startoff - (startoff %
c->chunk_item->stripe_length);
1143 stripes[
stripe].end = stripes[
stripe].start + writelen;
1144
1146
1148 break;
1149 }
1150
1153 }
1154
1156 break;
1157
1158 for (
i = 0;
i < startoffstripe;
i++) {
1159 stripe = (parity +
i + 1) %
c->chunk_item->num_stripes;
1160
1161 stripes[
stripe].start = stripes[
stripe].end = startoff - (startoff %
c->chunk_item->stripe_length) +
c->chunk_item->stripe_length;
1162 }
1163
1164 stripes[parity].start = stripes[parity].end = startoff - (startoff %
c->chunk_item->stripe_length) +
c->chunk_item->stripe_length;
1165
1166 if (
length -
pos >
c->chunk_item->num_stripes * num_data_stripes *
c->chunk_item->stripe_length) {
1167 skip = (
ULONG)(((
length -
pos) / (
c->chunk_item->num_stripes * num_data_stripes *
c->chunk_item->stripe_length)) - 1);
1168
1169 for (
i = 0;
i <
c->chunk_item->num_stripes;
i++) {
1170 stripes[
i].end +=
skip *
c->chunk_item->num_stripes *
c->chunk_item->stripe_length;
1171 }
1172
1173 pos +=
skip * num_data_stripes *
c->chunk_item->num_stripes *
c->chunk_item->stripe_length;
1174 }
1175 }
else if (
length -
pos >=
c->chunk_item->stripe_length * num_data_stripes) {
1176 for (
i = 0;
i <
c->chunk_item->num_stripes;
i++) {
1177 stripes[
i].end +=
c->chunk_item->stripe_length;
1178 }
1179
1180 pos +=
c->chunk_item->stripe_length * num_data_stripes;
1181 } else {
1183
1186 if (endoffstripe ==
i) {
1187 stripes[
stripe].end = endoff + 1;
1188 break;
1189 }
else if (endoffstripe >
i)
1190 stripes[
stripe].end = endoff - (endoff %
c->chunk_item->stripe_length) +
c->chunk_item->stripe_length;
1191
1194 }
1195
1196 break;
1197 }
1198 }
1199
1200 parity_start = 0xffffffffffffffff;
1201 parity_end = 0;
1202
1203 for (
i = 0;
i <
c->chunk_item->num_stripes;
i++) {
1204 if (stripes[
i].
start != 0 || stripes[
i].
end != 0) {
1205 parity_start =
min(stripes[
i].
start, parity_start);
1206 parity_end =
max(stripes[
i].
end, parity_end);
1207 }
1208 }
1209
1210 if (parity_end == parity_start) {
1213 }
1214
1215 parity = (((
address -
c->offset) / (num_data_stripes *
c->chunk_item->stripe_length)) + num_data_stripes) %
c->chunk_item->num_stripes;
1216 stripes[parity].start = parity_start;
1217
1218 parity = (((
address -
c->offset +
length - 1) / (num_data_stripes *
c->chunk_item->stripe_length)) + num_data_stripes) %
c->chunk_item->num_stripes;
1219 stripes[parity].end = parity_end;
1220
1222 if (!log_stripes) {
1223 ERR(
"out of memory\n");
1226 }
1227
1229
1230 for (
i = 0;
i < num_data_stripes;
i++) {
1232 if (!log_stripes[
i].
mdl) {
1233 ERR(
"out of memory\n");
1236 }
1237
1240 }
1241
1243 if (!wtc->parity1) {
1244 ERR(
"out of memory\n");
1247 }
1248
1250 if (!wtc->parity1_mdl) {
1251 ERR(
"out of memory\n");
1254 }
1255
1257
1259 master_mdl =
Irp->MdlAddress;
1262 if (!wtc->scratch) {
1263 ERR(
"out of memory\n");
1266 }
1267
1269
1271 if (!master_mdl) {
1272 ERR(
"out of memory\n");
1275 }
1276
1278
1279 wtc->mdl = master_mdl;
1280 } else {
1282 if (!master_mdl) {
1283 ERR(
"out of memory\n");
1286 }
1287
1289
1295
1297 ERR(
"MmProbeAndLockPages threw exception %08lx\n",
Status);
1300 }
1301
1302 wtc->mdl = master_mdl;
1303 }
1304
1306 parity_pfns = (
PFN_NUMBER*)(wtc->parity1_mdl + 1);
1307
1310
1311 for (
i = 0;
i <
c->chunk_item->num_stripes;
i++) {
1314 if (!stripes[
i].
mdl) {
1315 ERR(
"IoAllocateMdl failed\n");
1318 }
1319 }
1320 }
1321
1323 if (!stripeoff) {
1324 ERR(
"out of memory\n");
1327 }
1328
1330
1332 parity_pos = 0;
1333
1336
1337 parity = (((
address -
c->offset +
pos) / (num_data_stripes *
c->chunk_item->stripe_length)) + num_data_stripes) %
c->chunk_item->num_stripes;
1338
1340 uint16_t stripe = (parity + startoffstripe + 1) %
c->chunk_item->num_stripes;
1342 c->chunk_item->stripe_length - (stripes[
stripe].start %
c->chunk_item->stripe_length)));
1344
1346
1348
1351
1352 stripeoff[
stripe] = writelen;
1354
1356 i = startoffstripe + 1;
1357
1361
1362 if (writelen == 0)
1363 break;
1364
1365 if (writelen > maxwritelen)
1366 maxwritelen = writelen;
1367
1369
1372
1373 stripeoff[
stripe] = writelen;
1375
1378 }
1379
1381
1383 stripeoff[parity] = maxwritelen;
1384 parity_pos = maxwritelen;
1385 }
else if (
length -
pos >=
c->chunk_item->stripe_length * num_data_stripes) {
1387
1391
1393
1396
1397 stripeoff[
stripe] +=
c->chunk_item->stripe_length;
1398 pos +=
c->chunk_item->stripe_length;
1399
1402 }
1403
1405
1407 stripeoff[parity] +=
c->chunk_item->stripe_length;
1408 parity_pos +=
c->chunk_item->stripe_length;
1409 } else {
1411 uint32_t writelen, maxwritelen = 0;
1412
1417
1418 if (writelen == 0)
1419 break;
1420
1421 if (writelen > maxwritelen)
1422 maxwritelen = writelen;
1423
1425
1428
1429 stripeoff[
stripe] += writelen;
1431
1434 }
1435
1437
1439 }
1440 }
1441
1442 for (
i = 0;
i < num_data_stripes;
i++) {
1444
1447 else
1449 }
1450
1452
1454 if (log_stripes) {
1455 for (
i = 0;
i < num_data_stripes;
i++) {
1456 if (log_stripes[
i].
mdl)
1458 }
1459
1461 }
1462
1463 if (stripeoff)
1465
1467}
_Post_satisfies_ static stripe __inline void get_raid0_offset(_In_ uint64_t off, _In_ uint64_t stripe_length, _In_ uint16_t num_stripes, _Out_ uint64_t *stripeoff, _Out_ uint16_t *stripe)
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY _In_ uint8_t _In_ uint64_t _In_ bool file_write
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
VOID NTAPI MmBuildMdlForNonPagedPool(IN PMDL Mdl)
#define MmGetMdlVirtualAddress(_Mdl)
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)