bdev/gpt: vbdev_gpt_examine: no need to read gpt if bdev is too small

Change-Id: I28f21649feae8022cd0f0afd5b01ae3ee2b3592e
Signed-off-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-on: https://review.gerrithub.io/424618
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
wuzhouhui 2018-09-05 10:06:21 +08:00 committed by Jim Harris
parent b98bbb18c6
commit e133dcd850

View File

@ -384,7 +384,10 @@ vbdev_gpt_examine(struct spdk_bdev *bdev)
{
int rc;
if (g_gpt_disabled) {
/* A bdev with fewer than 2 blocks cannot have a GPT. Block 0 has
* the MBR and block 1 has the GPT header.
*/
if (g_gpt_disabled || spdk_bdev_get_num_blocks(bdev) < 2) {
spdk_bdev_module_examine_done(&gpt_if);
return;
}