2372 * "xfer_size" of pattern over "len".
2373 *
2374 * big_buf_size is set to an ideal actual-write size for an output
2375 * operation. It may be the same as "len". If it's not, it should
2376 * be an exact multiple of "xfer_size" so we don't get pattern
2377 * breakage until the very end of "len".
2378 */
2379 big_buf_size = len > sbd_write_same_optimal_chunk ?
2380 sbd_write_same_optimal_chunk : (uint32_t)len;
2381 xfer_size = scmd->trans_data_len;
2382
2383 /*
2384 * All transfers should be an integral multiple of the sector size.
2385 */
2386 ASSERT((big_buf_size % xfer_size) == 0);
2387
2388 /*
2389 * Don't sleep for the allocation, and don't make the system
2390 * reclaim memory. Trade higher I/Os if in a low-memory situation.
2391 */
2392 big_buf = kmem_alloc(big_buf_size, KM_NOSLEEP | KM_NORMALPRI);
2393
2394 if (big_buf == NULL) {
2395 /*
2396 * Just send it in terms of of the transmitted data. This
2397 * will be very slow.
2398 */
2399 DTRACE_PROBE1(write__same__low__memory, uint64_t, big_buf_size);
2400 big_buf = scmd->trans_data;
2401 big_buf_size = scmd->trans_data_len;
2402 } else {
2403 /*
2404 * We already ASSERT()ed big_buf_size is an integral multiple
2405 * of xfer_size.
2406 */
2407 for (off = 0; off < big_buf_size; off += xfer_size)
2408 bcopy(scmd->trans_data, big_buf + off, xfer_size);
2409 }
2410
2411 /* Do the actual I/O. Recycle xfer_size now to be write size. */
2412 DTRACE_PROBE1(write__same__io__begin, uint64_t, len);
|
2372 * "xfer_size" of pattern over "len".
2373 *
2374 * big_buf_size is set to an ideal actual-write size for an output
2375 * operation. It may be the same as "len". If it's not, it should
2376 * be an exact multiple of "xfer_size" so we don't get pattern
2377 * breakage until the very end of "len".
2378 */
2379 big_buf_size = len > sbd_write_same_optimal_chunk ?
2380 sbd_write_same_optimal_chunk : (uint32_t)len;
2381 xfer_size = scmd->trans_data_len;
2382
2383 /*
2384 * All transfers should be an integral multiple of the sector size.
2385 */
2386 ASSERT((big_buf_size % xfer_size) == 0);
2387
2388 /*
2389 * Don't sleep for the allocation, and don't make the system
2390 * reclaim memory. Trade higher I/Os if in a low-memory situation.
2391 */
2392 big_buf = kmem_alloc(big_buf_size, KM_NOSLEEP_LAZY);
2393
2394 if (big_buf == NULL) {
2395 /*
2396 * Just send it in terms of of the transmitted data. This
2397 * will be very slow.
2398 */
2399 DTRACE_PROBE1(write__same__low__memory, uint64_t, big_buf_size);
2400 big_buf = scmd->trans_data;
2401 big_buf_size = scmd->trans_data_len;
2402 } else {
2403 /*
2404 * We already ASSERT()ed big_buf_size is an integral multiple
2405 * of xfer_size.
2406 */
2407 for (off = 0; off < big_buf_size; off += xfer_size)
2408 bcopy(scmd->trans_data, big_buf + off, xfer_size);
2409 }
2410
2411 /* Do the actual I/O. Recycle xfer_size now to be write size. */
2412 DTRACE_PROBE1(write__same__io__begin, uint64_t, len);
|