From nobody Mon Feb 9 09:43:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=philmd@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599136140; cv=none; d=zohomail.com; s=zohoarc; b=bCFbncdLMgAvq8r5CClezoVp8IC66qrkv3G6luTId1XxtyotcZzzWrJLEqzm+CdPuUgFNtQI74VRb2wiT8Ki6fS1YOyT0Li2IPLzBCnxdcf+yw6t6O/s2omjLaOl0MPYQhHRfFgQ26RUofgh6lhzTmJow2HebQ+3hNdeAwnXnJE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599136140; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=BnPRrVeAnWqBsNzNwsX+5XPQmBcv+SY5NaSBhpbVhLQ=; b=Y7vgd0iTo0hTMBIwL4DzWjH/qB23+dFSrqyktKseSySYblt6p3n1dYibqcuAsAttD2ZdUDRSBpDgifR6y1VHvX0SKUJsryZBcb3ulDqenwbQEbPSb1+Yo0Bre/7oEI+HG5XLI23d4iUJAsGV4Uf67w2Kdas8aEVjV7CcayNRNjg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1599136140024584.0506146432336; Thu, 3 Sep 2020 05:29:00 -0700 (PDT) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-388-WDsfFZUJNu2HLkGx9qY91g-1; Thu, 03 Sep 2020 08:28:55 -0400 Received: by mail-wr1-f72.google.com with SMTP id o6so905126wrp.1 for ; Thu, 03 Sep 2020 05:28:55 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (50.red-83-52-54.dynamicip.rima-tde.net. [83.52.54.50]) by smtp.gmail.com with ESMTPSA id c205sm4141814wmd.33.2020.09.03.05.28.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2020 05:28:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599136139; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BnPRrVeAnWqBsNzNwsX+5XPQmBcv+SY5NaSBhpbVhLQ=; b=dX6KyRiUjM1FEBWVAwSw5q/NrcKhOfyql7vDn0vQ/07cFhdj6p810qqzIqnFdcrEdN4cbT Y9BFS3diF0QFwI+OAziwP68MGSEWI0w6MkWq2BIY1QPndZUKCUt1vVermHSR6w5ff12UXF gXhoQOV6wWNcCttFq6ZTjwtxuZx3pNM= X-MC-Unique: WDsfFZUJNu2HLkGx9qY91g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BnPRrVeAnWqBsNzNwsX+5XPQmBcv+SY5NaSBhpbVhLQ=; b=h/vIDZnWujXneo1fPeQ6ej7t2fPYx+L4NiLmqK87RL81xskNXpkpDAJRRCc8cTcMTR jO8TKTE5mCcm4iLFVtcjtejS53xE9bNNwfrQgP2Mx2kqedCOrDi7S17Y4tZ7joktPw/Z ctEgE1DSQ5qXEjS84a65Midub+ncmrHFPvxvNG7clw805MA5ky3nDr/xCsBZyX78rrSO BPp7C0vuPeGRhe1fVevg4gzm5FIYpr0TTEv70b2cL4XikFodn/PPRM/J/uiU11oguh54 ZNaIwPidbj1EO17vcvuoj6gLjs0yFQ3tPal8WPmeHU7pUfPq1hMcEGzwAs51YVBNK7AL th7Q== X-Gm-Message-State: AOAM531fxX9gKdHCkKl3T+GuuCkk6BGUMIfYjpdjaAU9CznAv6/Xsj/h 6sq+MoJueVavbmkskmh1GB5Z5bHejfADRekz6yNM6c/+QBBRSG27v85AlICDgwxe/Qu6Nt05LUP P/mAyvaeiTt2XFg== X-Received: by 2002:a05:600c:4104:: with SMTP id j4mr2216238wmi.36.1599136134374; Thu, 03 Sep 2020 05:28:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1P3xKCkdotZ0ihxXbFO5u+kzSZKJ7KrT0DsSjzP8T2WwFaB08L3C0krZVqlKTXYKNziB4Ig== X-Received: by 2002:a05:600c:4104:: with SMTP id j4mr2216219wmi.36.1599136134193; Thu, 03 Sep 2020 05:28:54 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Klaus Jensen , Fam Zheng , Max Reitz , Keith Busch , Kevin Wolf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Stefano Garzarella Subject: [PATCH v7 10/15] block/nvme: Replace qemu_try_blockalign(bs) by qemu_try_memalign(pg_sz) Date: Thu, 3 Sep 2020 14:27:58 +0200 Message-Id: <20200903122803.405265-11-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200903122803.405265-1-philmd@redhat.com> References: <20200903122803.405265-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0.003 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) qemu_try_blockalign() is a generic API that call back to the block driver to return its page alignment. As we call from within the very same driver, we already know to page alignment stored in our state. Remove indirections and use the value from BDRVNVMeState. This change is required to later remove the BlockDriverState argument, to make nvme_init_queue() per hardware, and not per block driver. Reviewed-by: Stefan Hajnoczi Reviewed-by: Stefano Garzarella Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 60e39b69a23..0c8ad1d60b6 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -174,7 +174,7 @@ static void nvme_init_queue(BlockDriverState *bs, NVMeQ= ueue *q, =20 bytes =3D ROUND_UP(nentries * entry_bytes, s->page_size); q->head =3D q->tail =3D 0; - q->queue =3D qemu_try_blockalign(bs, bytes); + q->queue =3D qemu_try_memalign(s->page_size, bytes); if (!q->queue) { error_setg(errp, "Cannot allocate queue"); return; @@ -223,7 +223,7 @@ static NVMeQueuePair *nvme_create_queue_pair(BlockDrive= rState *bs, if (!q) { return NULL; } - q->prp_list_pages =3D qemu_try_blockalign(bs, + q->prp_list_pages =3D qemu_try_memalign(s->page_size, s->page_size * NVME_NUM_REQS); if (!q->prp_list_pages) { goto fail; @@ -522,7 +522,7 @@ static void nvme_identify(BlockDriverState *bs, int nam= espace, Error **errp) .cdw10 =3D cpu_to_le32(0x1), }; =20 - id =3D qemu_try_blockalign(bs, sizeof(*id)); + id =3D qemu_try_memalign(s->page_size, sizeof(*id)); if (!id) { error_setg(errp, "Cannot allocate buffer for identify response"); goto out; @@ -1141,7 +1141,7 @@ static int nvme_co_prw(BlockDriverState *bs, uint64_t= offset, uint64_t bytes, return nvme_co_prw_aligned(bs, offset, bytes, qiov, is_write, flag= s); } trace_nvme_prw_buffered(s, offset, bytes, qiov->niov, is_write); - buf =3D qemu_try_blockalign(bs, bytes); + buf =3D qemu_try_memalign(s->page_size, bytes); =20 if (!buf) { return -ENOMEM; @@ -1285,7 +1285,7 @@ static int coroutine_fn nvme_co_pdiscard(BlockDriverS= tate *bs, =20 assert(s->nr_queues > 1); =20 - buf =3D qemu_try_blockalign(bs, s->page_size); + buf =3D qemu_try_memalign(s->page_size, s->page_size); if (!buf) { return -ENOMEM; } --=20 2.26.2