spdk_dd: If the file size can't be detected, just use the input size

This lets us do testing on things like /dev/zero or /dev/null

Change-Id: Iec3a73c30ad58d13f6af3bf18c0932dcd177f8f2
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12020
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
This commit is contained in:
Ben Walker 2022-03-22 14:33:13 -07:00 committed by Tomasz Zawadzki
parent 2c13441ba8
commit d5f7c9d3f7

View File

@ -644,7 +644,11 @@ dd_open_file(struct dd_target *target, const char *fname, int flags, uint64_t sk
}
target->block_size = spdk_max(spdk_fd_get_blocklen(*fd), 1);
target->total_size = spdk_fd_get_size(*fd);
if (target->total_size == 0) {
target->total_size = g_opts.io_unit_size * g_opts.io_unit_count;
}
if (input == true) {
g_opts.queue_depth = spdk_min(g_opts.queue_depth,