Block layer patches:
- file-posix: Fix max transfer length for non-SCSI-passthrough - iotests: Fix 082 reference output -----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJdKI/aAAoJEH8JsnLIjy/WAFcQAMhTrEPsTwIt9BoqOaEttZIQ zFuWKlBJ8JKRwmuLSVmHOqZXYTgYLAsLW3dVpmZqGrUWvPgUotV1NdG6xn9SjOs8 xaJvDlSM6GEw8OsJeanQl4RlcDf4IfJ60dydyUYuA4LegMqxjnJyxESzhHsZQgvr IoYYLi2gjoZ+Ap9scfEJ1EoAngfFKn2qZ0KGWFpkMslKPKrAQgxbmIrW0R9FFvJR 025PwxI27jBeRtieIozcTEEwVCfl9kuESXXI8iQ8JhuhllddnkEivnpGXiGAqPF7 U+kZjr48Y0OWv6eMCEe9eK5SoofVSELUFgI8UzOrcOBWTJJ9n67CSiBVbWWDAVG0 rGrdC4X6EUIrydmzE7nFWs0QsTTTfTuCd1Z5DTNXh1JI1foBDnYs2pd1UF0wk8EV D5Y8q1N7dHH1GhU3vC2wJMgmm5U34pWPcE8cL3sMvldFBfEotN3pitoFY/vy3cl8 TNfHKqHKxcORvsDopAG0iJxm6DEEz3k9tLgdA6AANR3EvWcDZ+z/XtI+/piqmqyk makM92F0nIa7u48UqQ8YzWbjOVD2KvUvopgLZeQbYAi8PXPkQsbN/ScVLvcVr475 2nFT/ya3QQqK/R2vOAEIISjkz6uIel3ikQXVAZsOASE3tEYdPZTTS08K1Gf3Mnqp /VmSCsczJ9TQ6XQvV+Io =KGS8 -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging Block layer patches: - file-posix: Fix max transfer length for non-SCSI-passthrough - iotests: Fix 082 reference output # gpg: Signature made Fri 12 Jul 2019 14:49:14 BST # gpg: using RSA key 7F09B272C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full] # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * remotes/kevin/tags/for-upstream: file-posix: Use max transfer length/segment count only for SCSI passthrough iotests: Update 082 expected output Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
1316b1ddc8
@ -1038,15 +1038,13 @@ static void raw_reopen_abort(BDRVReopenState *state)
|
||||
s->reopen_state = NULL;
|
||||
}
|
||||
|
||||
static int hdev_get_max_transfer_length(BlockDriverState *bs, int fd)
|
||||
static int sg_get_max_transfer_length(int fd)
|
||||
{
|
||||
#ifdef BLKSECTGET
|
||||
int max_bytes = 0;
|
||||
short max_sectors = 0;
|
||||
if (bs->sg && ioctl(fd, BLKSECTGET, &max_bytes) == 0) {
|
||||
|
||||
if (ioctl(fd, BLKSECTGET, &max_bytes) == 0) {
|
||||
return max_bytes;
|
||||
} else if (!bs->sg && ioctl(fd, BLKSECTGET, &max_sectors) == 0) {
|
||||
return max_sectors << BDRV_SECTOR_BITS;
|
||||
} else {
|
||||
return -errno;
|
||||
}
|
||||
@ -1055,25 +1053,31 @@ static int hdev_get_max_transfer_length(BlockDriverState *bs, int fd)
|
||||
#endif
|
||||
}
|
||||
|
||||
static int hdev_get_max_segments(const struct stat *st)
|
||||
static int sg_get_max_segments(int fd)
|
||||
{
|
||||
#ifdef CONFIG_LINUX
|
||||
char buf[32];
|
||||
const char *end;
|
||||
char *sysfspath;
|
||||
char *sysfspath = NULL;
|
||||
int ret;
|
||||
int fd = -1;
|
||||
int sysfd = -1;
|
||||
long max_segments;
|
||||
struct stat st;
|
||||
|
||||
if (fstat(fd, &st)) {
|
||||
ret = -errno;
|
||||
goto out;
|
||||
}
|
||||
|
||||
sysfspath = g_strdup_printf("/sys/dev/block/%u:%u/queue/max_segments",
|
||||
major(st->st_rdev), minor(st->st_rdev));
|
||||
fd = open(sysfspath, O_RDONLY);
|
||||
if (fd == -1) {
|
||||
major(st.st_rdev), minor(st.st_rdev));
|
||||
sysfd = open(sysfspath, O_RDONLY);
|
||||
if (sysfd == -1) {
|
||||
ret = -errno;
|
||||
goto out;
|
||||
}
|
||||
do {
|
||||
ret = read(fd, buf, sizeof(buf) - 1);
|
||||
ret = read(sysfd, buf, sizeof(buf) - 1);
|
||||
} while (ret == -1 && errno == EINTR);
|
||||
if (ret < 0) {
|
||||
ret = -errno;
|
||||
@ -1090,8 +1094,8 @@ static int hdev_get_max_segments(const struct stat *st)
|
||||
}
|
||||
|
||||
out:
|
||||
if (fd != -1) {
|
||||
close(fd);
|
||||
if (sysfd != -1) {
|
||||
close(sysfd);
|
||||
}
|
||||
g_free(sysfspath);
|
||||
return ret;
|
||||
@ -1103,19 +1107,17 @@ out:
|
||||
static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
|
||||
{
|
||||
BDRVRawState *s = bs->opaque;
|
||||
struct stat st;
|
||||
|
||||
if (!fstat(s->fd, &st)) {
|
||||
if (S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode)) {
|
||||
int ret = hdev_get_max_transfer_length(bs, s->fd);
|
||||
if (ret > 0 && ret <= BDRV_REQUEST_MAX_BYTES) {
|
||||
bs->bl.max_transfer = pow2floor(ret);
|
||||
}
|
||||
ret = hdev_get_max_segments(&st);
|
||||
if (ret > 0) {
|
||||
bs->bl.max_transfer = MIN(bs->bl.max_transfer,
|
||||
ret * getpagesize());
|
||||
}
|
||||
if (bs->sg) {
|
||||
int ret = sg_get_max_transfer_length(s->fd);
|
||||
|
||||
if (ret > 0 && ret <= BDRV_REQUEST_MAX_BYTES) {
|
||||
bs->bl.max_transfer = pow2floor(ret);
|
||||
}
|
||||
|
||||
ret = sg_get_max_segments(s->fd);
|
||||
if (ret > 0) {
|
||||
bs->bl.max_transfer = MIN(bs->bl.max_transfer, ret * getpagesize());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ Supported options:
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -70,7 +70,7 @@ Supported options:
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -93,7 +93,7 @@ Supported options:
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -116,7 +116,7 @@ Supported options:
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -139,7 +139,7 @@ Supported options:
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -162,7 +162,7 @@ Supported options:
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -185,7 +185,7 @@ Supported options:
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -208,7 +208,7 @@ Supported options:
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -246,7 +246,7 @@ Supported qcow2 options:
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -327,7 +327,7 @@ Supported options:
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -350,7 +350,7 @@ Supported options:
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -373,7 +373,7 @@ Supported options:
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -396,7 +396,7 @@ Supported options:
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -419,7 +419,7 @@ Supported options:
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -442,7 +442,7 @@ Supported options:
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -465,7 +465,7 @@ Supported options:
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -488,7 +488,7 @@ Supported options:
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -526,7 +526,7 @@ Supported qcow2 options:
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -618,7 +618,7 @@ Creation options for 'qcow2':
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -642,7 +642,7 @@ Creation options for 'qcow2':
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -666,7 +666,7 @@ Creation options for 'qcow2':
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -690,7 +690,7 @@ Creation options for 'qcow2':
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -714,7 +714,7 @@ Creation options for 'qcow2':
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -738,7 +738,7 @@ Creation options for 'qcow2':
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -762,7 +762,7 @@ Creation options for 'qcow2':
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -786,7 +786,7 @@ Creation options for 'qcow2':
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
@ -827,7 +827,7 @@ Creation options for 'qcow2':
|
||||
backing_file=<str> - File name of a base image
|
||||
backing_fmt=<str> - Image format of the base image
|
||||
cluster_size=<size> - qcow2 cluster size
|
||||
compat=<str> - Compatibility level (0.10 or 1.1)
|
||||
compat=<str> - Compatibility level (v2 [0.10] or v3 [1.1])
|
||||
data_file=<str> - File name of an external data file
|
||||
data_file_raw=<bool (on/off)> - The external data file must stay valid as a raw image
|
||||
encrypt.cipher-alg=<str> - Name of encryption cipher algorithm
|
||||
|
Loading…
x
Reference in New Issue
Block a user