bdev/gpt: fix gpt scan for block sizes > 32KB

32KB spdk_bdev_read was failing straight away
on bdevs with block size bigger than that.

Change-Id: I83efe4284a3b82b83db0f678abb134c5daa36a84
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/383499
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2017-10-23 20:59:27 +02:00 committed by Daniel Verkamp
parent d08a33f5a3
commit 0587e970e5
2 changed files with 4 additions and 2 deletions

View File

@ -48,6 +48,7 @@
struct spdk_gpt {
unsigned char *buf;
uint64_t buf_size;
uint64_t lba_start;
uint64_t lba_end;
uint64_t total_sectors;

View File

@ -132,7 +132,8 @@ spdk_gpt_base_bdev_init(struct spdk_bdev *bdev)
}
gpt = &gpt_base->gpt;
gpt->buf = spdk_dma_zmalloc(SPDK_GPT_BUFFER_SIZE, 0x1000, NULL);
gpt->buf_size = spdk_max(SPDK_GPT_BUFFER_SIZE, bdev->blocklen);
gpt->buf = spdk_dma_zmalloc(gpt->buf_size, 0x1000, NULL);
if (!gpt->buf) {
SPDK_ERRLOG("Cannot alloc buf\n");
spdk_bdev_part_base_free(&gpt_base->part_base);
@ -342,7 +343,7 @@ vbdev_gpt_read_gpt(struct spdk_bdev *bdev)
}
rc = spdk_bdev_read(gpt_base->part_base.desc, gpt_base->ch, gpt_base->gpt.buf, 0,
SPDK_GPT_BUFFER_SIZE, spdk_gpt_bdev_complete, gpt_base);
gpt_base->gpt.buf_size, spdk_gpt_bdev_complete, gpt_base);
if (rc < 0) {
spdk_put_io_channel(gpt_base->ch);
spdk_bdev_part_base_free(&gpt_base->part_base);