]> git.proxmox.com Git - mirror_qemu.git/blobdiff - block/raw-posix.c
block: Switch transfer length bounds to byte-based
[mirror_qemu.git] / block / raw-posix.c
index bef7a671a6af4b778da14ba80f44ad00fb2f1862..8da2f94ec414a8a5ac742a1bf7b9818b7c29564d 100644 (file)
@@ -745,8 +745,8 @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
     if (!fstat(s->fd, &st)) {
         if (S_ISBLK(st.st_mode)) {
             int ret = hdev_get_max_transfer_length(s->fd);
-            if (ret >= 0) {
-                bs->bl.max_transfer_length = ret;
+            if (ret > 0 && ret <= BDRV_REQUEST_MAX_SECTORS) {
+                bs->bl.max_transfer = pow2floor(ret << BDRV_SECTOR_BITS);
             }
         }
     }