Displaying 7 results from an estimated 7 matches for "string_get_size".
2015 Mar 13
0
[PATCH] sd, mmc, virtio_blk, string_helpers: fix block size units
On 6 March 2015 at 03:47, James Bottomley
<James.Bottomley at hansenpartnership.com> wrote:
> From: James Bottomley <JBottomley at Parallels.com>
>
> The current string_get_size() overflows when the device size goes over
> 2^64 bytes because the string helper routine computes the suffix from
> the size in bytes. However, the entirety of Linux thinks in terms of
> blocks, not bytes, so this will artificially induce an overflow on very
> large devices. Fix this...
2015 Mar 13
0
[PATCH] sd, mmc, virtio_blk, string_helpers: fix block size units
On 6 March 2015 at 03:47, James Bottomley
<James.Bottomley at hansenpartnership.com> wrote:
> From: James Bottomley <JBottomley at Parallels.com>
>
> The current string_get_size() overflows when the device size goes over
> 2^64 bytes because the string helper routine computes the suffix from
> the size in bytes. However, the entirety of Linux thinks in terms of
> blocks, not bytes, so this will artificially induce an overflow on very
> large devices. Fix this...
2017 Jul 26
2
[PATCH] virtio_blk: fix incorrect message when disk is resized
...cap_str_2[10], cap_str_10[10];
char *envp[] = { "RESIZE=1", NULL };
+ unsigned long long nblocks;
u64 capacity;
/* Host must always specify the capacity. */
@@ -393,16 +394,19 @@ static void virtblk_config_changed_work(struct work_struct *work)
capacity = (sector_t)-1;
}
- string_get_size(capacity, queue_logical_block_size(q),
+ nblocks = DIV_ROUND_UP_ULL(capacity, queue_logical_block_size(q) >> 9);
+
+ string_get_size(nblocks, queue_logical_block_size(q),
STRING_UNITS_2, cap_str_2, sizeof(cap_str_2));
- string_get_size(capacity, queue_logical_block_size(q),
+ string_get_s...
2017 Jul 26
2
[PATCH] virtio_blk: fix incorrect message when disk is resized
...cap_str_2[10], cap_str_10[10];
char *envp[] = { "RESIZE=1", NULL };
+ unsigned long long nblocks;
u64 capacity;
/* Host must always specify the capacity. */
@@ -393,16 +394,19 @@ static void virtblk_config_changed_work(struct work_struct *work)
capacity = (sector_t)-1;
}
- string_get_size(capacity, queue_logical_block_size(q),
+ nblocks = DIV_ROUND_UP_ULL(capacity, queue_logical_block_size(q) >> 9);
+
+ string_get_size(nblocks, queue_logical_block_size(q),
STRING_UNITS_2, cap_str_2, sizeof(cap_str_2));
- string_get_size(capacity, queue_logical_block_size(q),
+ string_get_s...
2017 Aug 04
0
[PATCH] virtio_blk: fix incorrect message when disk is resized
...] = { "RESIZE=1", NULL };
> + unsigned long long nblocks;
> u64 capacity;
>
> /* Host must always specify the capacity. */
> @@ -393,16 +394,19 @@ static void virtblk_config_changed_work(struct work_struct *work)
> capacity = (sector_t)-1;
> }
>
> - string_get_size(capacity, queue_logical_block_size(q),
> + nblocks = DIV_ROUND_UP_ULL(capacity, queue_logical_block_size(q) >> 9);
> +
> + string_get_size(nblocks, queue_logical_block_size(q),
> STRING_UNITS_2, cap_str_2, sizeof(cap_str_2));
> - string_get_size(capacity, queue_logical_bloc...
2011 Jan 27
1
[PATCH] virtio_blk: allow re-reading config space at runtime
...with warning. */
> + if ((sector_t)capacity != capacity) {
> + dev_warn(&vdev->dev, "Capacity %llu too large: truncating\n",
> + (unsigned long long)capacity);
> + capacity = (sector_t)-1;
> + }
> +
> + size = capacity * queue_logical_block_size(q);
> + string_get_size(size, STRING_UNITS_2, cap_str_2, sizeof(cap_str_2));
> + string_get_size(size, STRING_UNITS_10, cap_str_10, sizeof(cap_str_10));
> +
> + dev_notice(&vdev->dev,
> + "new size: %llu %d-byte logical blocks (%s/%s)\n",
> + (unsigned long long)capacity,
> + qu...
2011 Jan 27
1
[PATCH] virtio_blk: allow re-reading config space at runtime
...with warning. */
> + if ((sector_t)capacity != capacity) {
> + dev_warn(&vdev->dev, "Capacity %llu too large: truncating\n",
> + (unsigned long long)capacity);
> + capacity = (sector_t)-1;
> + }
> +
> + size = capacity * queue_logical_block_size(q);
> + string_get_size(size, STRING_UNITS_2, cap_str_2, sizeof(cap_str_2));
> + string_get_size(size, STRING_UNITS_10, cap_str_10, sizeof(cap_str_10));
> +
> + dev_notice(&vdev->dev,
> + "new size: %llu %d-byte logical blocks (%s/%s)\n",
> + (unsigned long long)capacity,
> + qu...